feature complete
This commit is contained in:
parent
92de445e1e
commit
7ccf6c0a92
7 changed files with 11 additions and 38 deletions
|
@ -3,6 +3,7 @@ import { connect } from "react-redux";
|
||||||
import { doChangeVolume } from "redux/actions/app";
|
import { doChangeVolume } from "redux/actions/app";
|
||||||
import { selectVolume } from "redux/selectors/app";
|
import { selectVolume } from "redux/selectors/app";
|
||||||
import { doPlayUri, doSetPlayingUri } from "redux/actions/content";
|
import { doPlayUri, doSetPlayingUri } from "redux/actions/content";
|
||||||
|
import { setVideoPause } from "redux/actions/video";
|
||||||
import {
|
import {
|
||||||
makeSelectMetadataForUri,
|
makeSelectMetadataForUri,
|
||||||
makeSelectContentTypeForUri,
|
makeSelectContentTypeForUri,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { Thumbnail } from "component/common";
|
||||||
import player from "render-media";
|
import player from "render-media";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import LoadingScreen from "./loading-screen";
|
import LoadingScreen from "./loading-screen";
|
||||||
import { setVideoPause } from "../../../redux/actions/video";
|
|
||||||
|
|
||||||
class VideoPlayer extends React.PureComponent {
|
class VideoPlayer extends React.PureComponent {
|
||||||
static MP3_CONTENT_TYPES = ["audio/mpeg3", "audio/mpeg"];
|
static MP3_CONTENT_TYPES = ["audio/mpeg3", "audio/mpeg"];
|
||||||
|
@ -24,7 +23,7 @@ class VideoPlayer extends React.PureComponent {
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
if (nextProps.videoPause) {
|
if (nextProps.videoPause) {
|
||||||
this.refs.media.children[0].pause();
|
this.refs.media.children[0].pause();
|
||||||
this.props.confirmVideoPause(false);
|
this.props.setVideoPause(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,16 +57,9 @@ class Video extends React.PureComponent {
|
||||||
volume,
|
volume,
|
||||||
uri,
|
uri,
|
||||||
videoPause,
|
videoPause,
|
||||||
// setVideoPause,
|
setVideoPause,
|
||||||
} = this.props;
|
} = 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 isPlaying = playingUri === uri;
|
||||||
const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0;
|
const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0;
|
||||||
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
const obscureNsfw = this.props.obscureNsfw && metadata && metadata.nsfw;
|
||||||
|
@ -120,7 +113,7 @@ class Video extends React.PureComponent {
|
||||||
changeVolume={changeVolume}
|
changeVolume={changeVolume}
|
||||||
volume={volume}
|
volume={volume}
|
||||||
videoPause={videoPause}
|
videoPause={videoPause}
|
||||||
confirmVideoPause={confirmVideoPause}
|
setVideoPause={setVideoPause}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{!isPlaying && (
|
{!isPlaying && (
|
||||||
|
|
|
@ -166,6 +166,4 @@ export const CHANNEL_UNSUBSCRIBE = "CHANNEL_UNSUBSCRIBE";
|
||||||
export const HAS_FETCHED_SUBSCRIPTIONS = "HAS_FETCHED_SUBSCRIPTIONS";
|
export const HAS_FETCHED_SUBSCRIPTIONS = "HAS_FETCHED_SUBSCRIPTIONS";
|
||||||
|
|
||||||
// Video controls
|
// 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";
|
export const SET_VIDEO_PAUSE = "SET_VIDEO_PAUSE";
|
||||||
|
|
|
@ -3,22 +3,8 @@ import * as actions from "constants/action_types";
|
||||||
import type { Action, Dispatch } from "redux/reducers/video";
|
import type { Action, Dispatch } from "redux/reducers/video";
|
||||||
import lbry from "lbry";
|
import lbry from "lbry";
|
||||||
|
|
||||||
// export const doVideoPause = (
|
export const setVideoPause = (data: boolean) => (dispatch: Dispatch) =>
|
||||||
// dispatch: 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({
|
|
||||||
type: actions.SET_VIDEO_PAUSE,
|
type: actions.SET_VIDEO_PAUSE,
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
};
|
|
||||||
|
|
|
@ -19,11 +19,7 @@ export default handleActions(
|
||||||
[actions.SET_VIDEO_PAUSE]: (
|
[actions.SET_VIDEO_PAUSE]: (
|
||||||
state: VideoState,
|
state: VideoState,
|
||||||
action: setVideoPause
|
action: setVideoPause
|
||||||
): VideoState => {
|
): VideoState => ({ ...state, videoPause: action.data }),
|
||||||
console.log("VIDEO REDUCER STATE", state);
|
|
||||||
console.log("VIDEO REDUCER ACTION", action);
|
|
||||||
return { ...state, videoPause: action.data };
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
defaultState
|
defaultState
|
||||||
);
|
);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { createSelector } from "reselect";
|
||||||
|
|
||||||
const _selectState = state => state.video || {};
|
const _selectState = state => state.video || {};
|
||||||
|
|
||||||
export const selectVideoPause = createSelector(_selectState, state => {
|
export const selectVideoPause = createSelector(
|
||||||
console.log("VIDEO PAUSE SELECTOR", state);
|
_selectState,
|
||||||
return state.videoPause;
|
state => state.videoPause
|
||||||
});
|
);
|
||||||
|
|
Loading…
Reference in a new issue