X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fvideos%2F%2Bvideo-watch%2Fvideo-watch.component.ts;h=0007331f8651d53a792b862ae7dc1cd68717439f;hb=f56ebb3616606e678b25d8064696c75655dcd2ed;hp=1e7991738c2fb64e93387f2ca13422846be6f1c5;hpb=6aa541481390980f9c85d2e66514ba0e6ce77a35;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 1e7991738..0007331f8 100644 --- a/client/src/app/videos/+video-watch/video-watch.component.ts +++ b/client/src/app/videos/+video-watch/video-watch.component.ts @@ -20,6 +20,7 @@ import { environment } from '../../../environments/environment' import { VideoCaptionService } from '@app/shared/video-caption' import { MarkdownService } from '@app/shared/renderer' import { + videojs, CustomizationOptions, P2PMediaLoaderOptions, PeertubePlayerManager, @@ -202,10 +203,14 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } showSupportModal () { + this.pausePlayer() + this.videoSupportModal.show() } showShareModal () { + this.pausePlayer() + this.videoShareModal.show(this.currentTime) } @@ -226,6 +231,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { } } + onModalOpened () { + this.pausePlayer() + } + onVideoRemoved () { this.redirectService.redirectToHomepage() } @@ -468,7 +477,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { segmentsSha256Url: hlsPlaylist.segmentsSha256Url, redundancyBaseUrls: hlsPlaylist.redundancies.map(r => r.baseUrl), trackerAnnounce: this.video.trackerUrls, - videoFiles: this.video.files + videoFiles: hlsPlaylist.files } as P2PMediaLoaderOptions Object.assign(options, { p2pMediaLoader }) @@ -476,6 +485,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.zone.runOutsideAngular(async () => { this.player = await PeertubePlayerManager.initialize(mode, options, player => this.player = player) + this.player.focus() this.player.on('customError', ({ err }: { err: any }) => this.handleError(err)) @@ -500,6 +510,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.player.on('theaterChange', (_: any, enabled: boolean) => { this.zone.run(() => this.theaterEnabled = enabled) }) + + this.hooks.runAction('action:video-watch.player.loaded', 'video-watch', { player: this.player }) }) this.setVideoDescriptionHTML() @@ -508,7 +520,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy { this.setOpenGraphTags() this.checkUserRating() - this.hooks.runAction('action:video-watch.video.loaded', 'video-watch') + this.hooks.runAction('action:video-watch.video.loaded', 'video-watch', { videojs }) } private autoplayNext () { @@ -618,4 +630,10 @@ export class VideoWatchComponent implements OnInit, OnDestroy { ] if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys) } + + private pausePlayer () { + if (!this.player) return + + this.player.pause() + } }