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

View file

@ -5,8 +5,8 @@ import player from "render-media";
import fs from "fs"; import fs from "fs";
import LoadingScreen from "./loading-screen"; import LoadingScreen from "./loading-screen";
import { connect } from "react-redux"; // import { connect } from "react-redux";
import { selectVideoPause } from "redux/selectors/video"; // import { selectVideoPause } from "redux/selectors/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"];
@ -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() { componentDidUpdate() {
const { contentType, downloadCompleted } = this.props; const { contentType, downloadCompleted } = this.props;
const { startedPlaying } = this.state; const { startedPlaying } = this.state;
@ -177,28 +171,19 @@ class VideoPlayer extends React.PureComponent {
return ( return (
<div> <div>
<p>videoPause: {videoPause}</p> {["audio", "application"].indexOf(mediaType) !== -1 &&
<div> (!this.playableType() || hasMetadata) &&
{["audio", "application"].indexOf(mediaType) !== -1 && !unplayable && <Thumbnail src={poster} className="video-embedded" />}
(!this.playableType() || hasMetadata) && {this.playableType() &&
!unplayable && ( !hasMetadata &&
<Thumbnail src={poster} className="video-embedded" /> !unplayable && <LoadingScreen status={noMetadataMessage} />}
)} {unplayable && (
{this.playableType() && <LoadingScreen status={unplayableMessage} spinner={false} />
!hasMetadata && )}
!unplayable && <LoadingScreen status={noMetadataMessage} />} <div ref="media" className="media" />
{unplayable && (
<LoadingScreen status={unplayableMessage} spinner={false} />
)}
<div ref="media" className="media" />
</div>
</div> </div>
); );
} }
} }
const select = (state, props) => ({ export default VideoPlayer;
videoPause: selectVideoPause(state),
});
export default connect(select, {})(VideoPlayer);

View file

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