From 7ccf6c0a92b23fe6ff7198eb4754edd68c36d447 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Tue, 19 Dec 2017 14:41:00 -0500 Subject: [PATCH] feature complete --- src/renderer/component/video/index.js | 1 + .../component/video/internal/player.jsx | 3 +-- src/renderer/component/video/view.jsx | 11 ++--------- src/renderer/constants/action_types.js | 2 -- src/renderer/redux/actions/video.js | 18 ++---------------- src/renderer/redux/reducers/video.js | 6 +----- src/renderer/redux/selectors/video.js | 8 ++++---- 7 files changed, 11 insertions(+), 38 deletions(-) diff --git a/src/renderer/component/video/index.js b/src/renderer/component/video/index.js index 04c223f61..f0a1a43f1 100644 --- a/src/renderer/component/video/index.js +++ b/src/renderer/component/video/index.js @@ -3,6 +3,7 @@ import { connect } from "react-redux"; import { doChangeVolume } from "redux/actions/app"; import { selectVolume } from "redux/selectors/app"; import { doPlayUri, doSetPlayingUri } from "redux/actions/content"; +import { setVideoPause } from "redux/actions/video"; import { makeSelectMetadataForUri, makeSelectContentTypeForUri, diff --git a/src/renderer/component/video/internal/player.jsx b/src/renderer/component/video/internal/player.jsx index 42b9b4bf2..e993dac36 100644 --- a/src/renderer/component/video/internal/player.jsx +++ b/src/renderer/component/video/internal/player.jsx @@ -4,7 +4,6 @@ import { Thumbnail } from "component/common"; import player from "render-media"; import fs from "fs"; import LoadingScreen from "./loading-screen"; -import { setVideoPause } from "../../../redux/actions/video"; class VideoPlayer extends React.PureComponent { static MP3_CONTENT_TYPES = ["audio/mpeg3", "audio/mpeg"]; @@ -24,7 +23,7 @@ class VideoPlayer extends React.PureComponent { componentWillReceiveProps(nextProps) { if (nextProps.videoPause) { this.refs.media.children[0].pause(); - this.props.confirmVideoPause(false); + this.props.setVideoPause(false); } } diff --git a/src/renderer/component/video/view.jsx b/src/renderer/component/video/view.jsx index 355f13dc8..c5c4d8d88 100644 --- a/src/renderer/component/video/view.jsx +++ b/src/renderer/component/video/view.jsx @@ -57,16 +57,9 @@ class Video extends React.PureComponent { volume, uri, videoPause, - // setVideoPause, + setVideoPause, } = this.props; - // console.log("setVideoPause", setVideoPause); - - const confirmVideoPause = val => { - console.log("this.props.setVideoPause:", this.props.setVideoPause); - this.props.setVideoPause(val); - }; - const isPlaying = playingUri === uri; const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0; const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw; @@ -120,7 +113,7 @@ class Video extends React.PureComponent { changeVolume={changeVolume} volume={volume} videoPause={videoPause} - confirmVideoPause={confirmVideoPause} + setVideoPause={setVideoPause} /> ))} {!isPlaying && ( diff --git a/src/renderer/constants/action_types.js b/src/renderer/constants/action_types.js index d83cf10ed..bbf6c520b 100644 --- a/src/renderer/constants/action_types.js +++ b/src/renderer/constants/action_types.js @@ -166,6 +166,4 @@ export const CHANNEL_UNSUBSCRIBE = "CHANNEL_UNSUBSCRIBE"; export const HAS_FETCHED_SUBSCRIPTIONS = "HAS_FETCHED_SUBSCRIPTIONS"; // Video controls -export const VIDEO_PAUSE_STARTED = "VIDEO_PAUSE_STARTED"; -export const VIDEO_PAUSE_COMPLETED = "VIDEO_PAUSE_COMPLETED"; export const SET_VIDEO_PAUSE = "SET_VIDEO_PAUSE"; diff --git a/src/renderer/redux/actions/video.js b/src/renderer/redux/actions/video.js index c4c8ec40a..bf88d2d26 100644 --- a/src/renderer/redux/actions/video.js +++ b/src/renderer/redux/actions/video.js @@ -3,22 +3,8 @@ import * as actions from "constants/action_types"; import type { Action, Dispatch } from "redux/reducers/video"; import lbry from "lbry"; -// export const doVideoPause = ( -// dispatch: Dispatch -// ) => { -// console.log("diVideoPause helllllo"); -// console.log(dispatch); -// return dispatch({type: actions.VIDEO_PAUSE_STARTED}); -// } - -// export const confirmVideoPause = ( -// dispatch: Dispatch -// ) => dispatch({type: actions.VIDEO_PAUSE_COMPLETED}); - -export const setVideoPause = (data: boolean) => (dispatch: Dispatch) => { - console.log("VIDEO ACTION data:", data); - return dispatch({ +export const setVideoPause = (data: boolean) => (dispatch: Dispatch) => + dispatch({ type: actions.SET_VIDEO_PAUSE, data, }); -}; diff --git a/src/renderer/redux/reducers/video.js b/src/renderer/redux/reducers/video.js index 6aafaa9ec..0f18844dd 100644 --- a/src/renderer/redux/reducers/video.js +++ b/src/renderer/redux/reducers/video.js @@ -19,11 +19,7 @@ export default handleActions( [actions.SET_VIDEO_PAUSE]: ( state: VideoState, action: setVideoPause - ): VideoState => { - console.log("VIDEO REDUCER STATE", state); - console.log("VIDEO REDUCER ACTION", action); - return { ...state, videoPause: action.data }; - }, + ): VideoState => ({ ...state, videoPause: action.data }), }, defaultState ); diff --git a/src/renderer/redux/selectors/video.js b/src/renderer/redux/selectors/video.js index 65bf1290f..a41c95803 100644 --- a/src/renderer/redux/selectors/video.js +++ b/src/renderer/redux/selectors/video.js @@ -3,7 +3,7 @@ import { createSelector } from "reselect"; const _selectState = state => state.video || {}; -export const selectVideoPause = createSelector(_selectState, state => { - console.log("VIDEO PAUSE SELECTOR", state); - return state.videoPause; -}); +export const selectVideoPause = createSelector( + _selectState, + state => state.videoPause +);