diff --git a/src/renderer/component/video/internal/player.jsx b/src/renderer/component/video/internal/player.jsx index 2c1657945..70b210944 100644 --- a/src/renderer/component/video/internal/player.jsx +++ b/src/renderer/component/video/internal/player.jsx @@ -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 if (VideoPlayer.MP3_CONTENT_TYPES.indexOf(contentType) > -1) { this.renderAudio(container, null, false); @@ -74,6 +79,9 @@ class VideoPlayer extends React.PureComponent { }); mediaElement.volume = volume; mediaElement.addEventListener('dblclick', this.toggleFullScreenVideo); + if (this.props.overlayed) { + mediaElement.addEventListener('ended', ended); + } } } diff --git a/src/renderer/component/video/view.jsx b/src/renderer/component/video/view.jsx index ae3bf070f..22b4e554f 100644 --- a/src/renderer/component/video/view.jsx +++ b/src/renderer/component/video/view.jsx @@ -59,6 +59,7 @@ class Video extends React.PureComponent { window.addEventListener('keydown', this.handleKeyDown); const { showOverlay, doHideOverlay, uri, playingUri, overlayed } = this.props; + // debugger; if (showOverlay && uri === playingUri && !overlayed) { doHideOverlay(); } @@ -150,6 +151,8 @@ class Video extends React.PureComponent { className, obscureNsfw, hiddenControls, + overlayed, + doHideOverlay, } = this.props; const isPlaying = playingUri === uri; @@ -200,6 +203,8 @@ class Video extends React.PureComponent { paused={mediaPaused} position={mediaPosition} hiddenControls={hiddenControls} + overlayed={overlayed} + doHideOverlay={doHideOverlay} /> )}