feature complete

This commit is contained in:
Travis Eden 2017-12-19 14:41:00 -05:00
parent 92de445e1e
commit 7ccf6c0a92
7 changed files with 11 additions and 38 deletions

View file

@ -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,

View file

@ -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);
}
}

View file

@ -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 && (

View file

@ -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";

View file

@ -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,
});
};

View file

@ -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
);

View file

@ -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
);