blob: 179c50d9f82ba5f2e39633e5babe931ef7de4530 (
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
|
import React, { Component } from 'react'
import VimeoPlayer from '@u-wave/react-vimeo'
import { CURTAIN_COLOR_LOOKUP } from 'app/constants'
import { MediaCitation } from '../components.media'
export const MediaVideo = ({ paragraph, media, currentParagraph, currentAnnotation, onAnnotationClick, onDoubleClick }) => {
if (!media.lookup) return <div />
// const { color } = element
const className = currentParagraph ? 'media video current' : 'media video'
const annotation = paragraph.annotations[0]
const item = media.lookup[annotation.settings.media_id]
const color = CURTAIN_COLOR_LOOKUP[annotation.settings.color] || CURTAIN_COLOR_LOOKUP.white
const style = {
backgroundColor: color.backgroundColor,
color: color.textColor,
}
if (!item) return <div>Media not found: {annotation.settings.media_id}</div>
// console.log(annotation.settings)
return (
<div
className={className}
onDoubleClick={e => onDoubleClick(e, paragraph)}
>
<div className='videoPlayer' style={style}>
<VimeoPlayer
video={item.url}
autoplay={annotation.settings.autoplay}
muted
controls={false}
byline={false}
width={window.innerWidth}
height={window.innerHeight * 0.8}
/>
</div>
<MediaCitation media={item} />
</div>
)
}
|