import React from 'react'
import { connect } from 'react-redux'
import actions from 'app/actions'
import { clamp, timestamp } from 'app/utils'
// arrows
const arrows = {
down: (
),
up: (
),
right: (
),
left: (
),
}
export const Arrow = React.memo(({ type, onClick }) => (
{arrows[type]}
))
// volume toggle
export const VolumeControlIcon = ({ volume }) => (
{
e && e.stopPropagation()
actions.audio.setVolume(volume ? 0.0 : 1.0)
}}
>
)
export const VolumeControl = React.memo(VolumeControlIcon)
// play / pause button
export const PlayIcon = (
)
export const PauseIcon = (
)
export const PlayButton = ({ playing, onClick }) => {
return (
{
e && e.stopPropagation()
if (onClick) {
onClick(playing)
} else if (playing) {
actions.audio.pause()
} else {
actions.viewer.playFromClick()
}
}}
>
{playing ? PauseIcon : PlayIcon}
)
}
// subtitles
export const SubtitleButton = ({ cc }) => {
return (
actions.audio.setCC(!cc)}
>
{'CC'}
)
}
// player current time
export const PlayerTime = ({ play_ts, duration }) => (
{timestamp(clamp(play_ts, 0, duration))}
{' / '}
{timestamp(clamp(duration, 0, duration))}
)
// zoom button
export const ZoomPlus = (
)
export const SpeakerIcon = (
)
// mobile phone icon
export const MobilePhoneIcon = (
)