diff --git a/materialious/src/lib/components/ShareVideo.svelte b/materialious/src/lib/components/ShareVideo.svelte
index 2afff642..f28465f3 100644
--- a/materialious/src/lib/components/ShareVideo.svelte
+++ b/materialious/src/lib/components/ShareVideo.svelte
@@ -8,20 +8,37 @@
interface Props {
video: VideoBase | Video | Notification | PlaylistPageVideo;
+ currentTime?: number;
}
- let { video }: Props = $props();
+ let { video, currentTime = $bindable() }: Props = $props();
+ let includeTimestamp: boolean = $state(false);
+{#if currentTime !== undefined}
+
+
+ {$_('player.share.includeTimestamp')}
+
+
+{/if}
{
+ let url = '';
if (Capacitor.isNativePlatform()) {
- await Clipboard.write({ string: `${get(instanceStore)}/watch/${video.videoId}` });
+ url = `${get(instanceStore)}/watch/${video.videoId}`;
} else {
- await Clipboard.write({ string: `${location.origin}/watch/${video.videoId}` });
+ url = `${location.origin}/watch/${video.videoId}`;
}
+ if (includeTimestamp && currentTime !== undefined) {
+ url += `?time=${Math.floor(currentTime)}`;
+ }
+ await Clipboard.write({ string: url });
(document.activeElement as HTMLElement)?.blur();
}}
>
@@ -31,7 +48,11 @@
class="row"
role="presentation"
onclick={async () => {
- await Clipboard.write({ string: `https://redirect.invidious.io/watch?v=${video.videoId}` });
+ let url = `https://redirect.invidious.io/watch?v=${video.videoId}`;
+ if (includeTimestamp && currentTime !== undefined) {
+ url += `&t=${Math.floor(currentTime)}`;
+ }
+ await Clipboard.write({ string: url });
(document.activeElement as HTMLElement)?.blur();
}}
>
@@ -41,7 +62,11 @@
class="row"
role="presentation"
onclick={async () => {
- await Clipboard.write({ string: `https://www.youtube.com/watch?v=${video.videoId}` });
+ let url = `https://www.youtube.com/watch?v=${video.videoId}`;
+ if (includeTimestamp && currentTime !== undefined) {
+ url += `&t=${Math.floor(currentTime)}`;
+ }
+ await Clipboard.write({ string: url });
(document.activeElement as HTMLElement)?.blur();
}}
>
diff --git a/materialious/src/lib/i18n/locales/en.json b/materialious/src/lib/i18n/locales/en.json
index 7f697f11..c160c3c5 100644
--- a/materialious/src/lib/i18n/locales/en.json
+++ b/materialious/src/lib/i18n/locales/en.json
@@ -85,7 +85,8 @@
"title": "Share",
"materialiousLink": "Copy Materialious link",
"invidiousRedirect": "Copy Invidious redirect link",
- "youtubeLink": "Copy Youtube link"
+ "youtubeLink": "Copy Youtube link",
+ "includeTimestamp": "Timestamped"
},
"download": "Download",
"downloadSteps": {
diff --git a/materialious/src/routes/(app)/watch/[slug]/+page.svelte b/materialious/src/routes/(app)/watch/[slug]/+page.svelte
index b6e98a0d..46ec484e 100644
--- a/materialious/src/routes/(app)/watch/[slug]/+page.svelte
+++ b/materialious/src/routes/(app)/watch/[slug]/+page.svelte
@@ -370,7 +370,7 @@
{$_('player.share.title')}
{#if personalPlaylists}