aboutsummaryrefslogtreecommitdiffhomepage
path: root/client
diff options
context:
space:
mode:
authorAman Sharma <amsharma44@users.noreply.github.com>2020-08-10 12:02:10 +0530
committerGitHub <noreply@github.com>2020-08-10 08:32:10 +0200
commit203d594f2d20c6a573e80f7044cce4bce5dd72a9 (patch)
treebb8651e326ee85600555383329e3ae85858c00f4 /client
parent17384fd85636b9fe672ecb520ba6f2266483d4b1 (diff)
downloadPeerTube-203d594f2d20c6a573e80f7044cce4bce5dd72a9.tar.gz
PeerTube-203d594f2d20c6a573e80f7044cce4bce5dd72a9.tar.zst
PeerTube-203d594f2d20c6a573e80f7044cce4bce5dd72a9.zip
Resume video playback on close of support modal (#3052)
* Resume video playback on close of support modal #2995 * Fix lint issues
Diffstat (limited to 'client')
-rw-r--r--client/src/app/+videos/+video-watch/modal/video-support.component.ts4
-rw-r--r--client/src/app/+videos/+video-watch/video-watch.component.ts23
2 files changed, 25 insertions, 2 deletions
diff --git a/client/src/app/+videos/+video-watch/modal/video-support.component.ts b/client/src/app/+videos/+video-watch/modal/video-support.component.ts
index 48d5f2948..bd5290a72 100644
--- a/client/src/app/+videos/+video-watch/modal/video-support.component.ts
+++ b/client/src/app/+videos/+video-watch/modal/video-support.component.ts
@@ -21,9 +21,11 @@ export class VideoSupportComponent {
21 ) { } 21 ) { }
22 22
23 show () { 23 show () {
24 this.modalService.open(this.modal, { centered: true }) 24 const modalRef = this.modalService.open(this.modal, { centered: true })
25 25
26 this.markdownService.enhancedMarkdownToHTML(this.video.support) 26 this.markdownService.enhancedMarkdownToHTML(this.video.support)
27 .then(r => this.videoHTMLSupport = r) 27 .then(r => this.videoHTMLSupport = r)
28
29 return modalRef
28 } 30 }
29} 31}
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 {
236 } 236 }
237 237
238 showSupportModal () { 238 showSupportModal () {
239 // Check video was playing before opening support modal
240 const isVideoPlaying = this.isPlaying()
241
239 this.pausePlayer() 242 this.pausePlayer()
240 243
241 this.videoSupportModal.show() 244 const modalRef = this.videoSupportModal.show()
245
246 modalRef.result.then(() => {
247 if (isVideoPlaying) {
248 this.resumePlayer()
249 }
250 })
242 } 251 }
243 252
244 showShareModal () { 253 showShareModal () {
@@ -757,6 +766,18 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
757 this.player.pause() 766 this.player.pause()
758 } 767 }
759 768
769 private resumePlayer () {
770 if (!this.player) return
771
772 this.player.play()
773 }
774
775 private isPlaying () {
776 if (!this.player) return
777
778 return !this.player.paused()
779 }
780
760 private initHotkeys () { 781 private initHotkeys () {
761 this.hotkeys = [ 782 this.hotkeys = [
762 // These hotkeys are managed by the player 783 // These hotkeys are managed by the player