]>
Commit | Line | Data |
---|---|---|
1 | import { Component, Input, OnInit } from '@angular/core' | |
2 | import { HooksService } from '@app/core' | |
3 | import { VideoDetails } from '@app/shared/shared-main' | |
4 | ||
5 | type PluginMetadata = { | |
6 | label: string | |
7 | ||
8 | value?: string | |
9 | safeHTML?: string | |
10 | } | |
11 | ||
12 | @Component({ | |
13 | selector: 'my-video-attributes', | |
14 | templateUrl: './video-attributes.component.html', | |
15 | styleUrls: [ './video-attributes.component.scss' ] | |
16 | }) | |
17 | export class VideoAttributesComponent implements OnInit { | |
18 | @Input() video: VideoDetails | |
19 | ||
20 | pluginMetadata: PluginMetadata[] = [] | |
21 | ||
22 | constructor (private hooks: HooksService) { } | |
23 | ||
24 | async ngOnInit () { | |
25 | this.pluginMetadata = await this.hooks.wrapObject( | |
26 | this.pluginMetadata, | |
27 | 'video-watch', | |
28 | 'filter:video-watch.video-plugin-metadata.result', | |
29 | { video: this.video } | |
30 | ) | |
31 | } | |
32 | ||
33 | getVideoHost () { | |
34 | return this.video.channel.host | |
35 | } | |
36 | ||
37 | getVideoTags () { | |
38 | if (!this.video || Array.isArray(this.video.tags) === false) return [] | |
39 | ||
40 | return this.video.tags | |
41 | } | |
42 | } |