@viostream/viostream-player-svelte 0.2.7 → 0.2.8
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/README.md +1 -0
- package/dist/ViostreamPlayer.svelte +7 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -89,6 +89,7 @@ All embed options are optional and passed directly to the Viostream embed API.
|
|
|
89
89
|
| `startTime` | `string` | Seek to a time (seconds) before playback. |
|
|
90
90
|
| `transcriptDownload` | `boolean` | Allow transcript download. Default: `false`. |
|
|
91
91
|
| `useSettingsMenu` | `boolean` | Enable the settings menu on the control bar. Default: `false`. |
|
|
92
|
+
| `forceAspectRatio` | `number` | Force a specific aspect ratio (e.g. `1.7778` for 16:9). Disables dynamic sizing. Must be a finite positive number; invalid values are ignored. |
|
|
92
93
|
|
|
93
94
|
#### Event Callbacks
|
|
94
95
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
<script lang="ts">
|
|
27
27
|
import { onMount, type Snippet } from 'svelte';
|
|
28
28
|
import Debug from 'debug';
|
|
29
|
-
import { getViostreamApi, wrapRawPlayer } from '@viostream/viostream-player-core';
|
|
29
|
+
import { getViostreamApi, wrapRawPlayer, normalizeForceAspectRatio } from '@viostream/viostream-player-core';
|
|
30
30
|
import type {
|
|
31
31
|
ViostreamEmbedOptions,
|
|
32
32
|
ViostreamPlayer,
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
startTime,
|
|
61
61
|
transcriptDownload,
|
|
62
62
|
useSettingsMenu,
|
|
63
|
+
forceAspectRatio,
|
|
63
64
|
|
|
64
65
|
// Event callbacks
|
|
65
66
|
onplay,
|
|
@@ -139,7 +140,6 @@
|
|
|
139
140
|
debug('onMount publicKey=%s accountKey=%s containerId=%s', publicKey, accountKey, containerId);
|
|
140
141
|
|
|
141
142
|
let destroyed = false;
|
|
142
|
-
const unsubscribers: Array<() => void> = [];
|
|
143
143
|
|
|
144
144
|
async function init() {
|
|
145
145
|
try {
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
|
|
154
154
|
const embedOpts = buildEmbedOptions();
|
|
155
155
|
debug('init: calling api.embed publicKey=%s containerId=%s options=%o', publicKey, containerId, embedOpts);
|
|
156
|
-
const raw: RawViostreamPlayerInstance = api.embed(publicKey, containerId, embedOpts);
|
|
156
|
+
const raw: RawViostreamPlayerInstance = api.embed(publicKey, containerId, embedOpts, normalizeForceAspectRatio(forceAspectRatio));
|
|
157
157
|
debug('init: api.embed returned raw player');
|
|
158
158
|
|
|
159
159
|
const wrappedPlayer = wrapRawPlayer(raw, containerId);
|
|
@@ -169,17 +169,9 @@
|
|
|
169
169
|
isLoading = false;
|
|
170
170
|
debug('init: player set, isLoading -> false publicKey=%s', publicKey);
|
|
171
171
|
|
|
172
|
-
//
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
const handler = getHandler();
|
|
176
|
-
if (handler) {
|
|
177
|
-
const unsub = wrappedPlayer.on(eventName, handler);
|
|
178
|
-
unsubscribers.push(unsub);
|
|
179
|
-
wiredEvents.push(eventName);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
debug('init: event wiring subscribed to [%s]', wiredEvents.join(', '));
|
|
172
|
+
// Event wiring is handled by the $effect block below, which
|
|
173
|
+
// runs reactively when `player` is set and re-wires when
|
|
174
|
+
// callback props change.
|
|
183
175
|
|
|
184
176
|
// Notify consumer that the player is ready
|
|
185
177
|
debug('init: firing onplayerready publicKey=%s', publicKey);
|
|
@@ -199,11 +191,8 @@
|
|
|
199
191
|
init();
|
|
200
192
|
|
|
201
193
|
return () => {
|
|
202
|
-
debug('cleanup publicKey=%s hasPlayer=%s
|
|
194
|
+
debug('cleanup publicKey=%s hasPlayer=%s', publicKey, !!player);
|
|
203
195
|
destroyed = true;
|
|
204
|
-
for (const unsub of unsubscribers) {
|
|
205
|
-
unsub();
|
|
206
|
-
}
|
|
207
196
|
player?.destroy();
|
|
208
197
|
player = undefined;
|
|
209
198
|
};
|
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.8";
|
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.8",
|
|
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.8",
|
|
35
35
|
"debug": "^4.4.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|