@atmo-dev/kit 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/events/EventView.svelte +26 -21
- package/dist/events/VodPlayer.svelte +14 -73
- package/dist/events/VodPlayer.svelte.d.ts +0 -1
- package/dist/events/editor/adapter.d.ts +3 -0
- package/dist/events/event-view/Player.svelte +431 -0
- package/dist/events/event-view/Player.svelte.d.ts +24 -0
- package/dist/events/event-view/StreamPlacePlayer.svelte +13 -46
- package/dist/events/event-view/StreamPlacePlayer.svelte.d.ts +0 -1
- package/dist/events/schedule/ScheduleEventCell.svelte +2 -1
- package/dist/events/urls.d.ts +17 -0
- package/dist/events/urls.js +11 -0
- package/dist/events-data.d.ts +1 -0
- package/dist/events-data.js +1 -0
- package/package.json +1 -6
- package/dist/events/event-view/plyr-icons.d.ts +0 -3
- package/dist/events/event-view/plyr-icons.js +0 -46
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
eventUrl,
|
|
4
|
-
isEventOngoing,
|
|
5
|
-
type AttendeeListLoader,
|
|
6
|
-
type FlatEventRecord
|
|
7
|
-
} from './contrail.js';
|
|
2
|
+
import { isEventOngoing, type AttendeeListLoader, type FlatEventRecord } from './contrail.js';
|
|
8
3
|
import type { EventViewData } from './view-data.js';
|
|
9
4
|
import { getCDNImageBlobUrl } from './atproto-helpers.js';
|
|
10
5
|
import { getEventThumbnail, getEventExternalImage } from './event-media.js';
|
|
@@ -38,7 +33,7 @@
|
|
|
38
33
|
import ExternalRsvpNotice from './event-view/ExternalRsvpNotice.svelte';
|
|
39
34
|
import RichText from '../components/RichText.svelte';
|
|
40
35
|
import { richTextToPlainText } from '../richtext/document.js';
|
|
41
|
-
import {
|
|
36
|
+
import { resolveEventUrls } from './urls.js';
|
|
42
37
|
import { getLocations, resolveGeoLocation, type GeoLocation } from './event-view/locations.js';
|
|
43
38
|
|
|
44
39
|
let {
|
|
@@ -83,8 +78,12 @@
|
|
|
83
78
|
|
|
84
79
|
let theme: EventTheme = $derived(eventData.theme ?? defaultTheme);
|
|
85
80
|
|
|
86
|
-
let
|
|
87
|
-
let
|
|
81
|
+
let urls = $derived(resolveEventUrls(adapter.urls));
|
|
82
|
+
let hostActor = $derived(hostProfile?.handle || did);
|
|
83
|
+
let hostUrl = $derived(urls.profile(hostActor));
|
|
84
|
+
let eventPath = $derived(urls.event(hostActor, rkey));
|
|
85
|
+
let editUrl = $derived(urls.edit(hostActor, rkey));
|
|
86
|
+
let talksUrl = $derived(urls.talks(hostActor, rkey));
|
|
88
87
|
let shareUrl = $derived(
|
|
89
88
|
shareUrlOverride
|
|
90
89
|
? shareUrlOverride
|
|
@@ -216,6 +215,8 @@
|
|
|
216
215
|
|
|
217
216
|
// Conference: when this event is a conference, render its talks as a timetable.
|
|
218
217
|
let isConference = $derived(isConferenceEvent(eventData));
|
|
218
|
+
// An app without an editor has nothing to offer the owner here.
|
|
219
|
+
let ownerActions = $derived(isOwner && !!(editUrl || (isConference && talksUrl)));
|
|
219
220
|
let eventActor = $derived(hostProfile?.handle || did);
|
|
220
221
|
let conferenceRooms = $derived(getConferenceRooms(eventData));
|
|
221
222
|
let scheduleEvents = $derived(
|
|
@@ -255,7 +256,7 @@
|
|
|
255
256
|
avatar: viewer.avatar,
|
|
256
257
|
name: viewer.displayName || viewer.handle || viewer.did,
|
|
257
258
|
handle: viewer.handle,
|
|
258
|
-
url:
|
|
259
|
+
url: urls.profile(viewer.handle || viewer.did)
|
|
259
260
|
},
|
|
260
261
|
viewerRsvpStatus
|
|
261
262
|
);
|
|
@@ -297,7 +298,7 @@
|
|
|
297
298
|
class="grid grid-cols-1 gap-8 md:grid-cols-[14rem_1fr] md:grid-rows-[auto_1fr] md:gap-x-10 md:gap-y-6 lg:grid-cols-[16rem_1fr]"
|
|
298
299
|
>
|
|
299
300
|
<!-- Thumbnail image and owner controls (left column) -->
|
|
300
|
-
{#if !showBanner ||
|
|
301
|
+
{#if !showBanner || ownerActions}
|
|
301
302
|
<div class="order-1 max-w-sm md:order-0 md:col-start-1 md:max-w-none">
|
|
302
303
|
{#if displayImage && !showBanner}
|
|
303
304
|
<img
|
|
@@ -320,15 +321,15 @@
|
|
|
320
321
|
/>
|
|
321
322
|
</div>
|
|
322
323
|
{/if}
|
|
323
|
-
{#if
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
{#if isConference}
|
|
328
|
-
<Button href="./{rkey}/talks" variant="secondary" class="mt-2 w-full">
|
|
329
|
-
Manage talks
|
|
324
|
+
{#if ownerActions}
|
|
325
|
+
{#if editUrl}
|
|
326
|
+
<Button href={editUrl} class={showBanner ? 'w-full' : 'mt-9 w-full'}>
|
|
327
|
+
Edit Event
|
|
330
328
|
</Button>
|
|
331
329
|
{/if}
|
|
330
|
+
{#if isConference && talksUrl}
|
|
331
|
+
<Button href={talksUrl} variant="secondary" class="mt-2 w-full">Manage talks</Button>
|
|
332
|
+
{/if}
|
|
332
333
|
{/if}
|
|
333
334
|
</div>
|
|
334
335
|
{/if}
|
|
@@ -360,9 +361,13 @@
|
|
|
360
361
|
>
|
|
361
362
|
Part of
|
|
362
363
|
</p>
|
|
363
|
-
<EventCard
|
|
364
|
+
<EventCard
|
|
365
|
+
event={data.parentEvent}
|
|
366
|
+
actor={parentActor}
|
|
367
|
+
href={urls.event(parentActor, data.parentEvent.rkey)}
|
|
368
|
+
/>
|
|
364
369
|
<Button
|
|
365
|
-
href={data.parentScheduleUrl ??
|
|
370
|
+
href={data.parentScheduleUrl ?? urls.event(parentActor, data.parentEvent.rkey)}
|
|
366
371
|
size="lg"
|
|
367
372
|
class="mt-6 w-full"
|
|
368
373
|
>
|
|
@@ -433,7 +438,7 @@
|
|
|
433
438
|
content={data.description}
|
|
434
439
|
text={eventData.description ?? ''}
|
|
435
440
|
facets={eventData.facets}
|
|
436
|
-
mentionUrl={
|
|
441
|
+
mentionUrl={urls.profile}
|
|
437
442
|
socialClient={viewer.preferredSocialClient}
|
|
438
443
|
detectLinks
|
|
439
444
|
headingOffset={1}
|
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { onMount } from 'svelte';
|
|
9
|
-
import 'plyr/dist/plyr.css';
|
|
10
9
|
import type HlsType from 'hls.js';
|
|
11
|
-
import
|
|
12
|
-
import { sketchyPlyrIcons } from './event-view/plyr-icons.js';
|
|
10
|
+
import Player from './event-view/Player.svelte';
|
|
13
11
|
|
|
14
12
|
let {
|
|
15
13
|
playlistUrl,
|
|
@@ -26,38 +24,30 @@
|
|
|
26
24
|
} = $props();
|
|
27
25
|
|
|
28
26
|
let videoEl: HTMLVideoElement | undefined = $state();
|
|
27
|
+
let player: Player | undefined = $state();
|
|
29
28
|
let error = $state(false);
|
|
30
29
|
|
|
31
30
|
let hls: HlsType | null = null;
|
|
32
|
-
let plyr: PlyrType | null = null;
|
|
33
31
|
|
|
34
32
|
api = {
|
|
35
33
|
seek(time: number) {
|
|
36
|
-
|
|
37
|
-
plyr.currentTime = time;
|
|
38
|
-
plyr.play();
|
|
39
|
-
}
|
|
34
|
+
player?.seek(time);
|
|
40
35
|
}
|
|
41
36
|
};
|
|
42
37
|
|
|
43
38
|
onMount(() => {
|
|
44
39
|
init();
|
|
45
|
-
return () =>
|
|
46
|
-
hls?.destroy();
|
|
47
|
-
plyr?.destroy();
|
|
48
|
-
};
|
|
40
|
+
return () => hls?.destroy();
|
|
49
41
|
});
|
|
50
42
|
|
|
51
43
|
async function init() {
|
|
52
44
|
if (!videoEl) return;
|
|
53
45
|
|
|
54
46
|
try {
|
|
55
|
-
const
|
|
56
|
-
import('plyr'),
|
|
57
|
-
import('hls.js')
|
|
58
|
-
]);
|
|
47
|
+
const { default: Hls } = await import('hls.js');
|
|
59
48
|
|
|
60
49
|
if (Hls.isSupported()) {
|
|
50
|
+
// Nothing is downloaded until the viewer presses play.
|
|
61
51
|
hls = new Hls({ autoStartLoad: false });
|
|
62
52
|
hls.loadSource(playlistUrl);
|
|
63
53
|
hls.attachMedia(videoEl);
|
|
@@ -76,55 +66,6 @@
|
|
|
76
66
|
videoEl.src = playlistUrl;
|
|
77
67
|
} else {
|
|
78
68
|
error = true;
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
plyr = new Plyr(videoEl, {
|
|
83
|
-
...sketchyPlyrIcons(),
|
|
84
|
-
controls: [
|
|
85
|
-
'play-large',
|
|
86
|
-
'play',
|
|
87
|
-
'progress',
|
|
88
|
-
'current-time',
|
|
89
|
-
'mute',
|
|
90
|
-
'volume',
|
|
91
|
-
'captions',
|
|
92
|
-
'settings',
|
|
93
|
-
'fullscreen'
|
|
94
|
-
],
|
|
95
|
-
settings: ['captions', 'speed'],
|
|
96
|
-
speed: { selected: 1, options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2] },
|
|
97
|
-
captions: { active: !!subtitlesUrl, language: 'en', update: true },
|
|
98
|
-
ratio: '16:9'
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
plyr.on('play', () => {
|
|
102
|
-
hls?.startLoad();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
plyr.on('timeupdate', () => {
|
|
106
|
-
currentTime = plyr?.currentTime ?? 0;
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// Add track after Plyr init and force captions on
|
|
110
|
-
if (subtitlesUrl) {
|
|
111
|
-
const media = videoEl;
|
|
112
|
-
// Remove any existing tracks first
|
|
113
|
-
media.querySelectorAll('track').forEach((t) => t.remove());
|
|
114
|
-
// Add fresh track
|
|
115
|
-
const track = document.createElement('track');
|
|
116
|
-
track.kind = 'captions';
|
|
117
|
-
track.label = 'English';
|
|
118
|
-
track.srclang = 'en';
|
|
119
|
-
track.src = subtitlesUrl;
|
|
120
|
-
track.default = true;
|
|
121
|
-
media.appendChild(track);
|
|
122
|
-
// Wait for track to load, then activate
|
|
123
|
-
track.addEventListener('load', () => {
|
|
124
|
-
plyr!.toggleCaptions(true);
|
|
125
|
-
});
|
|
126
|
-
// Also try toggling after a short delay as fallback
|
|
127
|
-
setTimeout(() => plyr?.toggleCaptions(true), 500);
|
|
128
69
|
}
|
|
129
70
|
} catch {
|
|
130
71
|
error = true;
|
|
@@ -142,13 +83,13 @@
|
|
|
142
83
|
<div
|
|
143
84
|
class="aspect-video w-full max-w-full overflow-hidden rounded-xl border border-base-300 dark:border-base-400/40"
|
|
144
85
|
>
|
|
145
|
-
<
|
|
146
|
-
|
|
86
|
+
<Player
|
|
87
|
+
bind:this={player}
|
|
88
|
+
bind:video={videoEl}
|
|
89
|
+
bind:currentTime
|
|
90
|
+
{title}
|
|
91
|
+
captionsUrl={subtitlesUrl}
|
|
92
|
+
onplay={() => hls?.startLoad()}
|
|
93
|
+
/>
|
|
147
94
|
</div>
|
|
148
95
|
{/if}
|
|
149
|
-
|
|
150
|
-
<style>
|
|
151
|
-
* {
|
|
152
|
-
--plyr-color-main: var(--color-accent-500);
|
|
153
|
-
}
|
|
154
|
-
</style>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { PreferredSocialClient } from '../../social.js';
|
|
10
10
|
import type { LinkedRecordsClient } from '../linked-records.js';
|
|
11
|
+
import type { EventUrls } from '../urls.js';
|
|
11
12
|
export type EditorBlobRef = {
|
|
12
13
|
$type: 'blob';
|
|
13
14
|
ref: {
|
|
@@ -28,6 +29,8 @@ export type EditorViewer = {
|
|
|
28
29
|
avatar?: string;
|
|
29
30
|
};
|
|
30
31
|
export type EditorAdapter = {
|
|
32
|
+
/** The host's routes for profiles, events and editing; see `EventUrls` for the defaults. */
|
|
33
|
+
urls?: EventUrls;
|
|
31
34
|
/** Optional public read transport, supplied by the host (also used in embeds). */
|
|
32
35
|
linkedRecords?: LinkedRecordsClient;
|
|
33
36
|
features: {
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
const SPEEDS = [1, 1.25, 1.5, 1.75, 2, 0.5, 0.75];
|
|
3
|
+
const clock = (seconds: number) => {
|
|
4
|
+
if (!Number.isFinite(seconds) || seconds < 0) seconds = 0;
|
|
5
|
+
const s = Math.floor(seconds % 60);
|
|
6
|
+
const m = Math.floor(seconds / 60) % 60;
|
|
7
|
+
const h = Math.floor(seconds / 3600);
|
|
8
|
+
return h
|
|
9
|
+
? `${h}:${String(m).padStart(2, '0')}:${String(s).padStart(2, '0')}`
|
|
10
|
+
: `${m}:${String(s).padStart(2, '0')}`;
|
|
11
|
+
};
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import type { Snippet } from 'svelte';
|
|
16
|
+
import { Icon } from '../../index.js';
|
|
17
|
+
import {
|
|
18
|
+
Captions,
|
|
19
|
+
CaptionsOff,
|
|
20
|
+
Maximize,
|
|
21
|
+
Minimize,
|
|
22
|
+
Pause,
|
|
23
|
+
Play,
|
|
24
|
+
Volume2,
|
|
25
|
+
VolumeX
|
|
26
|
+
} from '@sketchyicons/svelte';
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
* The controls shared by the recording and live players. The caller attaches the media
|
|
30
|
+
* (an HLS playlist, a WebRTC stream) to the bound `video` element; this component only
|
|
31
|
+
* drives it.
|
|
32
|
+
*/
|
|
33
|
+
let {
|
|
34
|
+
title,
|
|
35
|
+
poster,
|
|
36
|
+
live = false,
|
|
37
|
+
autoplay = false,
|
|
38
|
+
captionsUrl,
|
|
39
|
+
video = $bindable(),
|
|
40
|
+
currentTime = $bindable(0),
|
|
41
|
+
controlsVisible = $bindable(true),
|
|
42
|
+
onplay,
|
|
43
|
+
children
|
|
44
|
+
}: {
|
|
45
|
+
title: string;
|
|
46
|
+
poster?: string;
|
|
47
|
+
/** A live stream has no timeline to scrub and no playback speed. */
|
|
48
|
+
live?: boolean;
|
|
49
|
+
/** Start playing, muted, as browsers require. */
|
|
50
|
+
autoplay?: boolean;
|
|
51
|
+
/** WebVTT captions, shown from the start. */
|
|
52
|
+
captionsUrl?: string;
|
|
53
|
+
video?: HTMLVideoElement;
|
|
54
|
+
currentTime?: number;
|
|
55
|
+
/** Whether the controls are on screen, for overlays that come and go with them. */
|
|
56
|
+
controlsVisible?: boolean;
|
|
57
|
+
onplay?: () => void;
|
|
58
|
+
/** Overlay content, positioned by the caller inside the frame. */
|
|
59
|
+
children?: Snippet;
|
|
60
|
+
} = $props();
|
|
61
|
+
|
|
62
|
+
let frame = $state<HTMLDivElement>();
|
|
63
|
+
let bar = $state<HTMLDivElement>();
|
|
64
|
+
let started = $state(false);
|
|
65
|
+
let playing = $state(false);
|
|
66
|
+
let waiting = $state(false);
|
|
67
|
+
// svelte-ignore state_referenced_locally
|
|
68
|
+
let muted = $state(autoplay);
|
|
69
|
+
let volume = $state(1);
|
|
70
|
+
let duration = $state(0);
|
|
71
|
+
let buffered = $state(0);
|
|
72
|
+
let speed = $state(1);
|
|
73
|
+
let fullscreen = $state(false);
|
|
74
|
+
let hasCaptions = $state(false);
|
|
75
|
+
// svelte-ignore state_referenced_locally
|
|
76
|
+
let captions = $state(!!captionsUrl);
|
|
77
|
+
let active = $state(true);
|
|
78
|
+
let scrubbing = $state(false);
|
|
79
|
+
/** A control holds keyboard focus; a control that was only clicked does not count. */
|
|
80
|
+
let focused = $state(false);
|
|
81
|
+
let hideTimer: ReturnType<typeof setTimeout> | undefined;
|
|
82
|
+
|
|
83
|
+
$effect(() => {
|
|
84
|
+
controlsVisible = active || !playing || scrubbing || focused;
|
|
85
|
+
});
|
|
86
|
+
$effect(() => () => clearTimeout(hideTimer));
|
|
87
|
+
|
|
88
|
+
// Caption tracks arrive from the `<track>` below or from the stream itself.
|
|
89
|
+
const captionTracks = (node: HTMLVideoElement) =>
|
|
90
|
+
[...node.textTracks].filter((track) => track.kind === 'captions' || track.kind === 'subtitles');
|
|
91
|
+
$effect(() => {
|
|
92
|
+
const node = video;
|
|
93
|
+
if (!node) return;
|
|
94
|
+
const sync = () => {
|
|
95
|
+
const tracks = captionTracks(node);
|
|
96
|
+
hasCaptions = tracks.length > 0;
|
|
97
|
+
tracks.forEach((track, index) => {
|
|
98
|
+
track.mode = captions && index === 0 ? 'showing' : 'disabled';
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
sync();
|
|
102
|
+
node.textTracks.addEventListener('addtrack', sync);
|
|
103
|
+
return () => node.textTracks.removeEventListener('addtrack', sync);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// Captions sit at the bottom of the picture, where the controls are: lift them while
|
|
107
|
+
// the controls are up.
|
|
108
|
+
$effect(() => {
|
|
109
|
+
const node = video;
|
|
110
|
+
if (!node || !hasCaptions || !captions) return;
|
|
111
|
+
const line = controlsVisible ? -4 : 'auto';
|
|
112
|
+
const lift = () => {
|
|
113
|
+
for (const track of captionTracks(node))
|
|
114
|
+
for (const cue of track.cues ?? []) (cue as VTTCue).line = line;
|
|
115
|
+
};
|
|
116
|
+
lift();
|
|
117
|
+
const tracks = captionTracks(node);
|
|
118
|
+
tracks.forEach((track) => track.addEventListener('cuechange', lift));
|
|
119
|
+
return () => tracks.forEach((track) => track.removeEventListener('cuechange', lift));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export function seek(time: number) {
|
|
123
|
+
if (!video) return;
|
|
124
|
+
video.currentTime = time;
|
|
125
|
+
currentTime = time;
|
|
126
|
+
void video.play().catch(() => {});
|
|
127
|
+
}
|
|
128
|
+
export function pause() {
|
|
129
|
+
video?.pause();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function toggle() {
|
|
133
|
+
if (!video) return;
|
|
134
|
+
if (video.paused) void video.play().catch(() => {});
|
|
135
|
+
else video.pause();
|
|
136
|
+
poke();
|
|
137
|
+
}
|
|
138
|
+
function setMuted(next: boolean) {
|
|
139
|
+
if (!video) return;
|
|
140
|
+
if (!next && !volume) setVolume(1);
|
|
141
|
+
video.muted = next;
|
|
142
|
+
poke();
|
|
143
|
+
}
|
|
144
|
+
function setVolume(value: number) {
|
|
145
|
+
if (!video) return;
|
|
146
|
+
volume = value;
|
|
147
|
+
video.volume = value;
|
|
148
|
+
video.muted = value === 0;
|
|
149
|
+
}
|
|
150
|
+
function toggleCaptions() {
|
|
151
|
+
captions = !captions;
|
|
152
|
+
if (video)
|
|
153
|
+
captionTracks(video).forEach((track, index) => {
|
|
154
|
+
track.mode = captions && index === 0 ? 'showing' : 'disabled';
|
|
155
|
+
});
|
|
156
|
+
poke();
|
|
157
|
+
}
|
|
158
|
+
function nextSpeed() {
|
|
159
|
+
speed = SPEEDS[(SPEEDS.indexOf(speed) + 1) % SPEEDS.length];
|
|
160
|
+
if (video) video.playbackRate = speed;
|
|
161
|
+
poke();
|
|
162
|
+
}
|
|
163
|
+
function toggleFullscreen() {
|
|
164
|
+
if (document.fullscreenElement) void document.exitFullscreen();
|
|
165
|
+
else if (frame?.requestFullscreen) void frame.requestFullscreen();
|
|
166
|
+
// iPhones only put the video element itself in full screen.
|
|
167
|
+
else (video as unknown as { webkitEnterFullscreen?: () => void })?.webkitEnterFullscreen?.();
|
|
168
|
+
}
|
|
169
|
+
/** Keep the controls up for a moment after any interaction. */
|
|
170
|
+
function poke() {
|
|
171
|
+
active = true;
|
|
172
|
+
clearTimeout(hideTimer);
|
|
173
|
+
hideTimer = setTimeout(() => (active = false), 2500);
|
|
174
|
+
}
|
|
175
|
+
function seekTo(event: PointerEvent) {
|
|
176
|
+
if (!video || !bar || !duration) return;
|
|
177
|
+
const rect = bar.getBoundingClientRect();
|
|
178
|
+
video.currentTime =
|
|
179
|
+
Math.min(1, Math.max(0, (event.clientX - rect.left) / rect.width)) * duration;
|
|
180
|
+
currentTime = video.currentTime;
|
|
181
|
+
}
|
|
182
|
+
function key(event: KeyboardEvent) {
|
|
183
|
+
if (!video) return;
|
|
184
|
+
const target = event.target as HTMLElement;
|
|
185
|
+
// Buttons and the volume slider keep their own keys.
|
|
186
|
+
if (target.tagName === 'INPUT' || (target.tagName === 'BUTTON' && event.key === ' ')) return;
|
|
187
|
+
const step = (delta: number) => {
|
|
188
|
+
if (!live) seek(Math.min(duration || 0, Math.max(0, video!.currentTime + delta)));
|
|
189
|
+
};
|
|
190
|
+
switch (event.key) {
|
|
191
|
+
case ' ':
|
|
192
|
+
case 'k':
|
|
193
|
+
toggle();
|
|
194
|
+
break;
|
|
195
|
+
case 'ArrowLeft':
|
|
196
|
+
step(-5);
|
|
197
|
+
break;
|
|
198
|
+
case 'ArrowRight':
|
|
199
|
+
step(5);
|
|
200
|
+
break;
|
|
201
|
+
case 'm':
|
|
202
|
+
setMuted(!muted);
|
|
203
|
+
break;
|
|
204
|
+
case 'f':
|
|
205
|
+
toggleFullscreen();
|
|
206
|
+
break;
|
|
207
|
+
default:
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
poke();
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const button =
|
|
215
|
+
'grid size-9 shrink-0 cursor-pointer place-items-center rounded-full text-white hover:bg-white/15 focus-visible:outline-2 focus-visible:outline-white';
|
|
216
|
+
</script>
|
|
217
|
+
|
|
218
|
+
<svelte:document onfullscreenchange={() => (fullscreen = document.fullscreenElement === frame)} />
|
|
219
|
+
|
|
220
|
+
<!-- svelte-ignore a11y_no_noninteractive_tabindex, a11y_no_noninteractive_element_interactions -->
|
|
221
|
+
<div
|
|
222
|
+
bind:this={frame}
|
|
223
|
+
role="group"
|
|
224
|
+
aria-label={title}
|
|
225
|
+
tabindex="0"
|
|
226
|
+
class="group/player relative size-full overflow-hidden bg-black outline-none {controlsVisible
|
|
227
|
+
? ''
|
|
228
|
+
: 'cursor-none'}"
|
|
229
|
+
onpointermove={poke}
|
|
230
|
+
onpointerleave={() => playing && (active = false)}
|
|
231
|
+
onkeydown={key}
|
|
232
|
+
>
|
|
233
|
+
<video
|
|
234
|
+
bind:this={video}
|
|
235
|
+
{poster}
|
|
236
|
+
{autoplay}
|
|
237
|
+
muted={autoplay}
|
|
238
|
+
playsinline
|
|
239
|
+
crossorigin="anonymous"
|
|
240
|
+
class="size-full object-contain"
|
|
241
|
+
onclick={toggle}
|
|
242
|
+
ondblclick={toggleFullscreen}
|
|
243
|
+
onplay={() => {
|
|
244
|
+
playing = true;
|
|
245
|
+
started = true;
|
|
246
|
+
onplay?.();
|
|
247
|
+
}}
|
|
248
|
+
onpause={() => (playing = false)}
|
|
249
|
+
onwaiting={() => (waiting = true)}
|
|
250
|
+
onplaying={() => (waiting = false)}
|
|
251
|
+
oncanplay={() => (waiting = false)}
|
|
252
|
+
ontimeupdate={(event) => !scrubbing && (currentTime = event.currentTarget.currentTime)}
|
|
253
|
+
ondurationchange={(event) => (duration = event.currentTarget.duration)}
|
|
254
|
+
onprogress={(event) => {
|
|
255
|
+
const ranges = event.currentTarget.buffered;
|
|
256
|
+
buffered = ranges.length ? ranges.end(ranges.length - 1) : 0;
|
|
257
|
+
}}
|
|
258
|
+
onvolumechange={(event) => (muted = event.currentTarget.muted)}
|
|
259
|
+
>
|
|
260
|
+
{#if captionsUrl}
|
|
261
|
+
<track kind="captions" label="English" srclang="en" src={captionsUrl} default />
|
|
262
|
+
{/if}
|
|
263
|
+
</video>
|
|
264
|
+
|
|
265
|
+
{#if !playing && !waiting && !scrubbing}
|
|
266
|
+
<button
|
|
267
|
+
type="button"
|
|
268
|
+
aria-label="Play"
|
|
269
|
+
class="absolute inset-0 grid cursor-pointer place-items-center"
|
|
270
|
+
onclick={toggle}
|
|
271
|
+
>
|
|
272
|
+
<span
|
|
273
|
+
class="grid size-14 place-items-center rounded-full bg-black/60 text-white transition-transform duration-150 group-hover/player:scale-105 motion-reduce:transition-none"
|
|
274
|
+
>
|
|
275
|
+
<Icon img={Play} size={24} />
|
|
276
|
+
</span>
|
|
277
|
+
</button>
|
|
278
|
+
{/if}
|
|
279
|
+
|
|
280
|
+
{#if waiting && playing}
|
|
281
|
+
<div class="pointer-events-none absolute inset-0 grid place-items-center">
|
|
282
|
+
<span
|
|
283
|
+
class="size-9 animate-spin rounded-full border-[3px] border-white/25 border-t-white motion-reduce:animate-none"
|
|
284
|
+
></span>
|
|
285
|
+
</div>
|
|
286
|
+
{/if}
|
|
287
|
+
|
|
288
|
+
{@render children?.()}
|
|
289
|
+
|
|
290
|
+
<div
|
|
291
|
+
data-part="controls"
|
|
292
|
+
onfocusin={(event) => (focused = (event.target as Element).matches(':focus-visible'))}
|
|
293
|
+
onfocusout={() => (focused = false)}
|
|
294
|
+
class="absolute inset-x-0 bottom-0 bg-linear-to-t from-black/80 to-transparent px-2 pt-8 pb-1.5 transition-opacity duration-200 motion-reduce:transition-none {controlsVisible &&
|
|
295
|
+
(started || !live)
|
|
296
|
+
? 'opacity-100'
|
|
297
|
+
: 'pointer-events-none opacity-0'}"
|
|
298
|
+
>
|
|
299
|
+
{#if !live}
|
|
300
|
+
<div
|
|
301
|
+
bind:this={bar}
|
|
302
|
+
role="slider"
|
|
303
|
+
tabindex="0"
|
|
304
|
+
aria-label="Seek"
|
|
305
|
+
aria-valuemin="0"
|
|
306
|
+
aria-valuemax={Math.round(duration)}
|
|
307
|
+
aria-valuenow={Math.round(currentTime)}
|
|
308
|
+
aria-valuetext="{clock(currentTime)} of {clock(duration)}"
|
|
309
|
+
class="group/bar flex h-4 cursor-pointer touch-none items-center px-1.5 outline-none"
|
|
310
|
+
onpointerdown={(event) => {
|
|
311
|
+
scrubbing = true;
|
|
312
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
313
|
+
seekTo(event);
|
|
314
|
+
}}
|
|
315
|
+
onpointermove={(event) => scrubbing && seekTo(event)}
|
|
316
|
+
onpointerup={() => (scrubbing = false)}
|
|
317
|
+
onpointercancel={() => (scrubbing = false)}
|
|
318
|
+
>
|
|
319
|
+
<div
|
|
320
|
+
class="relative h-1 w-full rounded-full bg-white/25 transition-[height] group-hover/bar:h-1.5 group-focus-visible/bar:h-1.5"
|
|
321
|
+
>
|
|
322
|
+
<div
|
|
323
|
+
class="absolute inset-y-0 left-0 rounded-full bg-white/35"
|
|
324
|
+
style="width:{duration ? (buffered / duration) * 100 : 0}%"
|
|
325
|
+
></div>
|
|
326
|
+
<div
|
|
327
|
+
class="absolute inset-y-0 left-0 rounded-full bg-accent-400"
|
|
328
|
+
style="width:{duration ? (currentTime / duration) * 100 : 0}%"
|
|
329
|
+
>
|
|
330
|
+
<span
|
|
331
|
+
class="absolute top-1/2 right-0 size-3 translate-x-1/2 -translate-y-1/2 rounded-full bg-white opacity-0 group-hover/bar:opacity-100 group-focus-visible/bar:opacity-100 {scrubbing
|
|
332
|
+
? 'opacity-100'
|
|
333
|
+
: ''}"
|
|
334
|
+
></span>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
</div>
|
|
338
|
+
{/if}
|
|
339
|
+
|
|
340
|
+
<div class="flex items-center gap-0.5">
|
|
341
|
+
<button type="button" class={button} aria-label={playing ? 'Pause' : 'Play'} onclick={toggle}>
|
|
342
|
+
<Icon img={playing ? Pause : Play} size={18} />
|
|
343
|
+
</button>
|
|
344
|
+
{#if live}
|
|
345
|
+
<span class="px-1.5 text-xs font-medium text-white">Live</span>
|
|
346
|
+
{:else}
|
|
347
|
+
<span class="px-1.5 text-xs text-white tabular-nums"
|
|
348
|
+
>{clock(currentTime)} / {clock(duration)}</span
|
|
349
|
+
>
|
|
350
|
+
{/if}
|
|
351
|
+
<span class="flex-1"></span>
|
|
352
|
+
<div class="group/volume flex items-center">
|
|
353
|
+
<input
|
|
354
|
+
type="range"
|
|
355
|
+
min="0"
|
|
356
|
+
max="1"
|
|
357
|
+
step="0.05"
|
|
358
|
+
value={muted ? 0 : volume}
|
|
359
|
+
aria-label="Volume"
|
|
360
|
+
class="volume mr-1 hidden w-16 group-focus-within/volume:block group-hover/volume:block pointer-coarse:!hidden"
|
|
361
|
+
oninput={(event) => setVolume(Number(event.currentTarget.value))}
|
|
362
|
+
/>
|
|
363
|
+
<button
|
|
364
|
+
type="button"
|
|
365
|
+
class={button}
|
|
366
|
+
aria-label={muted ? 'Unmute' : 'Mute'}
|
|
367
|
+
onclick={() => setMuted(!muted)}
|
|
368
|
+
>
|
|
369
|
+
<Icon img={muted ? VolumeX : Volume2} size={18} />
|
|
370
|
+
</button>
|
|
371
|
+
</div>
|
|
372
|
+
{#if hasCaptions}
|
|
373
|
+
<button
|
|
374
|
+
type="button"
|
|
375
|
+
class={button}
|
|
376
|
+
aria-label={captions ? 'Hide captions' : 'Show captions'}
|
|
377
|
+
aria-pressed={captions}
|
|
378
|
+
onclick={toggleCaptions}
|
|
379
|
+
>
|
|
380
|
+
<Icon img={captions ? Captions : CaptionsOff} size={18} />
|
|
381
|
+
</button>
|
|
382
|
+
{/if}
|
|
383
|
+
{#if !live}
|
|
384
|
+
<button
|
|
385
|
+
type="button"
|
|
386
|
+
class="{button} w-auto min-w-9 px-2 text-xs font-medium tabular-nums"
|
|
387
|
+
aria-label="Playback speed {speed}×"
|
|
388
|
+
onclick={nextSpeed}>{speed}×</button
|
|
389
|
+
>
|
|
390
|
+
{/if}
|
|
391
|
+
<button
|
|
392
|
+
type="button"
|
|
393
|
+
class={button}
|
|
394
|
+
aria-label={fullscreen ? 'Exit full screen' : 'Full screen'}
|
|
395
|
+
onclick={toggleFullscreen}
|
|
396
|
+
>
|
|
397
|
+
<Icon img={fullscreen ? Minimize : Maximize} size={17} />
|
|
398
|
+
</button>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
<style>
|
|
404
|
+
.volume {
|
|
405
|
+
height: 4px;
|
|
406
|
+
appearance: none;
|
|
407
|
+
border-radius: 999px;
|
|
408
|
+
background: rgb(255 255 255 / 0.3);
|
|
409
|
+
accent-color: white;
|
|
410
|
+
cursor: pointer;
|
|
411
|
+
}
|
|
412
|
+
.volume::-webkit-slider-thumb {
|
|
413
|
+
appearance: none;
|
|
414
|
+
width: 12px;
|
|
415
|
+
height: 12px;
|
|
416
|
+
border-radius: 999px;
|
|
417
|
+
background: white;
|
|
418
|
+
}
|
|
419
|
+
.volume::-moz-range-thumb {
|
|
420
|
+
width: 12px;
|
|
421
|
+
height: 12px;
|
|
422
|
+
border: 0;
|
|
423
|
+
border-radius: 999px;
|
|
424
|
+
background: white;
|
|
425
|
+
}
|
|
426
|
+
video::cue {
|
|
427
|
+
font-family: inherit;
|
|
428
|
+
font-size: 0.9em;
|
|
429
|
+
background: rgb(0 0 0 / 0.7);
|
|
430
|
+
}
|
|
431
|
+
</style>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
title: string;
|
|
4
|
+
poster?: string;
|
|
5
|
+
/** A live stream has no timeline to scrub and no playback speed. */
|
|
6
|
+
live?: boolean;
|
|
7
|
+
/** Start playing, muted, as browsers require. */
|
|
8
|
+
autoplay?: boolean;
|
|
9
|
+
/** WebVTT captions, shown from the start. */
|
|
10
|
+
captionsUrl?: string;
|
|
11
|
+
video?: HTMLVideoElement;
|
|
12
|
+
currentTime?: number;
|
|
13
|
+
/** Whether the controls are on screen, for overlays that come and go with them. */
|
|
14
|
+
controlsVisible?: boolean;
|
|
15
|
+
onplay?: () => void;
|
|
16
|
+
/** Overlay content, positioned by the caller inside the frame. */
|
|
17
|
+
children?: Snippet;
|
|
18
|
+
};
|
|
19
|
+
declare const Player: import("svelte").Component<$$ComponentProps, {
|
|
20
|
+
seek: (time: number) => void;
|
|
21
|
+
pause: () => void;
|
|
22
|
+
}, "video" | "currentTime" | "controlsVisible">;
|
|
23
|
+
type Player = ReturnType<typeof Player>;
|
|
24
|
+
export default Player;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
import { onMount } from 'svelte';
|
|
3
3
|
import { Icon } from '../../index.js';
|
|
4
4
|
import { ExternalLink } from '@sketchyicons/svelte';
|
|
5
|
-
import '
|
|
6
|
-
import type PlyrType from 'plyr';
|
|
7
|
-
import { sketchyPlyrIcons } from './plyr-icons.js';
|
|
5
|
+
import Player from './Player.svelte';
|
|
8
6
|
|
|
9
7
|
let {
|
|
10
8
|
handle,
|
|
@@ -15,12 +13,11 @@
|
|
|
15
13
|
} = $props();
|
|
16
14
|
|
|
17
15
|
let videoEl: HTMLVideoElement | undefined = $state();
|
|
18
|
-
let
|
|
16
|
+
let player: Player | undefined = $state();
|
|
19
17
|
let error = $state(false);
|
|
20
18
|
let controlsVisible = $state(true);
|
|
21
19
|
|
|
22
20
|
let pc: RTCPeerConnection | null = null;
|
|
23
|
-
let plyr: PlyrType | null = null;
|
|
24
21
|
|
|
25
22
|
const posterUrl = $derived(
|
|
26
23
|
`https://stream.place/api/playback/${encodeURIComponent(handle)}/stream.jpg`
|
|
@@ -36,7 +33,6 @@
|
|
|
36
33
|
if (videoEl) {
|
|
37
34
|
videoEl.srcObject = null;
|
|
38
35
|
}
|
|
39
|
-
plyr?.destroy();
|
|
40
36
|
};
|
|
41
37
|
});
|
|
42
38
|
|
|
@@ -123,29 +119,6 @@
|
|
|
123
119
|
|
|
124
120
|
const answerSdp = await response.text();
|
|
125
121
|
await pc.setRemoteDescription({ type: 'answer', sdp: answerSdp });
|
|
126
|
-
|
|
127
|
-
const { default: Plyr } = await import('plyr');
|
|
128
|
-
|
|
129
|
-
plyr = new Plyr(videoEl, {
|
|
130
|
-
...sketchyPlyrIcons(),
|
|
131
|
-
controls: ['play', 'mute', 'volume', 'fullscreen'],
|
|
132
|
-
settings: [],
|
|
133
|
-
ratio: '16:9'
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
plyr.on('controlshidden', () => {
|
|
137
|
-
controlsVisible = false;
|
|
138
|
-
});
|
|
139
|
-
plyr.on('controlsshown', () => {
|
|
140
|
-
controlsVisible = true;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
// Move the overlay link inside Plyr's container so mousemove over the
|
|
144
|
-
// button bubbles into Plyr's activity tracker — otherwise hovering it
|
|
145
|
-
// hides the controls, which hides the button, which reactivates Plyr
|
|
146
|
-
// (a flicker loop).
|
|
147
|
-
const plyrEl = videoEl.closest('.plyr');
|
|
148
|
-
if (plyrEl && overlayEl) plyrEl.appendChild(overlayEl);
|
|
149
122
|
} catch {
|
|
150
123
|
error = true;
|
|
151
124
|
if (pc) {
|
|
@@ -158,11 +131,10 @@
|
|
|
158
131
|
|
|
159
132
|
{#snippet watchOnStreamPlace(hidden = false)}
|
|
160
133
|
<a
|
|
161
|
-
bind:this={overlayEl}
|
|
162
134
|
href="https://stream.place/{handle}"
|
|
163
135
|
target="_blank"
|
|
164
136
|
rel="noopener noreferrer"
|
|
165
|
-
onclick={() =>
|
|
137
|
+
onclick={() => player?.pause()}
|
|
166
138
|
class="absolute top-3 right-3 z-10 inline-flex items-center gap-1.5 rounded-full bg-black/55 px-2.5 py-1 text-xs font-medium text-white backdrop-blur-sm transition-opacity duration-200 hover:bg-black/75 {hidden
|
|
167
139
|
? 'pointer-events-none opacity-0'
|
|
168
140
|
: 'opacity-100'}"
|
|
@@ -188,22 +160,17 @@
|
|
|
188
160
|
<div
|
|
189
161
|
class="relative aspect-video w-full max-w-full overflow-hidden rounded-xl border border-base-300 dark:border-base-400/40"
|
|
190
162
|
>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
bind:
|
|
194
|
-
|
|
195
|
-
|
|
163
|
+
<Player
|
|
164
|
+
bind:this={player}
|
|
165
|
+
bind:video={videoEl}
|
|
166
|
+
bind:controlsVisible
|
|
167
|
+
{title}
|
|
196
168
|
poster={posterUrl}
|
|
169
|
+
live
|
|
197
170
|
autoplay
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
171
|
+
>
|
|
172
|
+
<!-- Inside the player, so pointing at the link keeps the controls up. -->
|
|
173
|
+
{@render watchOnStreamPlace(!controlsVisible)}
|
|
174
|
+
</Player>
|
|
202
175
|
</div>
|
|
203
176
|
{/if}
|
|
204
|
-
|
|
205
|
-
<style>
|
|
206
|
-
* {
|
|
207
|
-
--plyr-color-main: var(--color-accent-500);
|
|
208
|
-
}
|
|
209
|
-
</style>
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import { Modal, Button, Icon } from '../../index.js';
|
|
11
11
|
import EventRsvp from '../EventRsvp.svelte';
|
|
12
12
|
import VodPlayer from '../VodPlayer.svelte';
|
|
13
|
+
import { resolveEventUrls } from '../urls.js';
|
|
13
14
|
import type { EditorAdapter, EditorViewer } from '../editor/adapter.js';
|
|
14
15
|
import type { Snippet } from 'svelte';
|
|
15
16
|
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
);
|
|
53
54
|
let initialRsvpRkey = $derived(rsvpRkeys[event.uri] ?? null);
|
|
54
55
|
let isPast = $derived(event.end ? new Date(event.end) < new Date() : false);
|
|
55
|
-
let eventHref = $derived(
|
|
56
|
+
let eventHref = $derived(resolveEventUrls(adapter.urls).event(eventActor, event.rkey));
|
|
56
57
|
</script>
|
|
57
58
|
|
|
58
59
|
{#if linkableTypes.has(event.type) && event.rkey}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the event components link to inside the host app. Every entry is optional; the
|
|
3
|
+
* defaults are the RSVP app's routes.
|
|
4
|
+
*/
|
|
5
|
+
export type EventUrls = {
|
|
6
|
+
/** A person's page: the host, an attendee, a mention. Default `/p/{actor}`. */
|
|
7
|
+
profile?: (actor: string) => string;
|
|
8
|
+
/** An event's page. Default `/p/{actor}/e/{rkey}`. */
|
|
9
|
+
event?: (actor: string, rkey: string) => string;
|
|
10
|
+
/** The event's editor, or null for an app without one. Default: the event's page plus `/edit`. */
|
|
11
|
+
edit?: (actor: string, rkey: string) => string | null;
|
|
12
|
+
/** Where a conference's talks are managed, or null. Default: the event's page plus `/talks`. */
|
|
13
|
+
talks?: (actor: string, rkey: string) => string | null;
|
|
14
|
+
};
|
|
15
|
+
export type ResolvedEventUrls = Required<EventUrls>;
|
|
16
|
+
/** The host's routes with the defaults filled in. */
|
|
17
|
+
export declare function resolveEventUrls(urls?: EventUrls): ResolvedEventUrls;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** The host's routes with the defaults filled in. */
|
|
2
|
+
export function resolveEventUrls(urls = {}) {
|
|
3
|
+
const profile = urls.profile ?? ((actor) => `/p/${encodeURIComponent(actor)}`);
|
|
4
|
+
const event = urls.event ?? ((actor, rkey) => `/p/${actor}/e/${rkey}`);
|
|
5
|
+
return {
|
|
6
|
+
profile,
|
|
7
|
+
event,
|
|
8
|
+
edit: urls.edit ?? ((actor, rkey) => `${event(actor, rkey)}/edit`),
|
|
9
|
+
talks: urls.talks ?? ((actor, rkey) => `${event(actor, rkey)}/talks`)
|
|
10
|
+
};
|
|
11
|
+
}
|
package/dist/events-data.d.ts
CHANGED
|
@@ -12,4 +12,5 @@ export * from './events/theme.js';
|
|
|
12
12
|
export { getEventThumbnail, getEventExternalImage, type ExternalEventImage } from './events/event-media.js';
|
|
13
13
|
export { getCDNImageBlobUrl, compressImage, configureAtproto } from './events/atproto-helpers.js';
|
|
14
14
|
export { getProfileUrl, getLocalProfileUrl } from './events/profile-url.js';
|
|
15
|
+
export { resolveEventUrls, type EventUrls, type ResolvedEventUrls } from './events/urls.js';
|
|
15
16
|
export { normalizeCountryCode, normalizeEventLocations, LocationValidationError } from './events/editor/location.js';
|
package/dist/events-data.js
CHANGED
|
@@ -6,4 +6,5 @@ export * from './events/theme.js';
|
|
|
6
6
|
export { getEventThumbnail, getEventExternalImage } from './events/event-media.js';
|
|
7
7
|
export { getCDNImageBlobUrl, compressImage, configureAtproto } from './events/atproto-helpers.js';
|
|
8
8
|
export { getProfileUrl, getLocalProfileUrl } from './events/profile-url.js';
|
|
9
|
+
export { resolveEventUrls } from './events/urls.js';
|
|
9
10
|
export { normalizeCountryCode, normalizeEventLocations, LocationValidationError } from './events/editor/location.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atmo-dev/kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "The shared UI foundation for Atmo apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"maplibre-gl": "^6.16.0",
|
|
80
|
-
"plyr": "^3.8.5",
|
|
81
80
|
"svelte": ">=5.48.0 <6",
|
|
82
81
|
"svelte-maplibre-gl": "^2.2.1",
|
|
83
82
|
"tailwindcss": "^4.0.0"
|
|
@@ -88,9 +87,6 @@
|
|
|
88
87
|
},
|
|
89
88
|
"svelte-maplibre-gl": {
|
|
90
89
|
"optional": true
|
|
91
|
-
},
|
|
92
|
-
"plyr": {
|
|
93
|
-
"optional": true
|
|
94
90
|
}
|
|
95
91
|
},
|
|
96
92
|
"devDependencies": {
|
|
@@ -116,7 +112,6 @@
|
|
|
116
112
|
"globals": "^17.6.0",
|
|
117
113
|
"maplibre-gl": "^6.16.0",
|
|
118
114
|
"playwright": "^1.60.0",
|
|
119
|
-
"plyr": "^3.8.5",
|
|
120
115
|
"prettier": "^3.8.3",
|
|
121
116
|
"prettier-plugin-svelte": "^4.1.0",
|
|
122
117
|
"prettier-plugin-tailwindcss": "^0.8.0",
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Captions, CaptionsOff, Maximize, Minimize, Pause, Play, Settings, Volume2, VolumeX } from '@sketchyicons/svelte';
|
|
2
|
-
const prefix = 'atmo-sketchy-plyr';
|
|
3
|
-
const icons = {
|
|
4
|
-
play: Play,
|
|
5
|
-
pause: Pause,
|
|
6
|
-
volume: Volume2,
|
|
7
|
-
muted: VolumeX,
|
|
8
|
-
'captions-on': Captions,
|
|
9
|
-
'captions-off': CaptionsOff,
|
|
10
|
-
'enter-fullscreen': Maximize,
|
|
11
|
-
'exit-fullscreen': Minimize,
|
|
12
|
-
settings: Settings
|
|
13
|
-
};
|
|
14
|
-
/** Called in the browser before constructing either video player. */
|
|
15
|
-
export function sketchyPlyrIcons() {
|
|
16
|
-
// One local sprite serves every player, without fetching Plyr's stock CDN icons.
|
|
17
|
-
if (!document.getElementById(prefix)) {
|
|
18
|
-
const ns = 'http://www.w3.org/2000/svg';
|
|
19
|
-
const sprite = document.createElementNS(ns, 'svg');
|
|
20
|
-
sprite.id = prefix;
|
|
21
|
-
sprite.setAttribute('width', '0');
|
|
22
|
-
sprite.setAttribute('height', '0');
|
|
23
|
-
sprite.setAttribute('aria-hidden', 'true');
|
|
24
|
-
sprite.setAttribute('focusable', 'false');
|
|
25
|
-
sprite.style.position = 'absolute';
|
|
26
|
-
for (const [name, nodes] of Object.entries(icons)) {
|
|
27
|
-
const symbol = document.createElementNS(ns, 'symbol');
|
|
28
|
-
symbol.id = `${prefix}-${name}`;
|
|
29
|
-
symbol.setAttribute('viewBox', '0 0 24 24');
|
|
30
|
-
symbol.setAttribute('stroke', 'currentColor');
|
|
31
|
-
symbol.setAttribute('stroke-width', '1.75');
|
|
32
|
-
symbol.setAttribute('stroke-linecap', 'round');
|
|
33
|
-
symbol.setAttribute('stroke-linejoin', 'round');
|
|
34
|
-
for (const [, attributes] of nodes) {
|
|
35
|
-
const path = document.createElementNS(ns, 'path');
|
|
36
|
-
path.setAttribute('d', String(attributes.d));
|
|
37
|
-
path.setAttribute('fill', String(attributes.fill ?? 'none'));
|
|
38
|
-
symbol.appendChild(path);
|
|
39
|
-
}
|
|
40
|
-
sprite.appendChild(symbol);
|
|
41
|
-
}
|
|
42
|
-
document.body.appendChild(sprite);
|
|
43
|
-
}
|
|
44
|
-
// An empty iconUrl makes Plyr reference the local symbols by fragment only.
|
|
45
|
-
return { iconPrefix: prefix, iconUrl: '', loadSprite: false };
|
|
46
|
-
}
|