diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
index 52ad1999d..0aa707666 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.html
@@ -62,3 +62,10 @@
Duration
{{ video.duration | myDurationFormatter }}
+
+
+ {{ metadata.label }}
+
+ {{ metadata.value }}
+
+
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
index b8f564c4c..ebfb42711 100644
--- a/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
+++ b/client/src/app/+videos/+video-watch/shared/metadata/video-attributes.component.ts
@@ -1,14 +1,35 @@
-import { Component, Input } from '@angular/core'
+import { Component, Input, OnInit } from '@angular/core'
+import { HooksService } from '@app/core'
import { VideoDetails } from '@app/shared/shared-main'
+type PluginMetadata = {
+ label: string
+
+ value?: string
+ safeHTML?: string
+}
+
@Component({
selector: 'my-video-attributes',
templateUrl: './video-attributes.component.html',
styleUrls: [ './video-attributes.component.scss' ]
})
-export class VideoAttributesComponent {
+export class VideoAttributesComponent implements OnInit {
@Input() video: VideoDetails
+ pluginMetadata: PluginMetadata[] = []
+
+ constructor (private hooks: HooksService) { }
+
+ async ngOnInit () {
+ this.pluginMetadata = await this.hooks.wrapFunResult(
+ this.buildPluginMetadata.bind(this),
+ { video: this.video },
+ 'video-watch',
+ 'filter:video-watch.video-plugin-metadata.result'
+ )
+ }
+
getVideoHost () {
return this.video.channel.host
}
@@ -18,4 +39,11 @@ export class VideoAttributesComponent {
return this.video.tags
}
+
+ // Used for plugin hooks
+ private buildPluginMetadata (_options: {
+ video: VideoDetails
+ }): PluginMetadata[] {
+ return []
+ }
}
diff --git a/client/src/app/core/plugins/hooks.service.ts b/client/src/app/core/plugins/hooks.service.ts
index 29db75d89..f325605e9 100644
--- a/client/src/app/core/plugins/hooks.service.ts
+++ b/client/src/app/core/plugins/hooks.service.ts
@@ -48,6 +48,15 @@ export class HooksService {
return this.pluginService.runHook(hookResultName, result, params)
}
+ async wrapFunResult
+ (fun: RawFunction
, params: P, scope: PluginClientScope, hookResultName: H) {
+ await this.pluginService.ensurePluginsAreLoaded(scope)
+
+ const result = fun(params)
+
+ return this.pluginService.runHook(hookResultName, result, params)
+ }
+
runAction (hookName: U, scope: PluginClientScope, params?: T) {
// Use setTimeout to give priority to Angular change detector
setTimeout(() => {
diff --git a/shared/models/plugins/client/client-hook.model.ts b/shared/models/plugins/client/client-hook.model.ts
index ec1d2b5e5..bc3f5dd9f 100644
--- a/shared/models/plugins/client/client-hook.model.ts
+++ b/shared/models/plugins/client/client-hook.model.ts
@@ -87,6 +87,8 @@ export const clientFilterHookObject = {
'filter:share.video-playlist-url.build.params': true,
'filter:share.video-playlist-url.build.result': true,
+ 'filter:video-watch.video-plugin-metadata.result': true,
+
// Filter videojs options built for PeerTube player
'filter:internal.player.videojs.options.result': true,