效果图
直接上源码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> body { background-color: #000; margin-left: 0px; margin-top: 0px; } </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>视频播放器</title> <meta name="referrer" content="never"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style>*{margin:0;padding:0}</style> <link href="https://unpkg.com/video.js/dist/video-js.css" rel="stylesheet"> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script> <script src="https://unpkg.com/video.js/dist/video.js"></script> </head> <body> <script> var isWap = navigator.userAgent.match(/iPad|iPhone|iPod|Android/i) != null; var vid= ("http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/468fb71b4564972819281746829/v.f30.mp4"); if(isWap){ document.writeln('<video src="'+vid+'" controls="controls" preload="preload" poster="https://wx1.sinaimg.cn/mw690/005yF2tCgy1fn67stcy3wg30jq0dwq2z.gif" width="100%" height="100%" autoplay="autoplay"></video>'); }else { document.writeln('<video id="my_video_1" class="video-js vjs-big-play-centered vjs-fill" controls preload="auto" data-setup=\'{}\' autoplay>\n' + ' <source src="' + ("http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/468fb71b4564972819281746829/v.f30.mp4") + '" type="video/mp4"></source>\n' + '</video>'); } </script> </body> </html> <script type="text/javascript"> window.onload=function(){ var videoPanelMenu = $(".vjs-fullscreen-control"); videoPanelMenu.before('<div class="vjs-subs-caps-button vjs-menu-button vjs-menu-button-popup vjs-control vjs-button" aria-live="polite" aria-expanded="false" aria-haspopup="true">' + '<div class="vjs-menu" role="presentation">' + '<ul class="vjs-menu-content" role="menu">' + '<li class="vjs-menu-item" tabindex="-1" role="menuitemcheckbox" onclick="changeVideo(1)">普通</li>' + '<li class="vjs-menu-item" tabindex="-1" role="menuitemcheckbox" onclick="changeVideo(2)">标清 </li>' + '<li class="vjs-menu-item" tabindex="-1" role="menuitemcheckbox" onclick="changeVideo(3)">高清 </li>' + '</ul></div>' +' <button class="vjs-subs-caps-button vjs-control vjs-button" type="button" aria-live="polite" title="清晰度切换" aria-disabled="false">' +' <span aria-hidden="true" class="vjs-icon-placeholder"></span><span class="vjs-control-text">清晰度切换</span>' +' </button>' +'</div>' ); var obj={tag:false,ctime:0}; window.obj=obj; var myPlayer=videojs.getPlayers()['my_video_1']; myPlayer.on("timeupdate", function(){ if(window.obj.tag){ videojs("my_video_1").currentTime(window.obj.ctime) videojs("my_video_1").play(); window.obj.tag=false; } //视频打点 var ctime_=videojs("my_video_1").currentTime().currentTime(); if(ctime_==60){ videojs("my_video_1").currentTime(ctime_+1); //do something } }); } function changeVideo(type){ var ctime=videojs("my_video_1").currentTime(); if(type==1){ videojs("my_video_1").src([{type: "video/mp4", src:("http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/468fb71b4564972819281746829/v.f30.mp4") }]); videojs("my_video_1").play(); } if(type==2){ videojs("my_video_1").src([{type: "video/mp4", src: ("http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/468fb71b4564972819281746829/v.f30.mp4") }]); videojs("my_video_1").play(); } if(type==3){ videojs("my_video_1").src([{type: "video/mp4", src: ("http://1252463788.vod2.myqcloud.com/95576ef5vodtransgzp1252463788/468fb71b4564972819281746829/v.f30.mp4") }]); videojs("my_video_1").play(); } window.obj.ctime=ctime; window.obj.tag=true; } </script> |
2018年6月27日 下午9:46 沙发
厉害了我的小灰灰
2019年1月17日 上午9:14 1层
@QQ游客 怎么用谷歌浏览器调试移动端的不长你这样,竖屏模式并没有显示选择清晰度的,只有web端的能显示