aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-share-modal/video-share.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-share-modal/video-share.component.ts')
-rw-r--r--client/src/app/shared/shared-share-modal/video-share.component.ts29
1 files changed, 26 insertions, 3 deletions
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.ts b/client/src/app/shared/shared-share-modal/video-share.component.ts
index e6e4bd147..d59f338c7 100644
--- a/client/src/app/shared/shared-share-modal/video-share.component.ts
+++ b/client/src/app/shared/shared-share-modal/video-share.component.ts
@@ -1,4 +1,5 @@
1import { Component, ElementRef, Input, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
2import { VideoDetails } from '@app/shared/shared-main' 3import { VideoDetails } from '@app/shared/shared-main'
3import { VideoPlaylist } from '@app/shared/shared-video-playlist' 4import { VideoPlaylist } from '@app/shared/shared-video-playlist'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 5import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
@@ -48,7 +49,13 @@ export class VideoShareComponent {
48 isAdvancedCustomizationCollapsed = true 49 isAdvancedCustomizationCollapsed = true
49 includeVideoInPlaylist = false 50 includeVideoInPlaylist = false
50 51
51 constructor (private modalService: NgbModal) { } 52 playlistEmbedHTML: SafeHtml
53 videoEmbedHTML: SafeHtml
54
55 constructor (
56 private modalService: NgbModal,
57 private sanitizer: DomSanitizer
58 ) { }
52 59
53 show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) { 60 show (currentVideoTimestamp?: number, currentPlaylistPosition?: number) {
54 let subtitle: string 61 let subtitle: string
@@ -56,7 +63,7 @@ export class VideoShareComponent {
56 subtitle = this.videoCaptions[0].language.id 63 subtitle = this.videoCaptions[0].language.id
57 } 64 }
58 65
59 this.customizations = { 66 this.customizations = new Proxy({
60 startAtCheckbox: false, 67 startAtCheckbox: false,
61 startAt: currentVideoTimestamp ? Math.floor(currentVideoTimestamp) : 0, 68 startAt: currentVideoTimestamp ? Math.floor(currentVideoTimestamp) : 0,
62 69
@@ -76,10 +83,20 @@ export class VideoShareComponent {
76 warningTitle: true, 83 warningTitle: true,
77 controls: true, 84 controls: true,
78 peertubeLink: true 85 peertubeLink: true
79 } 86 }, {
87 set: (target, prop, value) => {
88 target[prop] = value
89
90 this.updateEmbedCode()
91
92 return true
93 }
94 })
80 95
81 this.playlistPosition = currentPlaylistPosition 96 this.playlistPosition = currentPlaylistPosition
82 97
98 this.updateEmbedCode()
99
83 this.modalService.open(this.modal, { centered: true }) 100 this.modalService.open(this.modal, { centered: true })
84 } 101 }
85 102
@@ -114,6 +131,12 @@ export class VideoShareComponent {
114 return decoratePlaylistLink({ url, playlistPosition: this.playlistPosition }) 131 return decoratePlaylistLink({ url, playlistPosition: this.playlistPosition })
115 } 132 }
116 133
134 updateEmbedCode () {
135 if (this.playlist) this.playlistEmbedHTML = this.sanitizer.bypassSecurityTrustHtml(this.getPlaylistIframeCode())
136
137 if (this.video) this.videoEmbedHTML = this.sanitizer.bypassSecurityTrustHtml(this.getVideoIframeCode())
138 }
139
117 notSecure () { 140 notSecure () {
118 return window.location.protocol === 'http:' 141 return window.location.protocol === 'http:'
119 } 142 }