1
0
Fork 0

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

* Resume video playback on close of support modal #2995

* Fix lint issues
This commit is contained in:
Aman Sharma 2020-08-10 12:02:10 +05:30 committed by GitHub
parent 17384fd856
commit 203d594f2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -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
}
}

View file

@ -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