Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-12240

Recording audio with MediaPlugin on Android failed with exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Ionic
    • Android

    Description

      Recording audio using the MediaPlugin on Android fails with exception. The audiorecorder seems to be working, but the file never gets created.

      The following exception is shown in the logs:

      12-12 05:57:08.397  1777  1818 D AudioPlayer: stopping recording
      12-12 05:57:08.401  1777  1818 D AudioPlayer: size = 2
      12-12 05:57:08.402  1777  1818 E AudioPlayer: /storage/emulated/0/tmprecording-1481540219004.3gp: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: java.io.FileNotFoundException: /storage/emulated/0/tmprecording-1481540219004.3gp: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.IoBridge.open(IoBridge.java:452)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at java.io.FileInputStream.<init>(FileInputStream.java:76)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.moveFile(AudioPlayer.java:213)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.stopRecording(AudioPlayer.java:271)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.destroy(AudioPlayer.java:133)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioHandler.release(AudioHandler.java:276)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioHandler.execute(AudioHandler.java:170)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.Handler.dispatchMessage(Handler.java:102)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.Looper.loop(Looper.java:148)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.HandlerThread.run(HandlerThread.java:61)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.Posix.open(Native Method)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.IoBridge.open(IoBridge.java:438)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	... 15 more
      12-12 05:57:08.402  1777  1818 E AudioPlayer: /storage/emulated/0/tmprecording-1481540219004.3gp: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: java.io.FileNotFoundException: /storage/emulated/0/tmprecording-1481540219004.3gp: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.IoBridge.open(IoBridge.java:452)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at java.io.FileInputStream.<init>(FileInputStream.java:76)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.moveFile(AudioPlayer.java:213)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.stopRecording(AudioPlayer.java:271)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioPlayer.destroy(AudioPlayer.java:133)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioHandler.release(AudioHandler.java:276)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.media.AudioHandler.execute(AudioHandler.java:170)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.CordovaPlugin.execute(CordovaPlugin.java:98)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.PluginManager.exec(PluginManager.java:132)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.CordovaBridge.jsExec(CordovaBridge.java:57)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.apache.cordova.engine.SystemExposedJsApi.exec(SystemExposedJsApi.java:41)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at org.chromium.base.SystemMessageHandler.handleMessage(SystemMessageHandler.java:53)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.Handler.dispatchMessage(Handler.java:102)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.Looper.loop(Looper.java:148)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at android.os.HandlerThread.run(HandlerThread.java:61)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.Posix.open(Native Method)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	at libcore.io.IoBridge.open(IoBridge.java:438)
      12-12 05:57:08.402  1777  1818 E AudioPlayer: 	... 15 more
      

      This can be easily reproduced by running the following code on an Android emulator or phone. iOS does NOT have this issue:

      fileRecord = new MediaPlugin('./.aep-recording.wav');
      fileRecord.startRecording();
      fileRecord.stopRecording();
      

      Output from ionic info

      Cordova CLI: 6.4.0
      Ionic Framework Version: 2.0.0-rc.3
      Ionic CLI Version: 2.1.14
      Ionic App Lib Version: 2.1.7
      Ionic App Scripts Version: 0.0.46
      ios-deploy version: 1.8.6
      ios-sim version: 5.0.8
      OS: OS X El Capitan
      Node Version: v6.9.1
      Xcode version: Xcode 8.1 Build version 8B62
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            marijngiesen Marijn Giesen
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: