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