]>
Commit | Line | Data |
---|---|---|
1 | import { environment } from 'src/environments/environment' | |
2 | import { Component, ElementRef, Input, OnInit } from '@angular/core' | |
3 | import { buildVideoOrPlaylistEmbed } from '@root-helpers/video' | |
4 | import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils' | |
5 | import { CustomMarkupComponent } from './shared' | |
6 | ||
7 | @Component({ | |
8 | selector: 'my-embed-markup', | |
9 | template: '' | |
10 | }) | |
11 | export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit { | |
12 | @Input() uuid: string | |
13 | @Input() type: 'video' | 'playlist' = 'video' | |
14 | ||
15 | loaded: undefined | |
16 | ||
17 | constructor (private el: ElementRef) { } | |
18 | ||
19 | ngOnInit () { | |
20 | const link = this.type === 'video' | |
21 | ? buildVideoEmbedLink({ uuid: this.uuid }, environment.originServerUrl) | |
22 | : buildPlaylistEmbedLink({ uuid: this.uuid }, environment.originServerUrl) | |
23 | ||
24 | this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed(link, this.uuid) | |
25 | } | |
26 | } |