]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
CommitLineData
33f6dce1
C
1import { environment } from 'src/environments/environment'
2import { Component, Input, OnInit } from '@angular/core'
3import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
57d65032 4import { buildVideoOrPlaylistEmbed } from '@root-helpers/video'
33f6dce1
C
5import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils'
6import { Video } from '@shared/models'
7
8@Component({
9 selector: 'my-embed',
10 styleUrls: [ './embed.component.scss' ],
11 templateUrl: './embed.component.html'
12})
13export 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 () {
de615445
C
23 const html = buildVideoOrPlaylistEmbed({
24 embedUrl: decorateVideoLink({
33f6dce1
C
25 url: buildVideoEmbedLink(this.video, environment.originServerUrl),
26
27 title: false,
28 warningTitle: false
29 }),
de615445
C
30 embedTitle: this.video.name
31 })
33f6dce1
C
32
33 this.embedHTML = this.sanitizer.bypassSecurityTrustHtml(html)
34 }
35}