Kern Elliott
Kern Elliott

Reputation: 1659

Is it possible to move forward and back in audio duration Soundmanger2

Is it possible for a user hearing a sound playing from soundmanger2 to be able to move forward and load only that part of the song and whatever else comes after it? Think of it as a youtube video where u move the timeline forward so it buffers from that section onwards and you only start seeing video from that area only.

Upvotes: 0

Views: 344

Answers (1)

Niraj Chauhan
Niraj Chauhan

Reputation: 7880

Yes you can do that, use jquery UI slider or HTML5 range slider,

var audio;
soundManager.url = 'assets/swf/';

//on play
$(document).delegate('.play','click',function(e){

    audio = soundManager.createSound({
        id:'Mp3Songs',
        url:"index.php/.....mp3",

        whileplaying:function(){
            duration = this.duration;
            pos = this.position;

            $( "#seekBar" ).slider({
                min:0,
                max:duration,
                value:pos
            });

        }
    }); 
    audio.play();


});

$( "#seekBar" ).slider({
    orientation: "horizontal",
    range: "min",
    slide:function(event, ui){
        if(audio != undefined){
            audio.setPosition(ui.value);
        }
    }
});

Upvotes: 1

Related Questions