[html5]H5播放器:竖屏播放\横屏播放\跟随旋转例子
[html5]H5播放器:竖屏播放\横屏播放\跟随旋转例子
[html5]H5播放器:竖屏播放\横屏播放\跟随旋转例子
- <!DOCTYPE html><html lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="author" content="monicaqin">
- <meta name="format-detection" content="telephone=no" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"/>
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <title>测试视频test</title>
- </head>
- <body>
- <div>
- <video id="test_video" src="advideo.mp4" controls="controls" x5-video-player-type="h5" x5-video-player-fullscreen="true"
- autoplay></video>
- </div>
- <div style="position:relative;top:-100px;">
- <input type="button" value="竖屏播放" onclick="portrait();"></input>
- <input type="button" value="横屏播放" onclick="landscape();"></input>
- <input type="button" value="跟随旋转" onclick="autoOrientation();"></input>
- </div>
- <script type = "text/javascript">
- test_video.style.width = screen.width + "px";
- test_video.style.height = "100%";
- </script>
- <div>
- <canvas id="test"/>
- </div>
- <script type = "text/javascript">
- window.onresize=function(){
- //alert("haha");
- test_video.style.width = screen.width;
- test_video.style.height = screen.height;
- }
- test_video.addEventListener("timeupdate", function(){
- if(test_video.currentTime > 2)
- {
- test_video.style.display = 'block';
- }
- });
- function testPlay(){
- test_video.play();
- }
- window.onresize=function(){
- //alert("haha");
- test_video.style.width = screen.width;
- test_video.style.height = screen.height;
- }
- function portrait(){
- test_video.setAttribute("x5-video-orientation", "portrait");
- }
- function landscape(){
- test_video.setAttribute("x5-video-orientation", "landscape");
- }
- function autoOrientation(){
- test_video.setAttribute("x5-video-orientation", "landscape|portrait")
- }
- </script>
- </body>
- </html>
热门文章推荐
- 10款html5网页播放器推荐(总有一款适合你)
- [html5]html5+css3实现图片斜角切成直角梯形显示的源代码
- [HTML5]HTML5视频video时间事件代码
- [微信]iOS苹果和微信中音频和视频实现自动播放的方法
- [html5]html5视频全屏实现的源代码
- [Html5]mobile-agent移动Agent,就是具有移动性的智能Agent
- [html5]视频播放器js控制vedio视频和分段播放
- [html5]H5播放器:竖屏播放\横屏播放\跟随旋转例子
请稍候...