'How to change video orientation to portrait in default camera view in Android?
We are working on a video recording application. Users can record videos and upload them. We wish to restrict portrait videos. We plan to record a video intro, don't allow the video to be show in "landscape" mode. It should force the user to only use portrait mode (taller vertically)
private fun openVideo() {
val timeStamp: String = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val videoFileName = "$timeStamp.mp4"
pictureVideoPath = "$videoFilePath/$videoFileName"
val file = File(pictureVideoPath)
val outputFileUri = FileProvider.getUriForFile(requireActivity(),
BuildConfig.APPLICATION_ID + ".fileprovider",
file)
Log.v("OutputVideoUri", outputFileUri.toString())
val cameraIntent = Intent(MediaStore.ACTION_VIDEO_CAPTURE)
cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 30)
cameraIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1)
cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri)
startActivityForResult(cameraIntent, mRequestVideoCapture)
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
