Reputation: 366
Got jQuery running a HTML5 audio element. When I use:
audioPlayer.pause();
audioPlayer.currentTime = 0;
on a local file, it will stop the file and when you hit play again, it will restart it. However, with a Live stream, such as SHOUTcast, it will simply pause the audio, not stop it completely. How would I go about doing this?
http://www.julake.co.uk/media/loader.php?page=contact
Upvotes: 0
Views: 600
Reputation: 2226
I think this should work:
audioPlayer.pause();
audioPlayer.src = '';
audioPlayer.load();
After you click play set the src
to the source of the audio:
audioPlayer.src = /* the proper source */;
audioPlayer.load();
audioPlayer.play();
Upvotes: 1
Reputation: 190945
Try this.
audioPlayer.pause();
audioPlayer.src = '';
audioPlayer.load();
Then when you click play, set src
to the source.
audioPlayer.src = /* actual source */;
audioPlayer.load();
audioPlayer.play();
Upvotes: 3