Closed crocsandcoffee closed 2 years ago
@omid-io can you tell me how you record the video using this library because there is no documentation about how to record it and which callback is required. For this.
@Himanshu507 if you follow the "Steps to Reproduce" in my first comment, it should guide you at a high level on the setup needed in order to record video via this library
But basically after adding the library as a dependency and doing the straightforward frontend setup...
Call the
Environment
CameraKit Version: 0.13.5
Android Device: Pixel 3 XL
Android Version: 10
Steps to Reproduce
Expected Behavior
A video file should be created and passed back to this method.
What is happening
The callback doesn't get invoked because devices running Android 10 use the new "scoped" storage by default and not the "legacy storage". Android R will be making it a requirement for using only the new "scoped" storage regardless of targetSDK. Libraries should check what type of storage is being used by makings calls to Environment.isExternalStorageLegacy(), which will return true if the app is in legacy mode, false otherwise, and use the appropriate file APIs. After forking the library and debugging, I found this was the issue. What's happening under the hood is when we call captureVideo, the method captureVideo is called in the Camera1 class. A permission exception is bubbled up from the MediaRecorder.prepare() method which is called because the wrong file APIs are being used by the Camera1 class for an app using the new "scoped" storage.
Temporary solution: apps can add
android:requestLegacyExternalStorage="true"
to their AndroidManifest to enforce using the old legacy storage and everything works fine. But this will break once Android R rolls out and makes it a requirement to using the new "scoped" storage. The camerakit library will break host apps at that point if they don't add support for reading/writing appropriately for the new "scoped" storage.