1

I've searched all over google, here, HTML5Rocks, etc... Everywhere I look I get "half" an answer or told to use some other lengthy lib that doesn't even work with what i'm trying to do.

I've made a full jQueryUI plug for making a simple audio player, the last step is filling the playlist from an option like:

playlist: [
    '<?= base_url("audio/samp/Kalimba.mp3"); ?>',
    '<?= base_url("audio/samp/Maid_with_the_Flaxen_Hair.mp3"); ?>',
    '<?= base_url("audio/samp/Sleep_Away.mp3"); ?>'
]

Where in the plugin I have something like:

for (x in ele.playlist) { 
    //  get meta data for song title, artist, album, & length 
    //  so I can add it to button inside li
    //  example: in a callback where param for AudioContext is audon
    //  audcon.button() // call to saved jQuery object of list item button
    //      .prepend($("<p /">).text(dataReturned.songTitle))  //  add element to button with text of song title
}

Of course, i've found part of the issue is, this for loop runs faster than the time it takes to read a file, which I should think is no problem as long as I can use a call back. For example, using HTML5, I add the button html as a property to my AudioContext, so that when it finishes reading, I can easily access the li button that duration belongs on.

Can anyone give a simple, clear cut example of how to achieve what I want, cause none of what i've tried is getting me anywhere.

I have found pretty ez how to use HTML5 to get the duration of each song and use a callback to put the duration in each button after its loaded, but the duration doesn't really tell a user much about the song loaded other than how long it is, lol.

4

0 回答 0