sc0ttdav3y commented on issue #314: URL: https://github.com/apache/cordova-plugin-media/issues/314#issuecomment-934094029
I've got this too. I believe it's related to changes to Android's new filesystem permissions in 11. https://developer.android.com/training/data-storage/use-cases#opt-out-scoped-storage See this long thread over at https://github.com/apache/cordova-plugin-file/issues/426 for some info on how other plugins are battling it out: I haven't found a solution yet but I'll add some info here if I find anything. Others have been juggling the API version to work around it but that's no longer an option for those publishing to Google Play. Here's relevant logging info from `adb logcat` that may be of use to the plugin maintainers. The main errors seem to be: ``` MediaProvider: java.lang.IllegalArgumentException: Primary directory null not allowed for content://media/external_primary/file; allowed directories are [Download, Documents] ``` and ``` System.err: java.io.FileNotFoundException: /storage/emulated/0/tmprecording-1633411896974.3gp: open failed: EPERM (Operation not permitted) ``` Here's the full log: ``` MediaRecorder: Constructor MediaRecorder MediaRecorderJNI: setup StagefrightRecorder: property set(service.camera.rec.running, 0) result = 0 MediaPlayerService: Create new media recorder client from pid 27788 RestrictionPolicy: userId: 0, isMicrophoneEnabledAsUser : true MediaRecorderJNI: setAudioSource(1) MediaRecorderJNI: setAudioEncoder(3) RestrictionPolicy: userId: 0, isMicrophoneEnabledAsUser : true RestrictionPolicy: userId: 0 isAudioRecordAllowed : true MediaProvider: insertFileIfNecessary failed MediaProvider: java.lang.IllegalArgumentException: Primary directory null not allowed for content://media/external_primary/file; allowed directories are [Download, Documents] MediaProvider: at com.android.providers.media.MediaProvider.ensureFileColumns(MediaProvider.java:2932) MediaProvider: at com.android.providers.media.MediaProvider.ensureUniqueFileColumns(MediaProvider.java:2597) MediaProvider: at com.android.providers.media.MediaProvider.insertFile(MediaProvider.java:3291) MediaProvider: at com.android.providers.media.MediaProvider.insertInternal(MediaProvider.java:3844) MediaProvider: at com.android.providers.media.MediaProvider.insert(MediaProvider.java:3555) MediaProvider: at com.android.providers.media.MediaProvider.insertFileForFuse(MediaProvider.java:7199) MediaProvider: at com.android.providers.media.MediaProvider.insertFileIfNecessaryForFuse(MediaProvider.java:7293) System.err: java.io.FileNotFoundException: /storage/emulated/0/tmprecording-1633411896974.3gp: open failed: EPERM (Operation not permitted) System.err: at libcore.io.IoBridge.open(IoBridge.java:492) System.err: at java.io.RandomAccessFile.<init>(RandomAccessFile.java:289) System.err: at java.io.RandomAccessFile.<init>(RandomAccessFile.java:152) System.err: at android.media.MediaRecorder.prepare(MediaRecorder.java:1417) System.err: at org.apache.cordova.media.AudioPlayer.startRecording(AudioPlayer.java:161) System.err: at org.apache.cordova.media.AudioHandler.startRecordingAudio(AudioHandler.java:287) System.err: at org.apache.cordova.media.AudioHandler.promptForRecord(AudioHandler.java:543) System.err: at org.apache.cordova.media.AudioHandler.execute(AudioHandler.java:118) System.err: at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98) System.err: at org.apache.cordova.PluginManager.exec(PluginManager.java:139) System.err: at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59) System.err: at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41) System.err: at android.os.MessageQueue.nativePollOnce(Native Method) System.err: at android.os.MessageQueue.next(MessageQueue.java:335) System.err: at android.os.Looper.loop(Looper.java:206) System.err: at android.os.HandlerThread.run(HandlerThread.java:67) System.err: Caused by: android.system.ErrnoException: open failed: EPERM (Operation not permitted) System.err: at libcore.io.Linux.open(Native Method) System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) System.err: at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254) System.err: at libcore.io.ForwardingOs.open(ForwardingOs.java:166) System.err: at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8448) System.err: at libcore.io.IoBridge.open(IoBridge.java:478) System.err: ... 15 more PluginManager: THREAD WARNING: exec() call to Media.startRecordingAudio blocked the main thread for 35ms. Plugin should use CordovaInterface.getThreadPool(). chromium: [INFO:CONSOLE(406)] "recordAudio():Audio Error [object Object]", source: http://localhost:8080/app.js (406) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
