Video-watch hooks modifications for videojs
authorRigel Kent <sendmemail@rigelk.eu>
Mon, 18 Nov 2019 08:55:23 +0000 (09:55 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 18 Nov 2019 09:12:23 +0000 (10:12 +0100)
client/src/app/videos/+video-watch/video-watch.component.ts
shared/models/plugins/client-hook.model.ts

index 1e7991738c2fb64e93387f2ca13422846be6f1c5..af4afd456073146343daf44fd880a51fd6fe5ec8 100644 (file)
@@ -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,
@@ -500,6 +501,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 +511,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 () {
index fd560302cf468991467a4c38d78e4471695c9576..07ea7eb969f78c69bf3c5a522586c767b8f9cb46 100644 (file)
@@ -51,6 +51,8 @@ export const clientActionHookObject = {
   'action:video-watch.init': true,
   // Fired when the video watch page loaded the video
   'action:video-watch.video.loaded': true,
+  // Fired when the player finished loading
+  'action:video-watch.player.loaded': true,
 
   // Fired when the search page is being initialized
   'action:search.init': true,