import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import Icon from 'stremio-icons/dom';
import { Popup } from 'stremio-common';
import TimeSlider from './TimeSlider';
import VolumeSlider from './VolumeSlider';
import styles from './styles';
class ControlBar extends Component {
constructor(props) {
super(props);
this.state = {
sharePopupOpen: false
};
}
shouldComponentUpdate(nextProps, nextState) {
return nextProps.className !== this.props.className ||
nextProps.paused !== this.props.paused ||
nextProps.time !== this.props.time ||
nextProps.duration !== this.props.duration ||
nextProps.volume !== this.props.volume ||
nextState.sharePopupOpen !== this.state.sharePopupOpen;
}
setTime = (time) => {
this.props.setTime(time);
}
setVolume = (volume) => {
this.props.setVolume(volume);
}
toogleVolumeMute = () => {
this.props.volume === 0 ? this.props.unmute() : this.props.mute();
}
onPlayPauseButtonClick = () => {
this.props.paused ? this.props.play() : this.props.pause();
}
onSharePopupOpen = () => {
this.setState({ sharePopupOpen: true });
}
onSharePopupClose = () => {
this.setState({ sharePopupOpen: false });
}
renderShareButton() {
return (