aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-share-modal
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-share-modal')
-rw-r--r--client/src/app/shared/shared-share-modal/video-share.component.ts38
1 files changed, 21 insertions, 17 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 a41ff248b..cdfe50836 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,9 +1,15 @@
1import { Component, ElementRef, Input, ViewChild } from '@angular/core' 1import { Component, ElementRef, Input, ViewChild } from '@angular/core'
2import { Video, VideoDetails } from '@app/shared/shared-main' 2import { VideoDetails } from '@app/shared/shared-main'
3import { VideoPlaylist } from '@app/shared/shared-video-playlist' 3import { VideoPlaylist } from '@app/shared/shared-video-playlist'
4import { NgbModal } from '@ng-bootstrap/ng-bootstrap' 4import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
5import { VideoCaption } from '@shared/models' 5import { VideoCaption } from '@shared/models'
6import { buildPlaylistLink, buildVideoLink, buildVideoOrPlaylistEmbed } from '../../../assets/player/utils' 6import {
7 buildPlaylistLink,
8 buildVideoLink,
9 buildVideoOrPlaylistEmbed,
10 decoratePlaylistLink,
11 decorateVideoLink
12} from '../../../assets/player/utils'
7 13
8type Customizations = { 14type Customizations = {
9 startAtCheckbox: boolean 15 startAtCheckbox: boolean
@@ -83,34 +89,34 @@ export class VideoShareComponent {
83 } 89 }
84 90
85 getVideoIframeCode () { 91 getVideoIframeCode () {
86 const options = this.getVideoOptions(this.video.embedUrl) 92 const embedUrl = decorateVideoLink({ url: this.video.embedUrl, ...this.getVideoOptions() })
87 93
88 const embedUrl = buildVideoLink(options)
89 return buildVideoOrPlaylistEmbed(embedUrl, this.video.name) 94 return buildVideoOrPlaylistEmbed(embedUrl, this.video.name)
90 } 95 }
91 96
92 getPlaylistIframeCode () { 97 getPlaylistIframeCode () {
93 const options = this.getPlaylistOptions(this.playlist.embedUrl) 98 const embedUrl = decoratePlaylistLink({ url: this.playlist.embedUrl, ...this.getPlaylistOptions() })
94 99
95 const embedUrl = buildPlaylistLink(options)
96 return buildVideoOrPlaylistEmbed(embedUrl, this.playlist.displayName) 100 return buildVideoOrPlaylistEmbed(embedUrl, this.playlist.displayName)
97 } 101 }
98 102
99 getVideoUrl () { 103 getVideoUrl () {
100 let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin 104 const baseUrl = this.customizations.originUrl
101 baseUrl += Video.buildWatchUrl(this.video) 105 ? this.video.originInstanceUrl
106 : window.location.origin
102 107
103 const options = this.getVideoOptions(baseUrl) 108 return decorateVideoLink({
109 url: buildVideoLink(this.video, baseUrl),
104 110
105 return buildVideoLink(options) 111 ...this.getVideoOptions()
112 })
106 } 113 }
107 114
108 getPlaylistUrl () { 115 getPlaylistUrl () {
109 const base = window.location.origin + VideoPlaylist.buildWatchUrl(this.playlist) 116 const url = buildPlaylistLink(this.playlist)
117 if (!this.includeVideoInPlaylist) return url
110 118
111 if (!this.includeVideoInPlaylist) return base 119 return decoratePlaylistLink({ url, playlistPosition: this.playlistPosition })
112
113 return base + '?playlistPosition=' + this.playlistPosition
114 } 120 }
115 121
116 notSecure () { 122 notSecure () {
@@ -133,10 +139,8 @@ export class VideoShareComponent {
133 } 139 }
134 } 140 }
135 141
136 private getVideoOptions (baseUrl?: string) { 142 private getVideoOptions () {
137 return { 143 return {
138 baseUrl,
139
140 startTime: this.customizations.startAtCheckbox ? this.customizations.startAt : undefined, 144 startTime: this.customizations.startAtCheckbox ? this.customizations.startAt : undefined,
141 stopTime: this.customizations.stopAtCheckbox ? this.customizations.stopAt : undefined, 145 stopTime: this.customizations.stopAtCheckbox ? this.customizations.stopAt : undefined,
142 146