I am shooting a video using camera2 API and Google code example .
I encounter a problem when I try to change the location of the output, which will be saved on sdcard/MyApp/filenameinstead Android/data/my_package/filename.
Here is a way:
private File getVideoFile(Context context) {
return new File(Environment.getExternalStorageDirectory().getPath() +
"/myApp/", "myVideo.mp4");
return new File(context.getExternalFilesDir(null), "myVideo.mp4");
}
So my question is why saving video on the SD card causes a "Black Preview" and how can I save the video on the SD card?
Thanks!
CHANGE the resolution I set:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.CAMERA"/>
source
share