HTML5視頻video開發demo例子,html5demo

來源:互聯網
上載者:User

HTML5視頻video開發demo例子,html5demo
HTML5的video可以使用DOM的方式進行控制。video元素同樣擁有方法、屬性和事件。
比如它擁有的方法用於播放、暫停以及載入等。其中的屬性(比如時間長度、音量等)可以被讀取或設定。
其中的 DOM 事件能夠通知您,比方說,video元素開始播放、已暫停,已停止,等等。
廢話少說了,看下面的執行個體吧。

為視頻建立簡單的播放/暫停以及調整尺寸控制項:

<!DOCTYPE html> <html> <body> 歡迎大家關注我的部落格!如有疑問,請加QQ群:135430763共同學習!<div style="text-align:center;">  <button onclick="playPause()">播放/暫停</button>   <button onclick="makeBig()">大</button>  <button onclick="makeNormal()">中</button>  <button onclick="makeSmall()">小</button>  <br />   <video id="video1" width="420" style="margin-top:15px;">    <source src="http://www.w3school.com.cn/example/html5/mov_bbb.mp4" type="video/mp4" />    <source src="http://www.w3school.com.cn/example/html5/mov_bbb.ogg" type="video/ogg" />   你的瀏覽器不支援html5的video標籤  </video></div><script type="text/javascript">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> </body> </html>
看看運行:

歡迎大家關注我的部落格!如有疑問,請加QQ群:135430763共同學習!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.