summaryrefslogtreecommitdiff
path: root/animism-align/frontend/app/views/viewer/player/components.fullscreen/fullscreen.video.js
blob: 72121a7c477c30fe8bd182f454e63957ac1df868 (plain)
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
import React, { Component } from 'react'
import VimeoPlayer from 'app/utils/vendor/vimeo'

import { PlayerTime } from 'app/views/viewer/nav/viewer.icons'

export class FullscreenVideo extends Component {
  state = {
    duration: 1.0,
    percent: 0.0,
    seconds: 0.0,
  }
  constructor(props) {
    super(props)
    this.handlePlay = this.handlePlay.bind(this)
    this.handlePause = this.handlePause.bind(this)
    this.handleTimeUpdate = this.handleTimeUpdate.bind(this)
    this.handleEnd = this.handleEnd.bind(this)
  }
  handlePlay() {

  }
  handlePause() {

  }
  handleEnd() {

  }
  handleTimeUpdate(timing) {
    this.setState(timing)
  }
  render() {
    const { element, media, transitionDuration } = this.props
    const { duration, percent, seconds } = this.state
    const { color } = element
    const item = media.lookup[element.settings.media_id]
    const style = {
      backgroundColor: color.backgroundColor,
      color: color.textColor,
      transitionDuration,
    }
    console.log(item)
    return (
      <div
        className='fullscreen-element video'
        style={style}
      >
        <div className='vimeoPlayer'>
          <VimeoPlayer
            video={item.url}
            autoplay={true}
            muted={true}
            responsive={true}
            controls={false}
            byline={false}
            onPlay={this.handlePlay}
            onPause={this.handlePause}
            onTimeUpdate={this.handleTimeUpdate}
            onEnd={this.handleEnd}
          />
        </div>
        <div className='video-nav'>
          <div className='video-title'>
            {item.title}
          </div>
          <div className='video-playback'>
            <PlayerTime play_ts={seconds} duration={duration} />
          </div>
          <div className='video-next'>
          </div>
        </div>
      </div>
    )
  }
}