diff --git a/web/ASC.Web.Common/src/components/MediaViewer/MediaViewer.js b/web/ASC.Web.Common/src/components/MediaViewer/MediaViewer.js index 2d23902345..e1bab69365 100644 --- a/web/ASC.Web.Common/src/components/MediaViewer/MediaViewer.js +++ b/web/ASC.Web.Common/src/components/MediaViewer/MediaViewer.js @@ -89,13 +89,13 @@ class MediaViewer extends React.Component { componentDidUpdate(prevProps) { if (this.props.visible !== prevProps.visible) { - this.setState( - { - visible: this.props.visible - } - ); + this.setState( + { + visible: this.props.visible + } + ); } - } + } mapSupplied = { ".aac": { supply: "m4a", type: audio }, ".flac": { supply: "mp3", type: audio }, @@ -186,7 +186,7 @@ class MediaViewer extends React.Component { isImage = false; isVideo = this.mapSupplied[ext] ? this.mapSupplied[ext].type == video : false; } - + return ( @@ -196,7 +196,7 @@ class MediaViewer extends React.Component {
{fileTitle}
- {this.props.onClose()})} className="mediaPlayerClose"> + { this.props.onClose() })} className="mediaPlayerClose">
@@ -212,16 +212,16 @@ class MediaViewer extends React.Component { ]} /> : - + ) }
- {this.props.onDelete(this.state.playlistPos)})}> + { this.props.onDelete(this.state.playlistPos) })}> - {this.props.onDownload(this.state.playlistPos)})}> + { this.props.onDownload(this.state.playlistPos) })}> diff --git a/web/ASC.Web.Common/src/components/MediaViewer/sub-components/video-viewer.js b/web/ASC.Web.Common/src/components/MediaViewer/sub-components/video-viewer.js index 2ed598e33b..d540569b1b 100644 --- a/web/ASC.Web.Common/src/components/MediaViewer/sub-components/video-viewer.js +++ b/web/ASC.Web.Common/src/components/MediaViewer/sub-components/video-viewer.js @@ -140,7 +140,7 @@ const StyledVideoViewer = styled.div` `; class ValumeBtn extends Component { - + constructor(props) { super(props); } @@ -181,7 +181,7 @@ class VideoViewer extends Component { state = { url: this.props.url, pip: false, - playing: true, + playing: this.props.playing, controls: false, light: false, volume: 0.3, @@ -201,14 +201,25 @@ class VideoViewer extends Component { pip: false }) } - componentDidUpdate(prevProps) { - if (this.props.url !== prevProps.url) { + componentDidUpdate(prevProps, prevState) { + let newUrl = prevState.url; + let newPlaying = prevState.playing; + if (this.props.url !== prevProps.url || this.props.playing !== prevProps.playing) { + if (this.props.url !== prevProps.url) { + newUrl = this.props.url + } + if (this.props.playing !== prevProps.playing) { + newPlaying = this.props.playing + } this.setState( { - url: this.props.url + url: newUrl, + playing: newPlaying } ); } + + } handlePlayPause = () => { this.setState({ playing: !this.state.playing }) @@ -443,7 +454,8 @@ class VideoViewer extends Component { VideoViewer.propTypes = { isVideo: PropTypes.bool, - url: PropTypes.string + url: PropTypes.string, + playing: PropTypes.bool } export default VideoViewer; \ No newline at end of file