Playing media on repeat
Playing media is easy with Phonegap / Cordova using the core media plugin. I’m using it in the game I’m writing.
The issue is, I wanted to be able to play a background music loop on repeat (don’t worry, the user can switch this off in my apps settings, or simply mute the sound).
There’s an “iOS Quirk” that makes this really easy for iOS devices. From the documentation:
“numberOfLoops: Pass this option to the play method to specify the number of times you want the media file to play”
It’s a bit frustrating that you can’t do
numberOfLoops: -1 to repeat indefinitely, but I can live with it. The issue is, you can’t do this on Android.
I’m using the
mediaStatus callback that executes when the media status changes, to check to see if the media has stopped playing (it’s finished) and to play the media again.
Can we have a
repeat: true please?