When video ends the overlayed video closes.
This commit is contained in:
parent
aff0c25a8b
commit
03b85cad90
2 changed files with 13 additions and 0 deletions
|
@ -43,6 +43,11 @@ class VideoPlayer extends React.PureComponent {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Hide overlay video when the video ends only if its overlayed
|
||||||
|
const ended = () => {
|
||||||
|
this.props.doHideOverlay();
|
||||||
|
};
|
||||||
|
|
||||||
// use renderAudio override for mp3
|
// use renderAudio override for mp3
|
||||||
if (VideoPlayer.MP3_CONTENT_TYPES.indexOf(contentType) > -1) {
|
if (VideoPlayer.MP3_CONTENT_TYPES.indexOf(contentType) > -1) {
|
||||||
this.renderAudio(container, null, false);
|
this.renderAudio(container, null, false);
|
||||||
|
@ -74,6 +79,9 @@ class VideoPlayer extends React.PureComponent {
|
||||||
});
|
});
|
||||||
mediaElement.volume = volume;
|
mediaElement.volume = volume;
|
||||||
mediaElement.addEventListener('dblclick', this.toggleFullScreenVideo);
|
mediaElement.addEventListener('dblclick', this.toggleFullScreenVideo);
|
||||||
|
if (this.props.overlayed) {
|
||||||
|
mediaElement.addEventListener('ended', ended);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ class Video extends React.PureComponent<Props> {
|
||||||
window.addEventListener('keydown', this.handleKeyDown);
|
window.addEventListener('keydown', this.handleKeyDown);
|
||||||
|
|
||||||
const { showOverlay, doHideOverlay, uri, playingUri, overlayed } = this.props;
|
const { showOverlay, doHideOverlay, uri, playingUri, overlayed } = this.props;
|
||||||
|
// debugger;
|
||||||
if (showOverlay && uri === playingUri && !overlayed) {
|
if (showOverlay && uri === playingUri && !overlayed) {
|
||||||
doHideOverlay();
|
doHideOverlay();
|
||||||
}
|
}
|
||||||
|
@ -150,6 +151,8 @@ class Video extends React.PureComponent<Props> {
|
||||||
className,
|
className,
|
||||||
obscureNsfw,
|
obscureNsfw,
|
||||||
hiddenControls,
|
hiddenControls,
|
||||||
|
overlayed,
|
||||||
|
doHideOverlay,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const isPlaying = playingUri === uri;
|
const isPlaying = playingUri === uri;
|
||||||
|
@ -200,6 +203,8 @@ class Video extends React.PureComponent<Props> {
|
||||||
paused={mediaPaused}
|
paused={mediaPaused}
|
||||||
position={mediaPosition}
|
position={mediaPosition}
|
||||||
hiddenControls={hiddenControls}
|
hiddenControls={hiddenControls}
|
||||||
|
overlayed={overlayed}
|
||||||
|
doHideOverlay={doHideOverlay}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue