]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
Refactor video links builders
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-custom-markup / peertube-custom-tags / embed-markup.component.ts
index a854d89f6fb4803898955b35f23c1d96174e298a..53b70cc4759aeaf714ada1dcf01cdfa7a51120b0 100644 (file)
@@ -1,21 +1,25 @@
-import { buildPlaylistLink, buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
+import { buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
 import { environment } from 'src/environments/environment'
 import { Component, ElementRef, Input, OnInit } from '@angular/core'
+import { buildPlaylistEmbedLink, buildVideoEmbedLink } from '@shared/core-utils'
+import { CustomMarkupComponent } from './shared'
 
 @Component({
   selector: 'my-embed-markup',
   template: ''
 })
-export class EmbedMarkupComponent implements OnInit {
+export class EmbedMarkupComponent implements CustomMarkupComponent, OnInit {
   @Input() uuid: string
   @Input() type: 'video' | 'playlist' = 'video'
 
+  loaded: undefined
+
   constructor (private el: ElementRef) { }
 
   ngOnInit () {
     const link = this.type === 'video'
-      ? buildVideoLink({ baseUrl: `${environment.originServerUrl}/videos/embed/${this.uuid}` })
-      : buildPlaylistLink({ baseUrl: `${environment.originServerUrl}/video-playlists/embed/${this.uuid}` })
+      ? buildVideoEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
+      : buildPlaylistEmbedLink({ uuid: this.uuid }, environment.originServerUrl)
 
     this.el.nativeElement.innerHTML = buildVideoOrPlaylistEmbed(link, this.uuid)
   }