Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Resume video playback on close of support modal (#3052)

Aman Sharma203d594f2d20
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 48d5f29486..bd5290a721 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 {
) { }
show () {
- this.modalService.open(this.modal, { centered: true })
+ const modalRef = this.modalService.open(this.modal, { centered: true })
this.markdownService.enhancedMarkdownToHTML(this.video.support)
.then(r => this.videoHTMLSupport = r)
+
+ return modalRef
}
}
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 d8136ab4ff..33f9982826 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