1 decade ago by christianhood
Hello,
I'm trying to learn how to use Cordova (PhoneGap) to port ImpactJS games over to the phones (Android/iOS/WP7), however (as expected) the sound doesn't work. I've looked at the API for Cordova and saw this:
http://docs.phonegap.com/en/1.8.1/cordova_media_media.md.html#media.play
I'm currently trying to implement this with the Drop sample, but I'm getting the following error:
I have the cordova .js file included in my index.html along with the game and impact.js files.
Here is an example of how I attempted to do this:
Any help as to what I'm doing wrong is appreciated.
I'm trying to learn how to use Cordova (PhoneGap) to port ImpactJS games over to the phones (Android/iOS/WP7), however (as expected) the sound doesn't work. I've looked at the API for Cordova and saw this:
http://docs.phonegap.com/en/1.8.1/cordova_media_media.md.html#media.play
I'm currently trying to implement this with the Drop sample, but I'm getting the following error:
ReferenceError: Media is not defined
I have the cordova .js file included in my index.html along with the game and impact.js files.
Here is an example of how I attempted to do this:
//sound: new ig.Sound('media/bounce.ogg'), sound: new Media('media/bounce.mp3', onSuccess, onError), // onSuccess Callback // onSuccess: function() { console.log("playAudio():Audio Success"); }, // onError Callback // onError: function(error) { alert('code: ' + error.code + '\n' + 'message: ' + error.message + '\n'); },
Any help as to what I'm doing wrong is appreciated.