X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-watch%2Fvideo-watch.component.ts;h=33f998282628d844d5c0156e0b3f1479953aef58;hb=203d594f2d20c6a573e80f7044cce4bce5dd72a9;hp=dfe73d14d7d0729b19b97cbb762a40dc1b7f01fa;hpb=5abc96fca2496f33075796db208fccc3543e0f65;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index dfe73d14d..33f998282 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts @@ -236,15 +236,24 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } showSupportModal () { + // Check video was playing before opening support modal + const isVideoPlaying = this.isPlaying() + this.pausePlayer() - this.videoSupportModal.show() + const modalRef = this.videoSupportModal.show() + + modalRef.result.then(() => { + if (isVideoPlaying) { + this.resumePlayer() + } + }) } showShareModal () { this.pausePlayer() - this.videoShareModal.show(this.currentTime) + this.videoShareModal.show(this.currentTime, this.videoWatchPlaylist.currentPlaylistPosition) } isUserLoggedIn () { @@ -757,6 +766,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.player.pause() } + private resumePlayer () { + if (!this.player) return + + this.player.play() + } + + private isPlaying () { + if (!this.player) return + + return !this.player.paused() + } + private initHotkeys () { this.hotkeys = [ // These hotkeys are managed by the player