Skip to content

Instantly share code, notes, and snippets.

@dunkfordyce
Created November 10, 2011 14:47
Show Gist options
  • Save dunkfordyce/1355012 to your computer and use it in GitHub Desktop.
Save dunkfordyce/1355012 to your computer and use it in GitHub Desktop.
var $jplayer = $("#jquery_jplayer_1").jPlayer({
ready: function () {
//$(this).jPlayer("setMedia", {
// m4a: "http://www.jplayer.org/audio/m4a/Miaow-07-Bubble.m4a",
// oga: "http://www.jplayer.org/audio/ogg/Miaow-07-Bubble.ogg"
//});
},
swfPath: '${h.url_for("flash", url="Jplayer.swf")}',
solution: 'flash, html',
progress: function(e) {
console.log('progress', e.jPlayer.status);
},
errorAlerts: true,
error: function() {
console.log('error', arguments);
},
play: function() {
console.log('play', arguments);
console.log('is flash '+$('object').length);
},
pause: function() {
console.log('pause', arguments);
},
playing: function() {
console.log('playing', arguments);
},
timeupdate: function(e) {
console.log('timeupdate', e.jPlayer.status);
},
loadeddata: function(e) {
console.log('loaded');
}
});
/// later...
$tracklist.find('li').click(function(e) {
var $this = $(this),
track_index = $this.data('track-index'),
track = playlist.tracks[track_index];
($jplayer
.jPlayer('clearMedia')
.jPlayer('setMedia', {
mp3: track.urls.streaming+'/foo/'+k
})
.jPlayer('play')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment