You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2020/10/06 04:21:34 UTC

[GitHub] [cordova-plugin-media] jdnichollsc commented on issue #277: [Android only] Audio file doesn't play

jdnichollsc commented on issue #277:
URL: https://github.com/apache/cordova-plugin-media/issues/277#issuecomment-704018234


   Hello folks,
   I'm creating a file with **cordova-plugin-file**:
   ```ts
   
   const path = this.file.cacheDirectory;
   const name = `record_audio.wav`;
   this.audioFile = await this.file.createFile(path, name, true);
   ```
   then I'm recording audio using that file with **cordova-plugin-media**
   ```ts
   this.audioMediaSrc = this.audioFile.nativeURL.replace(/^file:[\/]+/, '');
   this.audioMedia = this.media.create(this.audioMediaSrc);
   this.audioMedia.startRecord();
   ```
   And I already have **requestLegacyExternalStorage**:
   ```xml
   <preference name="android-minSdkVersion" value="19" />
   <preference name="android-targetSdkVersion" value="29" />
   <preference name="AndroidPersistentFileLocation" value="Compatibility" />
   <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
       <application android:networkSecurityConfig="@xml/network_security_config" />
       <application android:requestLegacyExternalStorage="true" />
   </edit-config>
   ```
   
   But I'm getting these issues:
   ```
   2020-10-05 23:12:25.994 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: setup
   2020-10-05 23:12:25.998 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: setAudioSource(1)
   2020-10-05 23:12:26.025 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: setAudioEncoder(3)
   2020-10-05 23:12:26.030 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: setOutputFile
   2020-10-05 23:12:26.030 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: prepare
   2020-10-05 23:12:26.038 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: start
   2020-10-05 23:12:26.236 8428-8875/com.legalesolutions.defemil W/PluginManager: THREAD WARNING: exec() call to Media.startRecordingAudio blocked the main thread for 242ms. Plugin should use CordovaInterface.getThreadPool().
   2020-10-05 23:12:30.064 8428-8428/com.legalesolutions.defemil D/ViewRootImpl@27fedad[MainActivity]: ViewPostIme pointer 1
   2020-10-05 23:12:30.068 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: stop
   2020-10-05 23:12:30.168 8428-8875/com.legalesolutions.defemil I/MediaRecorderJNI: native_reset
   2020-10-05 23:12:30.168 8428-8875/com.legalesolutions.defemil D/AudioPlayer: stopping recording
   2020-10-05 23:12:30.171 8428-8875/com.legalesolutions.defemil D/AudioPlayer: size = 1
   2020-10-05 23:12:30.171 8428-8875/com.legalesolutions.defemil D/AudioPlayer: renaming /storage/emulated/0/tmprecording-1601957546027.3gp to /storage/emulated/0/data/user/0/com.legalesolutions.defemil/cache/record_1601957545941.wav
   2020-10-05 23:12:30.172 8428-8875/com.legalesolutions.defemil W/System.err: java.io.FileNotFoundException: /storage/emulated/0/data/user/0/com.legalesolutions.defemil/cache/record_1601957545941.wav: open failed: ENOENT (No such file or directory)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:496)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:235)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.media.AudioPlayer.moveFile(AudioPlayer.java:210)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.media.AudioPlayer.stopRecording(AudioPlayer.java:311)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.media.AudioHandler.stopRecordingAudio(AudioHandler.java:298)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.media.AudioHandler.execute(AudioHandler.java:121)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:59)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at android.os.MessageQueue.nativePollOnce(Native Method)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at android.os.MessageQueue.next(MessageQueue.java:336)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at android.os.Looper.loop(Looper.java:197)
   2020-10-05 23:12:30.173 8428-8875/com.legalesolutions.defemil W/System.err:     at android.os.HandlerThread.run(HandlerThread.java:67)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.Linux.open(Native Method)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.ForwardingOs.open(ForwardingOs.java:167)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8002)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err:     at libcore.io.IoBridge.open(IoBridge.java:482)
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/System.err: 	... 14 more
   2020-10-05 23:12:30.174 8428-8875/com.legalesolutions.defemil W/PluginManager: THREAD WARNING: exec() call to Media.stopRecordingAudio blocked the main thread for 106ms. Plugin should use CordovaInterface.getThreadPool().
   ```
   
   Do you know why?
   Any help is really appreciated! <3


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org