]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
Bumped to version v5.2.1
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / embed-markup.component.ts
... / ...
CommitLineData
1import { environment } from 'src/environments/environment'
2import { Component, ElementRef, Input, OnInit } from '@angular/core'
3import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
4import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils'
5import { CustomMarkupComponent } from './shared'
6
7@Component({
8 selector: 'my-embed-markup',
9 template: ''
10})
11export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit {
12 @Input() uuid: string
13 @Input() type: 'video' | 'playlist' = 'video'
14
15 loaded: undefined
16
17 constructor (private el: ElementRef) { }
18
19 ngOnInit () {
20 const link = this.type === 'video'
21 ? buildVideoEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
22 : buildPlaylistEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
23
24 this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed({ embedUrl: link, embedTitle: this.uuid })
25 }
26}