Skip to content Skip to sidebar Skip to footer

Mediarecorder Start Called In Invalid State: 4

I've just started getting into android/Glass development and I was trying to add basic video recording functionality. Currently Glass limits you to 10 seconds unless you tap/press

Solution 1:

Try add <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> to your AndroidManifest.xml

Solution 2:

Change your location to:

 Environment.getExternalStorageDirectory() + File.separator 
            + Environment.DIRECTORY_DCIM + File.separator + "FILE_NAME";

This worked for me. Hope it helps!

Solution 3:

Open AndroidManifest file and inside application tag add this

android:requestLegacyExternalStorage="true"

Solution 4:

I ran into the same issue on some Android devices. I was using Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES) as the output for the MediaRecorder instance. After reading is3av's answer, I changed the output path to Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) and the problem is solved.

Seems like some phones don't allow files to be written to Environment.DIRECTORY_MOVIES path or that path doesn't exist.

Post a Comment for "Mediarecorder Start Called In Invalid State: 4"