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=10846ef656585ee857ec43fc22b490409ddd0d44;hp=d8136ab4ff36dadd56dd8682dffb7a6b00cba271;hpb=951b582f52d0694865f020f0e53ccfad2d2d6033;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 d8136ab4f..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,9 +236,18 @@ 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 () { @@ -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