From dd1e2f2f96d736dd955fd72cfc041d06249c4a3e Mon Sep 17 00:00:00 2001 From: Jeena Date: Sun, 18 Oct 2020 03:16:41 +0200 Subject: Add possibility to share origin URL to video if it's not local It's very difficult to share the original URL for a video when you watch it on your own instance while it's not from it but from a different instance. Right now when you use the share UI you only can share a link so a person can watch it on your own instance, this patch adds a checkbox to the share UI to share the origin URL instead if needed. --- .../src/app/shared/shared-share-modal/video-share.component.html | 7 +++++++ .../src/app/shared/shared-share-modal/video-share.component.ts | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'client/src/app/shared') diff --git a/client/src/app/shared/shared-share-modal/video-share.component.html b/client/src/app/shared/shared-share-modal/video-share.component.html index 4174458b5..3222dc5a6 100644 --- a/client/src/app/shared/shared-share-modal/video-share.component.html +++ b/client/src/app/shared/shared-share-modal/video-share.component.html @@ -173,6 +173,13 @@ i18n-labelText labelText="Loop" > + +
+ +
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 f57a50770..b06ff3751 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 @@ -16,6 +16,7 @@ type Customizations = { subtitle: string loop: boolean + originUrl: boolean autoplay: boolean muted: boolean title: boolean @@ -65,6 +66,7 @@ export class VideoShareComponent { subtitle, loop: false, + originUrl: false, autoplay: false, muted: false, @@ -95,7 +97,8 @@ export class VideoShareComponent { } getVideoUrl () { - const baseUrl = window.location.origin + '/videos/watch/' + this.video.uuid + let baseUrl = this.customizations.originUrl ? this.video.originInstanceUrl : window.location.origin + baseUrl += '/videos/watch/' + this.video.uuid const options = this.getVideoOptions(baseUrl) return buildVideoLink(options) @@ -117,6 +120,10 @@ export class VideoShareComponent { return this.activeVideoId === 'embed' } + isLocalVideo () { + return this.video.isLocal + } + private getPlaylistOptions (baseUrl?: string) { return { baseUrl, -- cgit v1.2.3