L
L
linki2017-06-25 11:00:39
Android
linki, 2017-06-25 11:00:39

Video recording on sd card android not working?

Tried two ways:

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

or
File sdCard = Environment.getExternalStorageDirectory();
File mediaStorageDir = new File(sdCard.getAbsolutePath() + "/AppDir");

but in both cases, the video is recorded to the internal memory.
mediaFile = new File(mediaStorageDir.getPath() + File.separator + "VID_"+ timeStamp + ".mp4");

Permissions:
@AfterPermissionGranted(RC_CAMERA_AND_LOCATION)
    private void methodRequiresTwoPermission() {
        String[] perms = {
                Manifest.permission.CAMERA,
                Manifest.permission.WRITE_EXTERNAL_STORAGE;
        if (EasyPermissions.hasPermissions(getContext(), perms)) {
            Log.d("PERMISSIONS", "All right");
            initService();
        } else {
            EasyPermissions.requestPermissions(this, "Need perms", RC_CAMERA_AND_LOCATION, perms);
        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question