我有FF,Chrome,IE,Opera和Safari的5个插件/扩展.
如何识别用户浏览器并重定向(单击安装按钮后)以下载相应的插件?
我正在尝试让视频像YouTube一样播放和暂停(使用播放和暂停按钮,然后单击视频本身.)
<video width="600" height="409" id="videoPlayer" controls="controls">
<!-- MP4 Video -->
<source src="video.mp4" type="video/mp4">
</video>
<script>
var videoPlayer = document.getElementById('videoPlayer');
// Auto play, half volume.
videoPlayer.play()
videoPlayer.volume = 0.5;
// Play / pause.
videoPlayer.addEventListener('click', function () {
if (videoPlayer.paused == false) {
videoPlayer.pause();
videoPlayer.firstChild.nodeValue = 'Play';
} else {
videoPlayer.play();
videoPlayer.firstChild.nodeValue = 'Pause';
}
});
</script>
Run Code Online (Sandbox Code Playgroud)
你有什么想法会破坏播放和暂停控制按钮吗?
,嗨,
<!DOCTYPE html>
<html>
<body>
<div style="text-align:center">
<button onclick="playPause()">Play/Pause</button>
<button onclick="makeBig()">Big</button>
<button onclick="makeSmall()">Small</button>
<button onclick="makeNormal()">Normal</button>
<br>
<video id="video1" width="420">
<source src="mov_bbb.mp4" type="video/mp4">
<source src="mov_bbb.ogg" type="video/ogg">
Your browser does not support HTML5 video.
</video>
</div>
<script>
var myVideo=document.getElementById("video1");
function playPause()
{
if (myVideo.paused)
myVideo.play();
else
myVideo.pause();
}
function makeBig()
{
myVideo.width=560;
}
function makeSmall()
{
myVideo.width=320;
}
function makeNormal()
{
myVideo.width=420;
}
</script>
<p>Video courtesy of <a href="http://www.bigbuckbunny.org/" target="_blank">Big Buck Bunny</a>.</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我尝试使用来自以下网站的html5视频
http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_video_js_prop
如何在视频屏幕上播放/暂停视频?
任何帮助将不胜感激.
谢谢.