Phonegap / Cordova - media api - when playing audio from a URL, the user interface is delayed for a few seconds

After several days of investigation, I still had no luck on this issue, thanks in advance if you can help me!

I am using cordova 3.3 for my iOS application, one of the functions is playing the audio clip at the URL.

I use the cordless api environment, here is how I use it according to their official examples

var myMedia = new Media (" http://123.com/xyz.mp3 "); myMedia.play ()

this is the problem: when the game event is triggered, the user interface is delayed for a few seconds,

I believe that this is due to retrieving the remote resource from http://123.com/xyz.mp3 , when you play mp3 locally, there is no such problem.

The media api does not seem to offer a preload function.

when downloading a remote mp3 file, it uses the same stream as the user interface, so it freezes until the download task is completed.

Does anyone have a similar problem? How to solve this problem?

Thank you so much for the time :)

+4
source share
1 answer

We are currently developing an application that transmits music, and we had the same problem.

HTMLAudioElement. .

var myAudio = new Audio("http://123.com/xyz.mp3");
myAudio.play();

, , . , .

, Android API- HTML5 Media Audio Element ( ). , Android, , , API Phonegap Media.

+3

All Articles