aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/video-watch.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-22 15:40:13 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit93cae47925e4dd68b7d34a41927b2740b4fab1b4 (patch)
treef649ab49fab1886b434e164591990cc99b234466 /client/src/app/videos/+video-watch/video-watch.component.ts
parent587568e1cc0e33c023c1ac62dd28fef313285250 (diff)
downloadPeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.tar.gz
PeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.tar.zst
PeerTube-93cae47925e4dd68b7d34a41927b2740b4fab1b4.zip
Add client hooks
Diffstat (limited to 'client/src/app/videos/+video-watch/video-watch.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/video-watch.component.ts16
1 files changed, 14 insertions, 2 deletions
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 6d8bb4b3f..eed2ec048 100644
--- a/client/src/app/videos/+video-watch/video-watch.component.ts
+++ b/client/src/app/videos/+video-watch/video-watch.component.ts
@@ -33,6 +33,7 @@ import { isWebRTCDisabled, timeToInt } from '../../../assets/player/utils'
33import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component' 33import { VideoWatchPlaylistComponent } from '@app/videos/+video-watch/video-watch-playlist.component'
34import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage' 34import { getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
35import { PluginService } from '@app/core/plugins/plugin.service' 35import { PluginService } from '@app/core/plugins/plugin.service'
36import { HooksService } from '@app/core/plugins/hooks.service'
36 37
37@Component({ 38@Component({
38 selector: 'my-video-watch', 39 selector: 'my-video-watch',
@@ -93,6 +94,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
93 private videoCaptionService: VideoCaptionService, 94 private videoCaptionService: VideoCaptionService,
94 private i18n: I18n, 95 private i18n: I18n,
95 private hotkeysService: HotkeysService, 96 private hotkeysService: HotkeysService,
97 private hooks: HooksService,
96 @Inject(LOCALE_ID) private localeId: string 98 @Inject(LOCALE_ID) private localeId: string
97 ) {} 99 ) {}
98 100
@@ -131,7 +133,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
131 133
132 this.theaterEnabled = getStoredTheater() 134 this.theaterEnabled = getStoredTheater()
133 135
134 this.pluginService.runHook('action:video-watch.loaded') 136 this.hooks.runAction('action:video-watch.init')
135 } 137 }
136 138
137 ngOnDestroy () { 139 ngOnDestroy () {
@@ -246,9 +248,17 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
246 248
247 if (this.player) this.player.pause() 249 if (this.player) this.player.pause()
248 250
251 const videoObs = this.hooks.wrapObsFun(
252 this.videoService.getVideo.bind(this.videoService),
253 { videoId },
254 'video-watch',
255 'filter:api.video-watch.video.get.params',
256 'filter:api.video-watch.video.get.result'
257 )
258
249 // Video did change 259 // Video did change
250 forkJoin( 260 forkJoin(
251 this.videoService.getVideo(videoId), 261 videoObs,
252 this.videoCaptionService.listCaptions(videoId) 262 this.videoCaptionService.listCaptions(videoId)
253 ) 263 )
254 .pipe( 264 .pipe(
@@ -486,6 +496,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
486 496
487 this.setOpenGraphTags() 497 this.setOpenGraphTags()
488 this.checkUserRating() 498 this.checkUserRating()
499
500 this.hooks.runAction('action:video-watch.video.loaded')
489 } 501 }
490 502
491 private setRating (nextRating: UserVideoRateType) { 503 private setRating (nextRating: UserVideoRateType) {