0

所以我试图用自定义控件制作一个小视频,这是第一次,所以我不知道我在做什么。但是我已经让播放暂停按钮工作了,但是我如何制作停止按钮?

我的代码:

视频播放器:

<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>

还有我的控制

<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>

希望可以有人帮帮我 :)

4

1 回答 1

1

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;
});

希望这可以帮助。资源

于 2013-05-06T11:56:31.660 回答