1 !DOCTYPE html 2 html 3 head 4 meta charset= utf-8 5 title 彈幕 /title 6 /head 7 script type= text/javascript src= http://cdn.hcharts.cn/jquery/jquery-1.8.3.min.js /script 8 style type= text/css 9 #Barrage{ 10 width:800px; 11 height:400px; 12 margin:0 auto; 13 border:1px solid #000; 14 } 15 #Video1{ 16 box-shadow: 10px 5px 5px black; 17 display: block; 18 } 19 /style 20 script type= text/javascript 22 function vidplay() { 23 var video = document.getElementById( Video1 24 var button = document.getElementById( play 25 if (video.paused) { 26 video.play(); 27 button.innerHTML = || 28 } else { 29 video.pause(); 30 button.innerHTML = 31 } 32 } 34 function restart() { 35 var video = document.getElementById( Video1 36 video.currentTime = 0; 37 } 39 function skip(value) { 40 var video = document.getElementById( Video1 41 video.currentTime += value; 42 } 44 function makeBig(){ 45 var video = document.getElementById( Video1 46 video.width = 600; 47 } 48 /script 50 body 51 p id= Barrage 52 video id= Video1 autoplay loop 53 source src= http://www.runoob.com/try/demo_source/mov_bbb.mp4 type= video/mp4 54 source src= http://www.runoob.com/try/demo_source/mov_bbb.ogg type= video/ogg 55 /video 56 p id= buttonbar >效果展示:
可以把代碼copy出來,點擊重播、暫停、快進、放大等功能試試效果,后續結合webSocket 的即時彈幕也會有所展示!
下班嘍!!!!拜拜~~
【相關推薦】
1. PHP HTML5 websocket怎么初始化,老是失敗
2. 帶你認識HTML5中的WebSocket
3. 解析HTML5中的標簽嵌套規則
以上就是詳解HTML5中的WebSocket及實例代碼的詳細內容,其它編程語言
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答