@viostream/viostream-player-svelte 0.2.8 → 0.2.9
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/ViostreamPlayer.svelte +18 -10
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
|
@@ -93,13 +93,11 @@
|
|
|
93
93
|
|
|
94
94
|
// Internal state
|
|
95
95
|
let containerEl: HTMLDivElement | undefined = $state();
|
|
96
|
+
let embedTargetEl: HTMLDivElement | undefined = $state();
|
|
96
97
|
let player: ViostreamPlayer | undefined = $state();
|
|
97
98
|
let errorMsg: string | undefined = $state();
|
|
98
99
|
let isLoading = $state(true);
|
|
99
100
|
|
|
100
|
-
// Unique ID for the container
|
|
101
|
-
const containerId = `viostream-player-${Math.random().toString(36).slice(2, 10)}`;
|
|
102
|
-
|
|
103
101
|
// Build the embed options object from props
|
|
104
102
|
function buildEmbedOptions(): ViostreamEmbedOptions {
|
|
105
103
|
const opts: ViostreamEmbedOptions = {};
|
|
@@ -137,7 +135,17 @@
|
|
|
137
135
|
];
|
|
138
136
|
|
|
139
137
|
onMount(() => {
|
|
140
|
-
|
|
138
|
+
// Generate unique IDs on the client only and assign them imperatively
|
|
139
|
+
// to the DOM elements. This avoids SSR/hydration mismatches caused by
|
|
140
|
+
// Math.random() producing different values on server vs client.
|
|
141
|
+
const containerId = `viostream-player-${Math.random().toString(36).slice(2, 10)}`;
|
|
142
|
+
const embedTargetId = `viostream-embed-${Math.random().toString(36).slice(2, 10)}`;
|
|
143
|
+
|
|
144
|
+
containerEl!.id = containerId;
|
|
145
|
+
containerEl!.setAttribute('data-viostream-sdk', `${SDK_NAME}@${SDK_VERSION}`);
|
|
146
|
+
embedTargetEl!.id = embedTargetId;
|
|
147
|
+
|
|
148
|
+
debug('onMount publicKey=%s accountKey=%s containerId=%s embedTargetId=%s', publicKey, accountKey, containerId, embedTargetId);
|
|
141
149
|
|
|
142
150
|
let destroyed = false;
|
|
143
151
|
|
|
@@ -152,12 +160,12 @@
|
|
|
152
160
|
}
|
|
153
161
|
|
|
154
162
|
const embedOpts = buildEmbedOptions();
|
|
155
|
-
debug('init: calling api.embed publicKey=%s
|
|
156
|
-
const raw: RawViostreamPlayerInstance = api.embed(publicKey,
|
|
163
|
+
debug('init: calling api.embed publicKey=%s embedTargetId=%s options=%o', publicKey, embedTargetId, embedOpts);
|
|
164
|
+
const raw: RawViostreamPlayerInstance = api.embed(publicKey, embedTargetId, embedOpts, normalizeForceAspectRatio(forceAspectRatio));
|
|
157
165
|
debug('init: api.embed returned raw player');
|
|
158
166
|
|
|
159
|
-
const wrappedPlayer = wrapRawPlayer(raw,
|
|
160
|
-
debug('init: wrapRawPlayer completed
|
|
167
|
+
const wrappedPlayer = wrapRawPlayer(raw, embedTargetId);
|
|
168
|
+
debug('init: wrapRawPlayer completed embedTargetId=%s', embedTargetId);
|
|
161
169
|
|
|
162
170
|
if (destroyed) {
|
|
163
171
|
debug('init: stale closure detected after wrapRawPlayer — destroying and aborting publicKey=%s', publicKey);
|
|
@@ -230,13 +238,13 @@
|
|
|
230
238
|
</script>
|
|
231
239
|
|
|
232
240
|
<div
|
|
233
|
-
id={containerId}
|
|
234
241
|
class={className}
|
|
235
242
|
bind:this={containerEl}
|
|
236
243
|
data-viostream-player
|
|
237
244
|
data-viostream-public-key={publicKey}
|
|
238
|
-
data-viostream-sdk={`${SDK_NAME}@${SDK_VERSION}`}
|
|
239
245
|
>
|
|
246
|
+
<div bind:this={embedTargetEl} data-viostream-embed-target></div>
|
|
247
|
+
|
|
240
248
|
{#if isLoading}
|
|
241
249
|
{#if loadingSnippet}
|
|
242
250
|
{@render loadingSnippet()}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const SDK_NAME = "viostream-player-svelte";
|
|
2
|
-
export declare const SDK_VERSION = "0.2.
|
|
2
|
+
export declare const SDK_VERSION = "0.2.9";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viostream/viostream-player-svelte",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.9",
|
|
4
4
|
"description": "Svelte 5 SDK for the Viostream video player — embed, control, and listen to player events",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"!dist/**/*.spec.*"
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@viostream/viostream-player-core": "^0.2.
|
|
34
|
+
"@viostream/viostream-player-core": "^0.2.9",
|
|
35
35
|
"debug": "^4.4.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|