I have made a game for android using html, css and javascript, whit phonegap build.
It runs really well in android 5.0+ but under that versions, it has some problems like dont play the mp3 files, dont positioning correctly some elements that Iposition with javascript, and dont create an element to add a click event that I create with javascript too.
It seems like my javascript file doesnt work well under android 5.0.
any help?
It runs really well in android 5.0+ but under that versions, it has some problems like dont play the mp3 files, dont positioning correctly some elements that Iposition with javascript, and dont create an element to add a click event that I create with javascript too.
It seems like my javascript file doesnt work well under android 5.0.
any help?
- 28 Posts
- 0 Reply Likes
Posted 4 years ago
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
function goLoop(status) {
if (status === Media.MEDIA_STOPPED) {
my_media2.play();
}
}
var my_media1 = new Media(firstAudioUrl, false, false, goLoop);
var my_media2 = new Media(secondAudioUrl, false, false, goLoop);
my_media1.play();
- 28 Posts
- 0 Reply Likes
it doesnt even play a sound
var my_media = null;
var my_media2 = null;
// Wait for PhoneGap to load
document.addEventListener("deviceready", goLoop, false);
function goLoop(status) {
if (status === Media.MEDIA_STOPPED) {
my_media2.play();
}
}
var my_media = new Media("/android_asset/www/sounds/indexstart.mp3", null, null, goLoop);
var my_media2 = new Media("/android_asset/www/sounds/indexloop.mp3", null, null, goLoop);
my_media.play();
var my_media = null;
var my_media2 = null;
// Wait for PhoneGap to load
document.addEventListener("deviceready", goLoop, false);
function goLoop(status) {
if (status === Media.MEDIA_STOPPED) {
my_media2.play();
}
}
var my_media = new Media("/android_asset/www/sounds/indexstart.mp3", null, null, goLoop);
var my_media2 = new Media("/android_asset/www/sounds/indexloop.mp3", null, null, goLoop);
my_media.play();
- 28 Posts
- 0 Reply Likes
I change that "false" parameters to "null" as you can see and it doesnt work either.
Petra V., Champion
- 7794 Posts
- 1391 Reply Likes
Sorry. I thought the snippet would be sufficient for you to understand the intention of the loop and its callback.
Here is the full example:
Here is the full example:
document.addEventListener("deviceready", onDeviceReady, false);
var my_media;
var my_media2;
function goLoop(status) {
if (status === Media.MEDIA_STOPPED) {
my_media2.play();
}
}
function onDeviceReady() {
firstAudioUrl= "/android_asset/www/sounds/indexstart.mp3";
secondAudioUrl= "/android_asset/www/sounds/indexstart.mp3";
my_media = new Media(firstAudioUrl, null, null, goLoop);
my_media2 = new Media(secondAudioUrl, null, null, goLoop);
my_media.play();
}
- 28 Posts
- 0 Reply Likes
ok, that works perfectly, thank you so much, and sorry but I am so rookie with this.
Right now, the only problem is than in the next page, game.html, it doesnt fire the main function of my js file, < body onLoad="main_loop"> doesnt work and document.addEventListener("deviceready", main_loop, false); doesnt work either.
Too weird :S
Right now, the only problem is than in the next page, game.html, it doesnt fire the main function of my js file, < body onLoad="main_loop"> doesnt work and document.addEventListener("deviceready", main_loop, false); doesnt work either.
Too weird :S
Related Categories
-
PhoneGap Build
- 15111 Conversations
- 275 Followers

