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?
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();
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();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.