-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.html
149 lines (123 loc) · 3.7 KB
/
play.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" >
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
<title>HTML canvas video player</title>
<link rel="stylesheet" href="skyblue.css">
<link rel="stylesheet" href="demo/demo.css">
</head>
<body>
<div class="header">
<div class="content">
<a href="https://github.com/wangchengyu/video_in_canvas" class="padding-right-20">GitHub</a>
<a href="https://github.com/wangchengyu/video_in_canvas/archive/master.zip">Download</a>
</div>
</div>
<div class="video-wrapper js-video-wrapper">
<div class="video-responsive">
<video class="video js-video" muted>
<source src="./w.mp4" type=video/mp4>
<!-- <source src=http://techslides.com/demos/sample-videos/small.ogv type=video/ogg>
<source src=http://techslides.com/demos/sample-videos/small.mp4 type=video/mp4>
<source src=http://techslides.com/demos/sample-videos/small.3gp type=video/3gp> -->
</video>
<canvas class="canvas js-canvas"></canvas>
<div class="video-timeline js-timeline">
<div class="video-timeline-passed js-timeline-passed">
</div>
</div>
</div>
</div>
<div class="video-wrapper" id="video-container">
</div>
<div class="content">
<img id="img1" src="picture_frame_PNG195.png"style="width:25%; height:25%;display:none">
<div id=time></div>
<p class="margin-top-50">
Released under MIT licence.
</p>
</div>
<script src="js/jquery.min.js" ></script>
<script src="js/canvas-video-player.js"></script>
<script src="js/jmgraph.js"></script>
<script type="text/template" id="t-timeline">
<div id="timeline" class="video-timeline js-timeline">
<div class="video-timeline-passed js-timeline-passed">
</div>
</div>
</script>
<script>
var con = document.getElementById("video-container");
var g = jmGraph.create('video-container', {
width: 500,
height: 350
});
var style = {
stroke: '#F00',
lineType: 'dotted',
lineWidth: 2, //边线宽
//fill: 'yellow',
};
//style.opacity = 0.2;
//创建一个椭圆
var arc1 = g.createShape('arc', {
style: style,
center: {x:100, y:150},
width: 120,
height: 80
});
arc1.canMove(true);
g.children.add(arc1);
var rect = g.createShape('rect', {
style: style,
position: {x:100, y:20},
width: 120,
height: 80
});
g.children.add(rect);
window.rect = rect;
//创建一个resize
var resize = g.createShape('resize', {
style: style,
position: {x:100-60 , y:150-40},
width: 120,
height: 80
});
//大小改变事件
resize.on('resize', function() {
arc1.center.x = this.position.x + this.width / 2;
arc1.center.y = this.position.y + this.height / 2;
arc1.width = this.width;
arc1.height =this.height;
console.log(arguments);
});
//大小改变事件
resize.on('move', function() {
arc1.center.x += arguments[2]/2;
arc1.center.y += arguments[3]/2;
arc1.width += arguments[2];
arc1.height += arguments[3];
console.log(arguments);
});
resize.canMove(true);
g.children.add(resize);
// window.g = g;
// window.arc = arc1;
//requestAnimationFrame(update);
//$(con).append($("#t-timeline").html());
// var canvasVideo = new CanvasVideoPlayer({
// videoSelector: '.js-video',
// canvasSelector: '#video-container>canvas',
// //timelineSelector: '#timeline',
// audio: true
// });
function update() {
g.needUpdate && g.redraw();
requestAnimationFrame(update);
}
update();
</script>
</body>
</html>