]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
Fix custom markup
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / embed-markup.component.ts
CommitLineData
2539932e
C
1import { environment } from 'src/environments/environment'
2import { Component, ElementRef, Input, OnInit } from '@angular/core'
57d65032 3import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
15a7eafb 4import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils'
0ca454e3 5import { CustomMarkupComponent } from './shared'
2539932e
C
6
7@Component({
8 selector: 'my-embed-markup',
9 template: ''
10})
0ca454e3 11export 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}