diff --git a/src/renderer/component/fileDownloadLink/index.js b/src/renderer/component/fileDownloadLink/index.js index 9b1141802..e35dc5b94 100644 --- a/src/renderer/component/fileDownloadLink/index.js +++ b/src/renderer/component/fileDownloadLink/index.js @@ -25,7 +25,7 @@ const perform = dispatch => ({ openInShell: path => dispatch(doOpenFileInShell(path)), purchaseUri: uri => dispatch(doPurchaseUri(uri)), restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)), - videoPause: val => dispatch(setVideoPause(val)), + setVideoPause: val => dispatch(setVideoPause(val)), }); export default connect(select, perform)(FileDownloadLink); diff --git a/src/renderer/component/fileDownloadLink/view.jsx b/src/renderer/component/fileDownloadLink/view.jsx index 68499c273..0619460dd 100644 --- a/src/renderer/component/fileDownloadLink/view.jsx +++ b/src/renderer/component/fileDownloadLink/view.jsx @@ -42,13 +42,12 @@ class FileDownloadLink extends React.PureComponent { purchaseUri, costInfo, loading, - videoPause, + setVideoPause, } = this.props; const openFile = () => { openInShell(fileInfo.download_path); - console.log("FileDownloadLink view"); - videoPause(true); + setVideoPause(true); }; if (loading || downloading) { diff --git a/src/renderer/component/video/index.js b/src/renderer/component/video/index.js index 1b79f8275..04c223f61 100644 --- a/src/renderer/component/video/index.js +++ b/src/renderer/component/video/index.js @@ -35,6 +35,7 @@ const perform = dispatch => ({ play: uri => dispatch(doPlayUri(uri)), cancelPlay: () => dispatch(doSetPlayingUri(null)), changeVolume: volume => dispatch(doChangeVolume(volume)), + setVideoPause: val => dispatch(setVideoPause(val)), }); export default connect(select, perform)(Video); diff --git a/src/renderer/component/video/internal/player.jsx b/src/renderer/component/video/internal/player.jsx index a8b4572c1..42b9b4bf2 100644 --- a/src/renderer/component/video/internal/player.jsx +++ b/src/renderer/component/video/internal/player.jsx @@ -4,9 +4,7 @@ import { Thumbnail } from "component/common"; import player from "render-media"; import fs from "fs"; import LoadingScreen from "./loading-screen"; - -// import { connect } from "react-redux"; -// import { selectVideoPause } from "redux/selectors/video"; +import { setVideoPause } from "../../../redux/actions/video"; class VideoPlayer extends React.PureComponent { static MP3_CONTENT_TYPES = ["audio/mpeg3", "audio/mpeg"]; @@ -23,6 +21,13 @@ class VideoPlayer extends React.PureComponent { this.togglePlayListener = this.togglePlay.bind(this); } + componentWillReceiveProps(nextProps) { + if (nextProps.videoPause) { + this.refs.media.children[0].pause(); + this.props.confirmVideoPause(false); + } + } + componentDidMount() { const container = this.refs.media; const { @@ -160,15 +165,13 @@ class VideoPlayer extends React.PureComponent { } render() { - const { mediaType, poster, videoPause } = this.props; + const { mediaType, poster } = this.props; const { hasMetadata, unplayable } = this.state; const noMetadataMessage = "Waiting for metadata."; const unplayableMessage = "Sorry, looks like we can't play this file."; const needsMetadata = this.playableType(); - console.log("VideoPlayer render; videoPause:", videoPause); - return (
videoPause: {videoPause}
-