Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cfjedimaster committed Sep 9, 2016
1 parent f69e4e6 commit d4e044d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions loopingaudio/www/js/index.js
Expand Up @@ -3,16 +3,21 @@ var media;

function init() {
console.log('init');
media = new Media('arcade1.mp3', mediaSuccess, mediaError, mediaStatus);
media = new Media(getMediaURL('arcade1.mp3'), null, mediaError, mediaStatus);
media.play();
}

function getMediaURL(s) {
if(device.platform.toLowerCase() === "android") return "/android_asset/www/" + s;
return s;
}

function mediaError(e) {
console.log('mediaError', e);
}

function mediaStatus(status) {
if(status === 4) {
if(status === Media.MEDIA_STOPPED) {
media.seekTo(0);
media.play();
}
Expand Down

0 comments on commit d4e044d

Please sign in to comment.