Im using Media like this:
var my_media = new Media(src);
my_media.play()
Most sound clips are really short, like 2-3 seconds. I play back a sound when the user clicks the play sound buttons. If I keep pressing play continuasly the Mediaplayer crashes or something, the sound stops playing and in Eclips its says this: Unable to create media player.
The app still works, but all the sound in the app stops playing.
Kindly use
var my_media = new Media(src, onSuccess, onError);
my_media.play();
// onSuccess Callback
function onSuccess() {
my_media.release();
console.log("playAudio():Audio Success");
}
// onError Callback
function onError(error) {
console.log('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
The Main Highlight point is that use "my_media.release();" in onSuccess callback
REF: http://docs.phonegap.com/en/1.0.0/phonegap_media_media.md.html#media.release
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.