HTML音频元素如何重播? [英] HTML audio Element how to replay?

查看:99
本文介绍了HTML音频元素如何重播?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设置了一个包含节点的HTML5页面。
该页面将播放音乐(mp3格式),但它只是播放声音结束,而我使用javascript来控制音频元素,即使如此,我无法播放它,只能停止。



HTML5音频元素是否支持REPLAY? =http://www.position-absolute.com/articles/introduction-to-the-html5-audio-tag-javascript-manipulation/ =noreferrer> http://www.position-absolute.com / articles / introduction-to-the-html5-audio-tag-javascript-manipulation /

和重播事件



您可以设置选项,重放点击

  audioElement.currentTime = 0; 
audioElement.play();


I setup a HTML5 page, that include a node. The page will to playing a music(mp3 format),but it just play sound to end, and I use javascript to control audio element,even so,I can't replay it and only STOP.

Does HTML5 audio Element support REPLAY? And how to?

解决方案

please read this

http://www.position-absolute.com/articles/introduction-to-the-html5-audio-tag-javascript-manipulation/

and for replay event

you can set option, on replay click

audioElement.currentTime=0;
audioElement.play();

这篇关于HTML音频元素如何重播?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆