所以我试图用自定义控件制作一个小视频,这是第一次,所以我不知道我在做什么。但是我已经让播放暂停按钮工作,但我怎么做一个停止按钮?
我代码:视频播放器:
<div class="videobox">
<video id="video" width="100%" height="100%">
<source src="testvideo.m4v" type="video/mp4">
<p>
Your browser doesn't support HTML5 video.
</p>
</video>
</div>
And my controls
<div class="buttonrow">
<input type="range" id="seek-bar" value="0">
<button type="button" id="play-pause" class="play">Play</button>
<button type="button" id="mute">Mute</button>
<input type="range" id="volume-bar" min="0" max="1" step="0.1" value="1">
<button type="button" id="full-screen">Full-Screen</button>
</div>
希望有人能帮助我:)
HTML
<input type="button" value="play" id="playBtn" />
<input type="button" value="pause" id="pauseBtn" />
<input type="button" value="stop" id="stopBtn" />
jQuery var source = "http://www.giorgiosardo.com/HTML5/audio/audio/sample.mp3"
var audio = document.createElement("audio"); audio.src = source;
$("#playBtn").click(function () {
audio.play();
});
$("#pauseBtn").click(function () {
audio.pause();
});
$("#stopBtn").click(function () {
audio.pause();
audio.currentTime = 0;
});
希望这对你有帮助。源