Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions audiojs/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
// Use the path to the audio.js file to create relative paths to the swf and player graphics
// Remember that some systems (e.g. ruby on rails) append strings like '?1301478336' to asset paths
var path = (function() {
var re = new RegExp('audio(\.min)?\.js.*'),
var re = new RegExp('audio(\\.min)?\\.js.*'),
scripts = document.getElementsByTagName('script');
for (var i = 0, ii = scripts.length; i < ii; i++) {
var path = scripts[i].getAttribute('src');
if(re.test(path)) return path.replace(re, '');
}
return '';
})();

// ##The audiojs interface
Expand Down Expand Up @@ -244,7 +245,7 @@
this.injectFlash(audio, id);
this.attachFlashEvents(audio.wrapper, audio);
} else if (s.useFlash && !s.hasFlash) {
this.settings.flashError.apply(audio);
s.flashError.apply(audio);
}

// Attach event callbacks to the new audiojs instance.
Expand Down Expand Up @@ -372,7 +373,8 @@
audio['loadStarted'] = function() {
// Load the mp3 specified by the audio element into the swf.
audio.swfReady = true;
if (audio.settings.preload) audio.element.init(audio.mp3);
if (audio.settings.flashReady) audio.settings.flashReady.apply(audio);
if (audio.settings.preload && audio.mp3) audio.element.init(audio.mp3);
if (audio.settings.autoplay) audio.play.apply(audio);
}
},
Expand Down Expand Up @@ -630,6 +632,8 @@
this.duration = this.element.duration;
this.updatePlayhead();
this.settings.loadStarted.apply(this);

return true;
},
loadProgress: function() {
if (this.element.buffered != null && this.element.buffered.length) {
Expand Down Expand Up @@ -700,4 +704,4 @@
return matches.length > 1 ? matches : matches[0];
};
// The global variable names are passed in here and can be changed if they conflict with anything else.
})('audiojs', 'audiojsInstance', this);
})('audiojs', 'audiojsInstance', this);