wechat video not full screen 解决方案

<!DOCTYPE HTML>
<html>
	<head>
		<title>test</title>
		<meta name="viewport"
			content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
		<script type="text/javascript">
			window.addEventListener("load", function(){
				var fps = 1000/50;
				var videoObj = document.getElementById("myVideo");  
				var canvasObj = document.getElementById("myCanvas");  
				setInterval(function(){  
				canvasObj.getContext("2d").drawImage(videoObj, 0, 0,canvasObj.width, canvasObj.height); 
				}, fps);
			
				canvasObj.width  = window.innerWidth;
				canvasObj.height  = window.innerWidth*(视频高/视频宽);
			
				canvasObj.addEventListener('click', function(e){   
	            if (myVideo.paused)
	            	myVideo.play();
	        	else
	            	myVideo.pause()  
	             
	        	}, false);
			
			}, true);
			
		</script>
	</head>

	<body style="margin: 0px; padding: 0px;">
	
	
	
		<div style="width:100%;display:none;">
			<video id="myVideo" width="100%" src="source" controls="controls" loop="loop" preload="preload">
			Your browser does not support the video tag.
			</video>
		</div>
		<br/>
		
		<canvas id="myCanvas" ></canvas>
	</body>
</html>


已经实现canvas宽度自适应


注意:js中的fps这个数值各位自己找中间点。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值