Hide controls on overlayed videos only.

This commit is contained in:
Daniel Dominguez 2018-05-31 20:10:40 -03:00
parent 0771cd2af1
commit a14235cc18
5 changed files with 24 additions and 5 deletions

View file

@ -40,6 +40,7 @@ const select = (state, props) => ({
searchBarFocused: selectSearchBarFocused(state),
showOverlay: selectShowOverlay(state),
overlayed: props.overlayed,
hiddenControls: props.hiddenControls,
});
const perform = dispatch => ({

View file

@ -29,7 +29,7 @@ class VideoPlayer extends React.PureComponent {
componentDidMount() {
const container = this.media;
const { contentType, changeVolume, volume, position, claim } = this.props;
const { contentType, changeVolume, volume, position, claim, hiddenControls } = this.props;
const loadedMetadata = () => {
this.setState({ hasMetadata: true, startedPlaying: true });
@ -55,7 +55,7 @@ class VideoPlayer extends React.PureComponent {
player.append(
this.file(),
container,
{ autoplay: true, controls: true },
{ autoplay: true, controls: !hiddenControls },
renderMediaCallback.bind(this)
);
}
@ -88,7 +88,7 @@ class VideoPlayer extends React.PureComponent {
}
componentDidUpdate() {
const { contentType, downloadCompleted } = this.props;
const { contentType, downloadCompleted, hiddenControls } = this.props;
const { startedPlaying } = this.state;
if (this.playableType() && !startedPlaying && downloadCompleted) {
@ -99,7 +99,7 @@ class VideoPlayer extends React.PureComponent {
} else {
player.render(this.file(), container, {
autoplay: true,
controls: true,
controls: !hiddenControls,
});
}
}

View file

@ -43,6 +43,7 @@ type Props = {
searchBarFocused: boolean,
showOverlay: boolean,
overlayed: boolean,
hiddenControls: boolean,
};
class Video extends React.PureComponent<Props> {
@ -148,6 +149,7 @@ class Video extends React.PureComponent<Props> {
mediaPosition,
className,
obscureNsfw,
hiddenControls,
} = this.props;
const isPlaying = playingUri === uri;
@ -197,6 +199,7 @@ class Video extends React.PureComponent<Props> {
uri={uri}
paused={mediaPaused}
position={mediaPosition}
hiddenControls={hiddenControls}
/>
)}
</div>

View file

@ -16,7 +16,9 @@ class VideoOverlay extends React.Component<Props> {
return (
<Overlay>
<VideoOverlayHeader uri={playingUri} onClose={cancelPlay} />
<Video className="content__embedded" uri={playingUri} overlayed />
<div className="overlayeada">
<Video className="content__embedded" uri={playingUri} overlayed hiddenControls />
</div>
</Overlay>
);
}

View file

@ -8,6 +8,19 @@
right: 1%;
z-index: 3;
box-shadow: var(--box-shadow-layer);
&:hover {
background-color: rgba(0,0,0, .6);
}
}
.overlayeada {
z-index: 20;
background: transparent;
&:hover {
background-color: rgba(0,0,0, .9);
}
}
.video_overlay__header {