]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/app/shared/shared-main/video/embed.component.ts
Update angular
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-main / video / embed.component.ts
1 import { environment } from 'src/environments/environment'
2 import { Component, Input, OnInit } from '@angular/core'
3 import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
4 import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
5 import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils'
6 import { Video } from '@shared/models'
7
8 @Component({
9 selector: 'my-embed',
10 styleUrls: [ './embed.component.scss' ],
11 templateUrl: './embed.component.html'
12 })
13 export class EmbedComponent implements OnInit {
14 @Input() video: Pick<Video, 'name' | 'uuid'>
15
16 embedHTML: SafeHtml
17
18 constructor (private sanitizer: DomSanitizer) {
19
20 }
21
22 ngOnInit () {
23 const html = buildVideoOrPlaylistEmbed({
24 embedUrl: decorateVideoLink({
25 url: buildVideoEmbedLink(this.video, environment.originServerUrl),
26
27 title: false,
28 warningTitle: false
29 }),
30 embedTitle: this.video.name
31 })
32
33 this.embedHTML = this.sanitizer.bypassSecurityTrustHtml(html)
34 }
35 }