aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/videos/+video-watch/modal/video-share.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/videos/+video-watch/modal/video-share.component.ts')
-rw-r--r--client/src/app/videos/+video-watch/modal/video-share.component.ts28
1 files changed, 18 insertions, 10 deletions
diff --git a/client/src/app/videos/+video-watch/modal/video-share.component.ts b/client/src/app/videos/+video-watch/modal/video-share.component.ts
index f45afccfb..a9a7a0eab 100644
--- a/client/src/app/videos/+video-watch/modal/video-share.component.ts
+++ b/client/src/app/videos/+video-watch/modal/video-share.component.ts
@@ -5,6 +5,7 @@ import { buildVideoEmbed, buildVideoLink } from '../../../../assets/player/utils
5import { I18n } from '@ngx-translate/i18n-polyfill' 5import { I18n } from '@ngx-translate/i18n-polyfill'
6import { NgbModal, NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap' 6import { NgbModal, NgbTabChangeEvent } from '@ng-bootstrap/ng-bootstrap'
7import { VideoCaption } from '@shared/models' 7import { VideoCaption } from '@shared/models'
8import { VideoPlaylist } from '@app/shared/video-playlist/video-playlist.model'
8 9
9type Customizations = { 10type Customizations = {
10 startAtCheckbox: boolean 11 startAtCheckbox: boolean
@@ -34,18 +35,16 @@ export class VideoShareComponent {
34 35
35 @Input() video: VideoDetails = null 36 @Input() video: VideoDetails = null
36 @Input() videoCaptions: VideoCaption[] = [] 37 @Input() videoCaptions: VideoCaption[] = []
38 @Input() playlist: VideoPlaylist = null
37 39
38 activeId: 'url' | 'qrcode' | 'embed' 40 activeId: 'url' | 'qrcode' | 'embed'
39 customizations: Customizations 41 customizations: Customizations
40 isAdvancedCustomizationCollapsed = true 42 isAdvancedCustomizationCollapsed = true
43 includeVideoInPlaylist = false
41 44
42 private currentVideoTimestamp: number 45 private currentVideoTimestamp: number
43 46
44 constructor ( 47 constructor (private modalService: NgbModal) { }
45 private modalService: NgbModal,
46 private notifier: Notifier,
47 private i18n: I18n
48 ) { }
49 48
50 show (currentVideoTimestamp?: number) { 49 show (currentVideoTimestamp?: number) {
51 this.currentVideoTimestamp = currentVideoTimestamp 50 this.currentVideoTimestamp = currentVideoTimestamp
@@ -86,17 +85,22 @@ export class VideoShareComponent {
86 } 85 }
87 86
88 getVideoUrl () { 87 getVideoUrl () {
89 const options = this.getOptions() 88 const baseUrl = window.location.origin + '/videos/watch/' + this.video.uuid
89 const options = this.getOptions(baseUrl)
90 90
91 return buildVideoLink(options) 91 return buildVideoLink(options)
92 } 92 }
93 93
94 notSecure () { 94 getPlaylistUrl () {
95 return window.location.protocol === 'http:' 95 const base = window.location.origin + '/videos/watch/playlist/' + this.playlist.uuid
96
97 if (!this.includeVideoInPlaylist) return base
98
99 return base + '?videoId=' + this.video.uuid
96 } 100 }
97 101
98 activateCopiedMessage () { 102 notSecure () {
99 this.notifier.success(this.i18n('Copied')) 103 return window.location.protocol === 'http:'
100 } 104 }
101 105
102 onTabChange (event: NgbTabChangeEvent) { 106 onTabChange (event: NgbTabChangeEvent) {
@@ -107,6 +111,10 @@ export class VideoShareComponent {
107 return this.activeId === 'embed' 111 return this.activeId === 'embed'
108 } 112 }
109 113
114 hasPlaylist () {
115 return !!this.playlist
116 }
117
110 private getOptions (baseUrl?: string) { 118 private getOptions (baseUrl?: string) {
111 return { 119 return {
112 baseUrl, 120 baseUrl,