]>
Commit | Line | Data |
---|---|---|
1 | import { buildPlaylistLink, buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils' | |
2 | import { environment } from 'src/environments/environment' | |
3 | import { Component, ElementRef, Input, OnInit } from '@angular/core' | |
4 | ||
5 | @Component({ | |
6 | selector: 'my-embed-markup', | |
7 | template: '' | |
8 | }) | |
9 | export class EmbedMarkupComponent implements OnInit { | |
10 | @Input() uuid: string | |
11 | @Input() type: 'video' | 'playlist' = 'video' | |
12 | ||
13 | constructor (private el: ElementRef) { } | |
14 | ||
15 | ngOnInit () { | |
16 | const link = this.type === 'video' | |
17 | ? buildVideoLink({ baseUrl: `${environment.originServerUrl}/videos/embed/${this.uuid}` }) | |
18 | : buildPlaylistLink({ baseUrl: `${environment.originServerUrl}/video-playlists/embed/${this.uuid}` }) | |
19 | ||
20 | this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed(link, this.uuid) | |
21 | } | |
22 | } |