back to connecting selectors through index.js

This commit is contained in:
Travis Eden 2017-12-18 18:12:52 -05:00
parent 11ee87829d
commit a015a44c9d
3 changed files with 22 additions and 31 deletions

View file

@ -14,7 +14,7 @@ import {
} from "redux/selectors/file_info";
import { makeSelectCostInfoForUri } from "redux/selectors/cost_info";
import { selectShowNsfw } from "redux/selectors/settings";
// import { selectVideoPause } from "redux/selectors/video";
import { selectVideoPause } from "redux/selectors/video";
import Video from "./view";
import { selectPlayingUri } from "redux/selectors/content";
@ -28,7 +28,7 @@ const select = (state, props) => ({
playingUri: selectPlayingUri(state),
contentType: makeSelectContentTypeForUri(props.uri)(state),
volume: selectVolume(state),
// videoPause: selectVideoPause(state),
videoPause: selectVideoPause(state),
});
const perform = dispatch => ({

View file

@ -5,8 +5,8 @@ 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 { connect } from "react-redux";
// import { selectVideoPause } from "redux/selectors/video";
class VideoPlayer extends React.PureComponent {
static MP3_CONTENT_TYPES = ["audio/mpeg3", "audio/mpeg"];
@ -124,12 +124,6 @@ class VideoPlayer extends React.PureComponent {
}
}
componentWillReceiveProps() {
console.log("!!VIDEO PLAYA RECIEVE PROPS:", this.props);
// console.log("pauseVideo called");
// this.refs.media.children[0].pause();
}
componentDidUpdate() {
const { contentType, downloadCompleted } = this.props;
const { startedPlaying } = this.state;
@ -177,28 +171,19 @@ class VideoPlayer extends React.PureComponent {
return (
<div>
<p>videoPause: {videoPause}</p>
<div>
{["audio", "application"].indexOf(mediaType) !== -1 &&
(!this.playableType() || hasMetadata) &&
!unplayable && (
<Thumbnail src={poster} className="video-embedded" />
)}
{this.playableType() &&
!hasMetadata &&
!unplayable && <LoadingScreen status={noMetadataMessage} />}
{unplayable && (
<LoadingScreen status={unplayableMessage} spinner={false} />
)}
<div ref="media" className="media" />
</div>
{["audio", "application"].indexOf(mediaType) !== -1 &&
(!this.playableType() || hasMetadata) &&
!unplayable && <Thumbnail src={poster} className="video-embedded" />}
{this.playableType() &&
!hasMetadata &&
!unplayable && <LoadingScreen status={noMetadataMessage} />}
{unplayable && (
<LoadingScreen status={unplayableMessage} spinner={false} />
)}
<div ref="media" className="media" />
</div>
);
}
}
const select = (state, props) => ({
videoPause: selectVideoPause(state),
});
export default connect(select, {})(VideoPlayer);
export default VideoPlayer;

View file

@ -8,12 +8,18 @@ import NsfwOverlay from "component/nsfwOverlay";
class Video extends React.PureComponent {
constructor(props) {
super(props);
console.log("PROPS:", props);
console.log("video view props", props);
this.state = {
showNsfwHelp: false,
};
}
componentWillReceiveProps() {
console.log("!!VIDEO PLAYA RECIEVE PROPS:", this.props);
// console.log("pauseVideo called");
// this.refs.media.children[0].pause();
}
componentWillUnmount() {
this.props.cancelPlay();
}