Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video recording not getting store with android 11 #632

Open
SaggamAnand opened this issue Apr 27, 2022 · 0 comments
Open

Video recording not getting store with android 11 #632

SaggamAnand opened this issue Apr 27, 2022 · 0 comments

Comments

@SaggamAnand
Copy link

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

(Write your answer here.)

Environment

(Please include the following information along with any other relevant environment details.)

CameraKit Version: Tried with all the version

Android Device:
One plus 6T
Android Version:
Android 11, API level:31, target SDK/compile SDK:31

Steps to Reproduce

(Write your steps here:)

  1. Setup the project with a camera kit, and started the capturing the video, able to capture video as well, but it is not getting stored on the local device because from Android 11 and with target SDK:31, we need to use the scoped storage (Just for reference: https://developer.android.com/about/versions/11/privacy/storage) Also google not allow to upload app on play store if target SDK not greater than 31.

  2. I would like to show the preview of the captured video, but as it's not getting stored in scope storage, not able to show the preview.

  3. I just go through went the Camera1.class (https://github.com/CameraKit/camerakit-android/blob/master/camerakit/src/main/api16/com/wonderkiln/camerakit/Camera1.java) and what I found it we have not change the file storage to scope storage in private File getVideoFile() method.
    4.Just paste the code for the reference:
    private File getVideoFile() {
    ```
    if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) {
    return null;
    }

     File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), "Camera");
    
     if (!mediaStorageDir.exists()) {
         if (!mediaStorageDir.mkdirs()) {
             return null;
         }
     }
    
     return new File(mediaStorageDir.getPath() + File.separator + "video.mp4");
    

    }



### Expected Behavior

<!--
 should be able to capture video with android 11 and target SDK 31-->

(Write what you thought would happen.)

### Actual Behavior
Captured video is not getting saved. because with Android 11 device and target SDK 31, scope storage not implemented in Camare1.c
private File getVideoFile() {
        if (!Environment.getExternalStorageState().equalsIgnoreCase(Environment.MEDIA_MOUNTED)) {
            return null;
        }

        File mediaStorageDir = new File(Environment.getExternalStorageDirectory(), "Camera");

        if (!mediaStorageDir.exists()) {
            if (!mediaStorageDir.mkdirs()) {
                return null;
            }
        }

        return new File(mediaStorageDir.getPath() + File.separator + "video.mp4");
    }
(Write what happened. Add screenshots!)

### Reproducible Demo
https://developer.android.com/about/versions/11/privacy/storage
  Thanks for helping us help you!
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant