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'
8 selector: 'my-embed-markup',
11 export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit {
13 @Input() type: 'video' | 'playlist' = 'video'
17 constructor (private el: ElementRef) { }
20 const link = this.type === 'video'
21 ? buildVideoEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
22 : buildPlaylistEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
24 this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed({ embedUrl: link, embedTitle: this.uuid })