1
0
Fork 0

Pause the video when a modal is opened

This commit is contained in:
Chocobozzz 2019-12-05 09:21:09 +01:00
parent 2526690866
commit 689a4f6946
No known key found for this signature in database
GPG key ID: 583A612D890159BE
3 changed files with 25 additions and 1 deletions

View file

@ -57,6 +57,7 @@ export class VideoActionsDropdownComponent implements OnChanges {
@Output() videoRemoved = new EventEmitter() @Output() videoRemoved = new EventEmitter()
@Output() videoUnblacklisted = new EventEmitter() @Output() videoUnblacklisted = new EventEmitter()
@Output() videoBlacklisted = new EventEmitter() @Output() videoBlacklisted = new EventEmitter()
@Output() modalOpened = new EventEmitter()
videoActions: DropdownAction<{ video: Video }>[][] = [] videoActions: DropdownAction<{ video: Video }>[][] = []
@ -102,14 +103,20 @@ export class VideoActionsDropdownComponent implements OnChanges {
/* Show modals */ /* Show modals */
showDownloadModal () { showDownloadModal () {
this.modalOpened.emit()
this.videoDownloadModal.show(this.video as VideoDetails) this.videoDownloadModal.show(this.video as VideoDetails)
} }
showReportModal () { showReportModal () {
this.modalOpened.emit()
this.videoReportModal.show() this.videoReportModal.show()
} }
showBlacklistModal () { showBlacklistModal () {
this.modalOpened.emit()
this.videoBlacklistModal.show() this.videoBlacklistModal.show()
} }
@ -160,6 +167,8 @@ export class VideoActionsDropdownComponent implements OnChanges {
} }
async removeVideo () { async removeVideo () {
this.modalOpened.emit()
const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete')) const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete'))
if (res === false) return if (res === false) return

View file

@ -98,7 +98,8 @@
</div> </div>
<my-video-actions-dropdown <my-video-actions-dropdown
placement="top" buttonDirection="horizontal" [buttonStyled]="true" [video]="video" (videoRemoved)="onVideoRemoved()" placement="top" buttonDirection="horizontal" [buttonStyled]="true" [video]="video"
(videoRemoved)="onVideoRemoved()" (modalOpened)="onModalOpened()"
></my-video-actions-dropdown> ></my-video-actions-dropdown>
</div> </div>

View file

@ -203,10 +203,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
} }
showSupportModal () { showSupportModal () {
this.pausePlayer()
this.videoSupportModal.show() this.videoSupportModal.show()
} }
showShareModal () { showShareModal () {
this.pausePlayer()
this.videoShareModal.show(this.currentTime) this.videoShareModal.show(this.currentTime)
} }
@ -227,6 +231,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
} }
} }
onModalOpened () {
this.pausePlayer()
}
onVideoRemoved () { onVideoRemoved () {
this.redirectService.redirectToHomepage() this.redirectService.redirectToHomepage()
} }
@ -622,4 +630,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
] ]
if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
} }
private pausePlayer () {
if (!this.player) return
this.player.pause()
}
} }