getting closer...

This commit is contained in:
Travis Eden 2017-12-19 11:34:39 -05:00
parent a015a44c9d
commit 2f409a6cbd
2 changed files with 44 additions and 40 deletions

View file

@ -8,15 +8,16 @@ 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("video view props", props); // console.log("video view props", props);
this.state = { this.state = {
showNsfwHelp: false, showNsfwHelp: false,
// videoPause: false,
}; };
} }
componentWillReceiveProps() { componentWillReceiveProps(nextProps) {
console.log("!!VIDEO PLAYA RECIEVE PROPS:", this.props); console.log("VIDEO COMPONENT WILL RECIEVE NEXTPROPS:", nextProps);
// console.log("pauseVideo called"); // this.setState({videoPause: nextProps.videoPause});
// this.refs.media.children[0].pause(); // this.refs.media.children[0].pause();
} }
@ -63,10 +64,10 @@ class Video extends React.PureComponent {
changeVolume, changeVolume,
volume, volume,
uri, uri,
// videoPause, videoPause,
} = this.props; } = this.props;
// console.log("VIDEO VIEW videoPause:", videoPause); console.log("VIDEO VIEW videoPause:", videoPause);
const isPlaying = playingUri === uri; const isPlaying = playingUri === uri;
const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0; const isReadyToPlay = fileInfo && fileInfo.written_bytes > 0;
@ -102,35 +103,38 @@ class Video extends React.PureComponent {
const poster = metadata.thumbnail; const poster = metadata.thumbnail;
return ( return (
<div <div>
className={klasses.join(" ")} <p>videoPause: {videoPause}</p>
onMouseEnter={this.handleMouseOver.bind(this)} <div
onMouseLeave={this.handleMouseOut.bind(this)} className={klasses.join(" ")}
> onMouseEnter={this.handleMouseOver.bind(this)}
{isPlaying && onMouseLeave={this.handleMouseOut.bind(this)}
(!isReadyToPlay ? ( >
<LoadingScreen status={loadStatusMessage} /> {isPlaying &&
) : ( (!isReadyToPlay ? (
<VideoPlayer <LoadingScreen status={loadStatusMessage} />
filename={fileInfo.file_name} ) : (
poster={poster} <VideoPlayer
downloadPath={fileInfo.download_path} filename={fileInfo.file_name}
mediaType={mediaType} poster={poster}
contentType={contentType} downloadPath={fileInfo.download_path}
downloadCompleted={fileInfo.completed} mediaType={mediaType}
changeVolume={changeVolume} contentType={contentType}
volume={volume} downloadCompleted={fileInfo.completed}
/> changeVolume={changeVolume}
))} volume={volume}
{!isPlaying && ( />
<div ))}
className="video__cover" {!isPlaying && (
style={{ backgroundImage: 'url("' + metadata.thumbnail + '")' }} <div
> className="video__cover"
<VideoPlayButton {...this.props} mediaType={mediaType} /> style={{ backgroundImage: 'url("' + metadata.thumbnail + '")' }}
</div> >
)} <VideoPlayButton {...this.props} mediaType={mediaType} />
{this.state.showNsfwHelp && <NsfwOverlay />} </div>
)}
{this.state.showNsfwHelp && <NsfwOverlay />}
</div>
</div> </div>
); );
} }

View file

@ -1,9 +1,9 @@
import * as settings from "constants/settings"; import * as settings from "constants/settings";
import { createSelector } from "reselect"; import { createSelector } from "reselect";
const _selectState = state => state.videoPause || false; const _selectState = state => state.video.videoPause || {};
export const selectVideoPause = createSelector( export const selectVideoPause = createSelector(_selectState, state => {
_selectState, console.log("VIDEO PAUSE SELECTOR", state);
state => state.videoPause || false return state.videoPause;
); });