-
<video>標記語法格式如下,
<video src="https://www.cnblogs.com/xiaojijin/p/url" controls="controls">替代文字</video>
| 屬性 | 值 | 說明 |
| src | url | 要播放視頻的URL |
| controls | controls | 添加播放、暫停和音量等控制元件 |
<video width="320px" height="240px" controls="controls"> <source src="movie.ogg" type="video/ogg"/> <source src="movie.mp4" type="video/mp4"/> <source src="movie.webm" type="video/webm"/>
您的瀏覽器不支持video標記
</video>
| play() | 播放媒體,paused屬性的值自動修改為false |
| pause() | 暫停媒體,paused屬性的值自動修改為true |
<video id="myVideo" width="320" height="240" controls> <source src="images/lego.ogv" type="video/ogv"> <source src="images/lego.mp4" type="video/mp4"> <source src="images/lego.webm" type="video/webm"> <object data=" images/lego.mp4" width="320" height=“240”> <embed width="320" height="240" src=" images/lego.swf"> </object> </video>
<br>
<button onClick="document.getElementById('myVideo').play()">播放</button> <button onClick="document.getElementById('myVideo').pause()">暫停</button> <button onClick="document.getElementById('myVideo').volume += 0.1">音量+</button> <button onClick="document.getElementById('myVideo').volume -= 0.1">音量-</button> <button onClick="document.getElementById('myVideo').muted = true"> 靜音</button> <button onClick="document.getElementById('myVideo').muted = false">取消靜音</button>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/167663.html
標籤:HTML5
上一篇:阿里云到底是做什么的呢?
下一篇:考研及保研經驗
