admin管理员组文章数量:1302939
Check out this demo page: .htm
Click the Play Sound
button twice, in quick succession. Because it hasn't yet finished playing the first time around by the time you hit the button again, nothing happens, and the click appears to be ignored. How could one re-code it so that it would stop the current playback, reset the playback position to the very beginning of the sound, and restart it upon each click of the Play Sound
button?
Check out this demo page: http://www.phon.ucl.ac.uk/home/mark/audio/play10.htm
Click the Play Sound
button twice, in quick succession. Because it hasn't yet finished playing the first time around by the time you hit the button again, nothing happens, and the click appears to be ignored. How could one re-code it so that it would stop the current playback, reset the playback position to the very beginning of the sound, and restart it upon each click of the Play Sound
button?
- NOTE: I only ask because it seems the docs are broken: developer.mozilla/en-US/docs/XPCOM_Interface_Reference/… – wwaawaw Commented Sep 7, 2012 at 13:51
- 1 Implement your own play controls? "Seeking through media" developer.mozilla/en-US/docs/… – Alex K. Commented Sep 7, 2012 at 13:53
2 Answers
Reset to default 9You can change the it to something like this
var thissound=document.getElementById('audioElemID');
thissound.currentTime=0;
thissound.play();
thissound=document.getElementById(soundobj);
thissound.currentTime = 0;
本文标签: javascriptHow can one reset an HTMLAudioElement39s current playback position to 0Stack Overflow
版权声明:本文标题:javascript - How can one reset an HTMLAudioElement's current playback position to 0? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741701672a2393325.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论