Created
April 2, 2012 02:13
-
-
Save snorpey/2280020 to your computer and use it in GitHub Desktop.
Queue audio files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jq = document.createElement('script'); | |
jq.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; | |
jq.onload = snorpey_getPaths; | |
document.body.appendChild(jq); | |
var snorpey_paths = []; | |
var snorpey_index = 0; | |
var snorpey_player; | |
function snorpey_getPaths() | |
{ | |
jQuery( '[data="player_mp3_maxi.swf"] param[name="FlashVars"]' ) | |
.each( | |
function() | |
{ | |
var path = jQuery( this ) | |
.attr( 'value' ) | |
.replace( 'mp3=', '' ) | |
.replace( '&width=25&height=20&buttonwidth=25&showslider=0&showloading=never', '' ) | |
snorpey_paths.push( path ); | |
} | |
); | |
snorpey_playNext(); | |
} | |
function snorpey_playNext() | |
{ | |
if ( ! jQuery( '#snorpey-audio' ).length ) | |
{ | |
jQuery( 'body' ).append( '<audio id="snorpey-audio" preload="auto" controls="true"></audio>' ); | |
jQuery( '#snorpey-audio' ).css( { position: 'fixed', top: 0, left: 0 } ); | |
jQuery( '#snorpey-audio' ).bind( 'ended', snorpey_playNext ); | |
} | |
if ( snorpey_index < snorpey_paths.length -1 ) | |
{ | |
jQuery( '#snorpey-audio' )[0].src = snorpey_paths[ snorpey_index ]; | |
jQuery( '#snorpey-audio' )[0].play(); | |
snorpey_index++; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
more information here: http://dl.dropbox.com/u/1098704/audio-player/index.html