[英]HTML5 and jQuery stop?
Got jQuery running a HTML5 audio element. 让jQuery运行HTML5音频元素。 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. 但是,使用诸如SHOUTcast之类的实时流,它只会暂停音频,而不会完全停止音频。 How would I go about doing this? 我将如何去做呢?
http://www.julake.co.uk/media/loader.php?page=contact http://www.julake.co.uk/media/loader.php?page=contact
Try this. 尝试这个。
audioPlayer.pause();
audioPlayer.src = '';
audioPlayer.load();
Then when you click play, set src
to the source. 然后,当您单击播放时,将src
设置为源。
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: 单击播放后,将src
设置为音频源:
audioPlayer.src = /* the proper source */;
audioPlayer.load();
audioPlayer.play();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.