Phonegap 3.0 Media API - Broken?

I am trying to play an audio file in Phonegap 3.0, working on Windows, Android platform, debugging Eclipse.

I am trying to upgrade my working, error-free application to 3.0 and I have a lot of problems.

For example, when I play a sound, it plays, then I get a file rename error in a nonexistent tmp file from the MediaRecorder API? However, I do not name the renaming or writing.

  • It appears that after calling the call for the audio command, the audio recording API is called. There should be some serious bugs with how 3.0 works.

Here is the magazine. Since you can see that the sound file plays normally, for some reason MediaRecorder is called and it is trying to rename the tmp file that does not exist. It doesn’t matter, my code has not changed during the update, so there is no reason for any of these errors. I am following the Media Play API from the 3.0 documentation. I also get new thread warning alerts. The sound file that I play is a short clip under 100 KB.

The plugin was added using the CLI tool, I added the function code to the config.xml file, and I added permissions to the manifest file. I read that others have this problem and there seems to be no solution.

09-08 15:06:07.821: D/webview(9279): [WebView::UPDATE_SELECTION] ====== start 09-08 15:06:07.951: V/MediaRecorderJNI(9279): setup 09-08 15:06:07.951: V/MediaRecorderJNI(9279): setMediaRecorder E: mr = mr 09-08 15:06:07.951: V/MediaRecorderJNI(9279): setMediaRecorder X 09-08 15:06:07.961: W/PluginManager(9279): THREAD WARNING: exec() call to Media.create blocked the main thread for 31ms. Plugin should use CordovaInterface.getThreadPool(). 09-08 15:06:07.961: I/AudioSystem(9279): getting audio flinger 09-08 15:06:07.961: I/AudioSystem(9279): returning new audio session id 09-08 15:06:07.971: D/MediaPlayer(9279): setDataSource(FileDescriptor fd) in 09-08 15:06:07.981: D/dalvikvm(9279): GC_CONCURRENT freed 421K, 49% free 3166K/6151K, external 0K/0K, paused 2ms+3ms 09-08 15:06:08.021: D/MediaPlayer(9279): setDataSource(FileDescriptor fd) out 09-08 15:06:08.041: W/PluginManager(9279): THREAD WARNING: exec() call to Media.startPlayingAudio blocked the main thread for 78ms. Plugin should use CordovaInterface.getThreadPool(). 09-08 15:06:08.041: D/CordovaLog(9279): file:///android_asset/www/js/test.js: Line 1463 : maxTempCount: 1 09-08 15:06:08.041: I/Web Console(9279): maxTempCount: 1 at file:///android_asset/www/js/test.js:1463 09-08 15:06:08.041: D/AudioPlayer(9279): Send a onStatus update for the new seek 09-08 15:06:08.041: D/MediaPlayer(9279): start() in 09-08 15:06:08.051: D/MediaPlayer(9279): start() out 09-08 15:06:11.465: D/AudioPlayer(9279): on completion is calling stopped 09-08 15:06:11.545: D/CordovaLog(9279): file:///android_asset/www/js/test.js: Line 1391 : playAudio():Audio Success: sound.mp3 09-08 15:06:11.545: I/Web Console(9279): playAudio():Audio Success: sound.mp3 at file:///android_asset/www/js/test.js:1391 09-08 15:06:11.555: D/MediaPlayer(9279): release() in 09-08 15:06:11.565: D/MediaPlayer(9279): release() out 09-08 15:06:11.565: V/MediaRecorderJNI(9279): native_reset 09-08 15:06:11.565: V/MediaRecorderJNI(9279): getMediaRecorder E 09-08 15:06:11.565: V/MediaRecorderJNI(9279): process_media_recorder_call 09-08 15:06:11.565: D/AudioPlayer(9279): renaming /mnt/sdcard/tmprecording.3gp to /mnt/sdcard/Downloaded/sound.mp3 09-08 15:06:11.565: E/AudioPlayer(9279): FAILED renaming /mnt/sdcard/tmprecording.3gp to /mnt/sdcard/Downloaded/sound.mp3 09-08 15:06:11.565: V/MediaRecorderJNI(9279): release 09-08 15:06:11.565: V/MediaRecorderJNI(9279): setMediaRecorder E: mr = null 09-08 15:06:11.575: V/MediaRecorderJNI(9279): setMediaRecorder X 09-08 15:06:11.575: W/PluginManager(9279): THREAD WARNING: exec() call to Media.release blocked the main thread for 19ms. Plugin should use CordovaInterface.getThreadPool(). 09-08 15:06:11.585: D/CordovaLog(9279): file:///android_asset/www/js/test.js: Line 1628 : ==LOG== flag: sound.mp3 result: 3 09-08 15:06:11.585: I/Web Console(9279): ==LOG== flag: sound.mp3 result: 3 at file:///android_asset/www/js/test.js:1628 
+4
source share
1 answer

I feel your pain. I spent a lot of time listening to audio and video to work on iOS and ANDROID in my PhoneGap application ... almost with tears when I was working. As soon as I switched sides, I did everything I could to extract the basic functionality into an offline set of files so that I could use it again and again. Feel free to watch and test if you want:

BTW - here the functionality uses the PhoneGap Media API for audio whenever possible. Let me know if that helps at all.

+1
source

Source: https://habr.com/ru/post/1501207/


All Articles