-
Notifications
You must be signed in to change notification settings - Fork 4
/
video.coffee
42 lines (34 loc) · 848 Bytes
/
video.coffee
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
@Video = createReactClass
getInitialState: ->
showVideoControls: false
pause: ->
@refs.video.pause()
@setState
showVideoControls: false
play: ->
@refs.video.play()
@setState
showVideoControls: true
currentTime: ->
@refs.video.currentTime
onVideoPlaying: (e) ->
@props.setPlaying true
onVideoPause: (e) ->
@props.setPlaying false
onVideoEnded: (e) ->
@setState
showVideoControls: false
@props.showControls()
render: ->
<video
src={Store.resizedURL 'stream', @props.itemId, @props.itemCode}
ref="video"
onClick={@props.toggleControls}
controls={@state.showVideoControls}
preload="none"
poster={@props.poster}
onPause={@onVideoPause}
onPlaying={@onVideoPlaying}
onEnded={@onVideoEnded}
playsInline
/>