@viostream/viostream-player-svelte 0.1.3 → 0.2.1
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 +11 -57
- package/dist/ViostreamPlayer.svelte +12 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -74,16 +74,21 @@ All embed options are optional and passed directly to the Viostream embed API.
|
|
|
74
74
|
| Prop | Type | Description |
|
|
75
75
|
|---|---|---|
|
|
76
76
|
| `chapters` | `boolean` | Display chapter markers. |
|
|
77
|
-
| `chapterDisplayType` | `'dropdown' \| 'progressbar' \| 'horizontal'` | Chapter display style. |
|
|
78
77
|
| `chapterSlug` | `string` | Seek to a named chapter before playback. |
|
|
79
|
-
| `displayTitle` | `boolean` | Show the video title overlay. |
|
|
80
|
-
| `hlsQualitySelector` | `boolean` | Show the HLS quality selector. |
|
|
78
|
+
| `displayTitle` | `boolean` | Show the video title overlay. Default: `false`. |
|
|
79
|
+
| `hlsQualitySelector` | `boolean` | Show the HLS quality selector. Default: `true`. |
|
|
81
80
|
| `playerKey` | `string` | Override the player theme to use. |
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
81
|
+
| `playerStyle` | `'video' \| 'audio' \| 'audio-poster'` | The player rendering style. Default: `'video'`. |
|
|
82
|
+
| `sharing` | `boolean` | Show sharing controls. Default: `false`. |
|
|
83
|
+
| `skinActive` | `string` | Custom skin active colour (e.g. `'#ff0000'`). Requires `skinCustom: true`. |
|
|
84
|
+
| `skinBackground` | `string` | Custom skin background colour (e.g. `'#000000'`). Requires `skinCustom: true`. |
|
|
85
|
+
| `skinCustom` | `boolean` | Enable a custom skin via the API. Default: `false`. |
|
|
86
|
+
| `skinInactive` | `string` | Custom skin inactive colour (e.g. `'#cccccc'`). Requires `skinCustom: true`. |
|
|
87
|
+
| `speedSelector` | `boolean` | Show playback speed selector. Default: `true`. |
|
|
84
88
|
| `startEndTimespan` | `string` | Play a specific section (e.g. `'10,30'`). |
|
|
85
89
|
| `startTime` | `string` | Seek to a time (seconds) before playback. |
|
|
86
|
-
| `transcriptDownload` | `boolean` | Allow transcript download. |
|
|
90
|
+
| `transcriptDownload` | `boolean` | Allow transcript download. Default: `false`. |
|
|
91
|
+
| `useSettingsMenu` | `boolean` | Enable the settings menu on the control bar. Default: `false`. |
|
|
87
92
|
|
|
88
93
|
#### Event Callbacks
|
|
89
94
|
|
|
@@ -218,36 +223,7 @@ const paused = await player.getPaused(); // boolean
|
|
|
218
223
|
const duration = await player.getDuration(); // number (seconds)
|
|
219
224
|
const muted = await player.getMuted(); // boolean
|
|
220
225
|
const ratio = await player.getAspectRatio(); // number
|
|
221
|
-
const liveTime = await player.getLiveCurrentTime(); // number (seconds)
|
|
222
226
|
const height = await player.getHeight(); // number (pixels)
|
|
223
|
-
const tracks = await player.getTracks(); // ViostreamTrack[]
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Track Management
|
|
227
|
-
|
|
228
|
-
```ts
|
|
229
|
-
const tracks = await player.getTracks();
|
|
230
|
-
player.setTrack(tracks[0]); // pass a ViostreamTrack object
|
|
231
|
-
player.setTrack('en'); // or a track id string
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Cue Management
|
|
235
|
-
|
|
236
|
-
```ts
|
|
237
|
-
player.cueAdd({ startTime: 10, text: 'Introduction' });
|
|
238
|
-
|
|
239
|
-
player.cueUpdate(
|
|
240
|
-
{ startTime: 10, text: 'Introduction' },
|
|
241
|
-
{ text: 'Updated Introduction' }
|
|
242
|
-
);
|
|
243
|
-
|
|
244
|
-
player.cueDelete('cue-id');
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
### Automatic Speech Recognition (ASR)
|
|
248
|
-
|
|
249
|
-
```ts
|
|
250
|
-
player.asrAdd(cueArray, 'asr-track-id');
|
|
251
227
|
```
|
|
252
228
|
|
|
253
229
|
### Events
|
|
@@ -304,19 +280,6 @@ After calling `destroy()`:
|
|
|
304
280
|
- All event listeners are removed.
|
|
305
281
|
- The player iframe is removed from the DOM.
|
|
306
282
|
- Getter calls will reject with `"Player has been destroyed"`.
|
|
307
|
-
- `player.raw` returns `undefined`.
|
|
308
|
-
|
|
309
|
-
### Raw Escape Hatch
|
|
310
|
-
|
|
311
|
-
If you need direct access to the underlying Viostream player instance:
|
|
312
|
-
|
|
313
|
-
```ts
|
|
314
|
-
const raw = player.raw; // RawViostreamPlayerInstance | undefined
|
|
315
|
-
if (raw) {
|
|
316
|
-
raw.getVolume((vol) => console.log(vol)); // callback-based original API
|
|
317
|
-
}
|
|
318
|
-
```
|
|
319
|
-
|
|
320
283
|
---
|
|
321
284
|
|
|
322
285
|
## Script Loader
|
|
@@ -354,12 +317,7 @@ import type {
|
|
|
354
317
|
ViostreamProgressData,
|
|
355
318
|
ViostreamPlayerEventMap,
|
|
356
319
|
ViostreamEventHandler,
|
|
357
|
-
ViostreamCue,
|
|
358
|
-
ViostreamCueFieldUpdate,
|
|
359
|
-
ViostreamTrack,
|
|
360
320
|
CreateViostreamPlayerOptions,
|
|
361
|
-
RawViostreamPlayerInstance,
|
|
362
|
-
ViostreamGlobal
|
|
363
321
|
} from 'viostream-player-svelte';
|
|
364
322
|
```
|
|
365
323
|
|
|
@@ -422,10 +380,6 @@ A complete example showing the component with custom controls, event logging, an
|
|
|
422
380
|
const vol = await player?.getVolume();
|
|
423
381
|
log = [`volume: ${vol}`, ...log];
|
|
424
382
|
}}>Get Volume</button>
|
|
425
|
-
<button onclick={async () => {
|
|
426
|
-
const tracks = await player?.getTracks();
|
|
427
|
-
log = [`tracks: ${JSON.stringify(tracks)}`, ...log];
|
|
428
|
-
}}>Get Tracks</button>
|
|
429
383
|
</div>
|
|
430
384
|
|
|
431
385
|
<pre>{log.join('\n')}</pre>
|
|
@@ -41,16 +41,21 @@
|
|
|
41
41
|
|
|
42
42
|
// Embed options
|
|
43
43
|
chapters,
|
|
44
|
-
chapterDisplayType,
|
|
45
44
|
chapterSlug,
|
|
46
45
|
displayTitle,
|
|
47
46
|
hlsQualitySelector,
|
|
48
47
|
playerKey,
|
|
48
|
+
playerStyle,
|
|
49
49
|
sharing,
|
|
50
|
+
skinActive,
|
|
51
|
+
skinBackground,
|
|
52
|
+
skinCustom,
|
|
53
|
+
skinInactive,
|
|
50
54
|
speedSelector,
|
|
51
55
|
startEndTimespan,
|
|
52
56
|
startTime,
|
|
53
57
|
transcriptDownload,
|
|
58
|
+
useSettingsMenu,
|
|
54
59
|
|
|
55
60
|
// Event callbacks
|
|
56
61
|
onplay,
|
|
@@ -94,16 +99,21 @@
|
|
|
94
99
|
function buildEmbedOptions(): ViostreamEmbedOptions {
|
|
95
100
|
const opts: ViostreamEmbedOptions = {};
|
|
96
101
|
if (chapters !== undefined) opts.chapters = chapters;
|
|
97
|
-
if (chapterDisplayType !== undefined) opts.chapterDisplayType = chapterDisplayType;
|
|
98
102
|
if (chapterSlug !== undefined) opts.chapterSlug = chapterSlug;
|
|
99
103
|
if (displayTitle !== undefined) opts.displayTitle = displayTitle;
|
|
100
104
|
if (hlsQualitySelector !== undefined) opts.hlsQualitySelector = hlsQualitySelector;
|
|
101
105
|
if (playerKey !== undefined) opts.playerKey = playerKey;
|
|
106
|
+
if (playerStyle !== undefined) opts.playerStyle = playerStyle;
|
|
102
107
|
if (sharing !== undefined) opts.sharing = sharing;
|
|
108
|
+
if (skinActive !== undefined) opts.skinActive = skinActive;
|
|
109
|
+
if (skinBackground !== undefined) opts.skinBackground = skinBackground;
|
|
110
|
+
if (skinCustom !== undefined) opts.skinCustom = skinCustom;
|
|
111
|
+
if (skinInactive !== undefined) opts.skinInactive = skinInactive;
|
|
103
112
|
if (speedSelector !== undefined) opts.speedSelector = speedSelector;
|
|
104
113
|
if (startEndTimespan !== undefined) opts.startEndTimespan = startEndTimespan;
|
|
105
114
|
if (startTime !== undefined) opts.startTime = startTime;
|
|
106
115
|
if (transcriptDownload !== undefined) opts.transcriptDownload = transcriptDownload;
|
|
116
|
+
if (useSettingsMenu !== undefined) opts.useSettingsMenu = useSettingsMenu;
|
|
107
117
|
return opts;
|
|
108
118
|
}
|
|
109
119
|
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,6 @@
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export { default as ViostreamPlayer } from './ViostreamPlayer.svelte';
|
|
36
|
-
export { createViostreamPlayer,
|
|
37
|
-
export type { CreateViostreamPlayerOptions, ViostreamEmbedOptions, ViostreamTimeUpdateData, ViostreamVolumeChangeData, ViostreamErrorData, ViostreamProgressData, ViostreamPlayerEventMap, ViostreamEventHandler,
|
|
36
|
+
export { createViostreamPlayer, loadViostream, } from '@viostream/viostream-player-core';
|
|
37
|
+
export type { CreateViostreamPlayerOptions, ViostreamEmbedOptions, ViostreamTimeUpdateData, ViostreamVolumeChangeData, ViostreamErrorData, ViostreamProgressData, ViostreamPlayerEventMap, ViostreamEventHandler, ViostreamPlayer as ViostreamPlayerInstance, } from '@viostream/viostream-player-core';
|
|
38
38
|
export type { ViostreamPlayerProps, ViostreamPlayerEventProps, } from './types.js';
|
package/dist/index.js
CHANGED
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
// Component
|
|
36
36
|
export { default as ViostreamPlayer } from './ViostreamPlayer.svelte';
|
|
37
37
|
// Re-export everything from core so consumers can import from this package
|
|
38
|
-
export { createViostreamPlayer,
|
|
38
|
+
export { createViostreamPlayer, loadViostream, } from '@viostream/viostream-player-core';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viostream/viostream-player-svelte",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"!dist/**/*.spec.*"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@viostream/viostream-player-core": "^0.1
|
|
33
|
+
"@viostream/viostream-player-core": "^0.2.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"svelte": "^5.0.0"
|