SoundManager / Jquery : Get SoundID sID

Posted by j-man86 on Stack Overflow See other posts from Stack Overflow or by j-man86
Published on 2010-04-20T14:51:55Z Indexed on 2010/04/20 15:03 UTC
Read the original article Hit count: 409

Filed under:
|
|
|

So I am trying to access a jquery soundmanager variable from one script (wpaudio.js – from the wp-audio plugin) inside of another (init.js – my own javascript). I am creating an alternate pause/play button higher up on the page and need to resume the current soundID, which is contained as part of a class name in the DOM.

Here is the code that creates that class name in wpaudio.js:

function wpaButtonCheck() {
if (!this.playState || this.paused)
    jQuery('#' + this.sID + '_play').attr('src', wpa_url + '/wpa_play.png');
else
    jQuery('#' + this.sID + '_play').attr('src', wpa_url + '/wpa_pause.png');

}

Here is the output:

<img src="http://24.232.185.173/wordpress/wp-content/plugins/wpaudio-mp3-player/wpa_play.png" class="wpa_play" id="wpa0_play">

where wpa0 would be the sID of the sound I need.

My current script in init.js is:

    $('.mixesSidebar #currentSong .playBtn').toggle(function() {
        soundManager.pauseAll();
        $(this).addClass('paused');
    }, function() {
        soundManager.resumeAll();
        $(this).removeClass('paused');
    });

I need to change resumeAll to "resume(this.sID)", but I need to somehow store the sID onclick and call it in the above function.

Alternately, I think a regular expression that could get the class name of the current play button and either parse the string up to the "_play" or use a trim function to get rid of "_play"– but I'm not sure how to do this.

Thanks for your help!

© Stack Overflow or respective owner

Related posts about soundmanager2

Related posts about jQuery