forked from Heisenbilin/VideoInCanvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.html
35 lines (30 loc) · 874 Bytes
/
base.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Base</title>
</head>
<body id="body">
<div id='videodiv'></div>
<div align="center">
<br/>
<canvas id="canvas" width="500" height="300" ></canvas>
</div>
</body>
<script>
//获取Canvas上下文对象
canvas = document.getElementById('canvas');
ctx = canvas.getContext('2d');
//video = document.getElementById("video");
video = document.createElement('video')
video.src = '80stest.mp4'
video.autoplay = true
render();
//视频渲染
function render(){
window.requestAnimationFrame(render)
ctx.clearRect(0, 0,canvas.width,canvas.height)
ctx.drawImage(video, 0, 0,canvas.width,canvas.height) //绘制视频
}
</script>
</html>