-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvideo-react.js
More file actions
67 lines (64 loc) · 1.43 KB
/
video-react.js
File metadata and controls
67 lines (64 loc) · 1.43 KB
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
var Zplayer = React.createClass({
render: function(){
return (
<div>
<div className="fl">
<Myvideo />
<List />
</div>
<Controls />
</div>
)
}
})
var Myvideo = React.createClass({
play: function(player) {
//player.play();
video.play();
},
pause: function(player) {
//player.pause();
video.pause();
},
getInitialState: function() {
return {played: 0};
},
ctrl:function(){
//var player = document.getElementById('video');
if(this.state.played){
this.pause();
this.state.played = 0;
}else{
this.play();
this.state.played = 1;
}
},
render: function() {
return (
<div className="video"><video id="video" src="https://gss3.baidu.com/6LZ0ej3k1Qd3ote6lo7D0j9wehsv/tieba-smallvideo/84_9ef80b410df47c8ba6478cbd4de3d610.mp4" controls onClick={this.ctrl}></video></div>
);
}
});
var List = React.createClass({
render:function(){
return (
<div className="list">list</div>
);
}
});
var Controls = React.createClass({
render:function(){
return (
<div className="controls fl">
<div className="play">play</div>
<div className="timeline"></div>
<div className="sound">sound</div>
<div className="fullscreen">fullscreen</div>
</div>
);
}
});
ReactDOM.render(
<Zplayer />,
document.getElementById('player')
);