]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
Merge branch 'master' into release/3.3.0
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / embed-markup.component.ts
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 import { CustomMarkupComponent } from './shared'
5
6 @Component({
7 selector: 'my-embed-markup',
8 template: ''
9 })
10 export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit {
11 @Input() uuid: string
12 @Input() type: 'video' | 'playlist' = 'video'
13
14 loaded: undefined
15
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 }