]>
Commit | Line | Data |
---|---|---|
2539932e C |
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' | |
0ca454e3 | 4 | import { CustomMarkupComponent } from './shared' |
2539932e C |
5 | |
6 | @Component({ | |
7 | selector: 'my-embed-markup', | |
8 | template: '' | |
9 | }) | |
0ca454e3 | 10 | export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit { |
2539932e C |
11 | @Input() uuid: string |
12 | @Input() type: 'video' | 'playlist' = 'video' | |
13 | ||
0ca454e3 C |
14 | loaded: undefined |
15 | ||
2539932e C |
16 | constructor (private el: ElementRef) { } |
17 | ||
18 | ngOnInit () { | |
19 | const link = this.type === 'video' | |
20 | ? buildVideoLink({ baseUrl: `${environment.originServerUrl}/videos/embed/${this.uuid}` }) | |
21 | : buildPlaylistLink({ baseUrl: `${environment.originServerUrl}/video-playlists/embed/${this.uuid}` }) | |
22 | ||
23 | this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed(link, this.uuid) | |
24 | } | |
25 | } |