@scarlett-player/embed 1.7.0 → 1.8.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 +152 -26
- package/dist/create-embed.d.ts +76 -0
- package/dist/create-embed.d.ts.map +1 -0
- package/dist/{hls2.js → embed.audio.index.js} +1 -1
- package/dist/embed.audio.index.js.map +1 -0
- package/dist/embed.audio.js +702 -45
- package/dist/embed.audio.js.map +1 -1
- package/dist/embed.audio.umd.cjs +1 -1
- package/dist/embed.audio.umd.cjs.map +1 -1
- package/dist/embed.js +2855 -116
- package/dist/embed.js.map +1 -1
- package/dist/embed.umd.cjs +1 -1
- package/dist/embed.umd.cjs.map +1 -1
- package/dist/embed.video.js +2885 -147
- package/dist/embed.video.js.map +1 -1
- package/dist/embed.video.umd.cjs +1 -1
- package/dist/embed.video.umd.cjs.map +1 -1
- package/dist/hls.light.js +21849 -0
- package/dist/hls.light.js.map +1 -0
- package/dist/index-audio.d.ts +21 -0
- package/dist/index-audio.d.ts.map +1 -0
- package/dist/index-video.d.ts +20 -0
- package/dist/index-video.d.ts.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/parser.d.ts +15 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/types.d.ts +180 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/iframe.html +54 -13
- package/package.json +20 -17
- package/dist/hls2.js.map +0 -1
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ Standalone, CDN-ready embed package for Scarlett Player. Drop in a single `<scri
|
|
|
11
11
|
- **Multi-tenant Ready** - Brand customization via data attributes
|
|
12
12
|
- **Unified API** - Single API for video, audio, and compact audio players
|
|
13
13
|
- **iframe Support** - Helper page for URL-based iframe embeds
|
|
14
|
+
- **Sharing** - Opt-in share button on video: OS share sheet, copy link, embed code
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
16
17
|
|
|
@@ -35,6 +36,34 @@ npm install @scarlett-player/embed
|
|
|
35
36
|
pnpm add @scarlett-player/embed
|
|
36
37
|
```
|
|
37
38
|
|
|
39
|
+
## Supported sources
|
|
40
|
+
|
|
41
|
+
Every build registers two providers and picks the first one that accepts the
|
|
42
|
+
source URL, by file extension:
|
|
43
|
+
|
|
44
|
+
| Source | Provider | Extensions |
|
|
45
|
+
|--------|----------|------------|
|
|
46
|
+
| HLS | hls.js, or the browser's own HLS in Safari | `.m3u8` |
|
|
47
|
+
| Progressive video | native `<video>` element | `.mp4`, `.m4v`, `.webm`, `.mov`, `.mkv`, `.ogv` |
|
|
48
|
+
| Progressive audio | native media element | `.mp3`, `.m4a`, `.aac`, `.wav`, `.ogg`, `.opus`, `.flac`, `.weba` |
|
|
49
|
+
|
|
50
|
+
HLS always wins for `.m3u8`. The native provider also asks the browser whether
|
|
51
|
+
it can play the format before claiming a source, so an `.mkv` in a browser
|
|
52
|
+
without Matroska support is declined rather than played into a black frame.
|
|
53
|
+
|
|
54
|
+
Before 1.7.1 no embed build registered the native provider at all, and any
|
|
55
|
+
non-HLS source failed with `PROVIDER_NOT_FOUND`. If you are on an older build,
|
|
56
|
+
upgrade rather than working around it.
|
|
57
|
+
|
|
58
|
+
### Audio build: hls.js/light
|
|
59
|
+
|
|
60
|
+
`embed.audio.js` / `embed.audio.umd.cjs` build on `hls.js/light`, which drops
|
|
61
|
+
in-stream subtitle parsing, ID3 tag parsing and EME/DRM in exchange for a much
|
|
62
|
+
smaller bundle. The audio build ships no captions plugin and audio embeds are
|
|
63
|
+
not DRM sources, so **ID3 timed metadata is the one capability an audio embed
|
|
64
|
+
gives up**. If you need ID3 (in-stream "now playing" updates on a live audio
|
|
65
|
+
stream, typically), use the Full build.
|
|
66
|
+
|
|
38
67
|
## Usage
|
|
39
68
|
|
|
40
69
|
### 1. Declarative (Data Attributes)
|
|
@@ -54,7 +83,7 @@ The simplest way to embed a player. Just add the script and use data attributes:
|
|
|
54
83
|
data-src="https://example.com/stream.m3u8"
|
|
55
84
|
></div>
|
|
56
85
|
|
|
57
|
-
<!-- Audio player -->
|
|
86
|
+
<!-- Audio player (HLS) -->
|
|
58
87
|
<div
|
|
59
88
|
data-scarlett-player
|
|
60
89
|
data-src="https://example.com/podcast.m3u8"
|
|
@@ -63,6 +92,16 @@ The simplest way to embed a player. Just add the script and use data attributes:
|
|
|
63
92
|
data-artist="My Podcast"
|
|
64
93
|
></div>
|
|
65
94
|
|
|
95
|
+
<!-- Audio player (progressive MP3 file) -->
|
|
96
|
+
<div
|
|
97
|
+
data-scarlett-player
|
|
98
|
+
data-src="https://example.com/episode-42.mp3"
|
|
99
|
+
data-type="audio"
|
|
100
|
+
data-title="Episode 42: Deep Dive"
|
|
101
|
+
data-artist="My Podcast"
|
|
102
|
+
data-artwork="https://example.com/podcast-cover.jpg"
|
|
103
|
+
></div>
|
|
104
|
+
|
|
66
105
|
<!-- Compact audio player -->
|
|
67
106
|
<div
|
|
68
107
|
data-scarlett-player
|
|
@@ -90,13 +129,15 @@ The simplest way to embed a player. Just add the script and use data attributes:
|
|
|
90
129
|
|
|
91
130
|
| Attribute | Type | Default | Description |
|
|
92
131
|
|-----------|------|---------|-------------|
|
|
93
|
-
| `data-src` | string | **required** | Media source URL
|
|
132
|
+
| `data-src` | string | **required** | Media source URL. HLS (`.m3u8`) or a progressive file, see [Supported sources](#supported-sources) |
|
|
94
133
|
| `data-type` | string | `video` | Player type: `video`, `audio`, or `audio-mini` |
|
|
95
134
|
| `data-autoplay` | boolean | `false` | Auto-play on load |
|
|
96
135
|
| `data-muted` | boolean | `false` | Start muted |
|
|
97
136
|
| `data-poster` | string | - | Poster/artwork image URL |
|
|
98
137
|
| `data-controls` | boolean | `true` | Show/hide UI controls |
|
|
99
|
-
| `data-
|
|
138
|
+
| `data-big-play-button` | boolean | `true` | Centred play button over the poster (video only). Set `false` when your page draws its own play affordance |
|
|
139
|
+
| `data-gestures` | boolean | `true` | Touch gestures on the picture (video only): double-tap the sides to seek, tap to toggle the controls. Touch only, by input type, so a mouse never triggers them. Set `false` if your page owns those gestures |
|
|
140
|
+
| `data-brand-color` | string | - | Accent color (e.g., `#e50914`). `data-color` is accepted as an alias |
|
|
100
141
|
| `data-primary-color` | string | - | Primary UI color |
|
|
101
142
|
| `data-background-color` | string | - | Control bar background |
|
|
102
143
|
| `data-hide-delay` | number | `3000` | Auto-hide delay (ms) |
|
|
@@ -107,8 +148,9 @@ The simplest way to embed a player. Just add the script and use data attributes:
|
|
|
107
148
|
| `data-loop` | boolean | `false` | Loop playback |
|
|
108
149
|
| `data-playback-rate` | number | `1.0` | Playback speed |
|
|
109
150
|
| `data-start-time` | number | `0` | Start position (seconds) |
|
|
110
|
-
| `data-share-url` | string | - | Canonical page URL for the share plugin. Set this on iframe embeds, or sharing links to the player page instead of yours |
|
|
111
151
|
| `data-class` | string | - | Custom CSS class(es) |
|
|
152
|
+
| `data-share-url` | string | - | Page URL to share. Setting it adds a share button to the video control bar; leaving it out changes nothing. Never the media `src`, see [Sharing](#sharing) |
|
|
153
|
+
| `data-embed-base-url` | string | - | URL of your `iframe.html` deployment. Only read alongside `data-share-url`, and only to enable the `embed` target in the share sheet |
|
|
112
154
|
|
|
113
155
|
#### Audio-specific Attributes
|
|
114
156
|
|
|
@@ -118,6 +160,17 @@ The simplest way to embed a player. Just add the script and use data attributes:
|
|
|
118
160
|
| `data-artist` | string | Artist/creator name |
|
|
119
161
|
| `data-album` | string | Album name |
|
|
120
162
|
| `data-artwork` | string | Album art / cover image URL |
|
|
163
|
+
| `data-playlist` | JSON | Array of `{ src, title?, artist?, poster?, artwork?, duration? }` (Full and Audio builds) |
|
|
164
|
+
|
|
165
|
+
#### Analytics Attributes (Full build)
|
|
166
|
+
|
|
167
|
+
| Attribute | Type | Description |
|
|
168
|
+
|-----------|------|-------------|
|
|
169
|
+
| `data-analytics-beacon-url` | string | Beacon endpoint. Setting it enables the analytics plugin |
|
|
170
|
+
| `data-analytics-video-id` | string | Video identifier sent with every beacon |
|
|
171
|
+
| `data-analytics-api-key` | string | Optional API key |
|
|
172
|
+
|
|
173
|
+
The auto-initializer also accepts `data-sp` in place of `data-scarlett-player`.
|
|
121
174
|
|
|
122
175
|
### 2. Programmatic API
|
|
123
176
|
|
|
@@ -137,6 +190,9 @@ For dynamic player creation:
|
|
|
137
190
|
muted: true,
|
|
138
191
|
brandColor: '#e50914',
|
|
139
192
|
aspectRatio: '16:9',
|
|
193
|
+
// Video only, and optional: omit it to keep the centred play button.
|
|
194
|
+
// false hides it, for a page that draws its own play affordance.
|
|
195
|
+
bigPlayButton: false,
|
|
140
196
|
});
|
|
141
197
|
|
|
142
198
|
// Create audio player
|
|
@@ -149,6 +205,16 @@ For dynamic player creation:
|
|
|
149
205
|
artwork: 'https://example.com/artwork.jpg',
|
|
150
206
|
});
|
|
151
207
|
|
|
208
|
+
// Create audio player from a progressive MP3 file
|
|
209
|
+
const mp3Player = await ScarlettPlayer.create({
|
|
210
|
+
container: '#mp3-player',
|
|
211
|
+
src: 'https://example.com/episode-42.mp3',
|
|
212
|
+
type: 'audio',
|
|
213
|
+
title: 'Episode 42: Deep Dive',
|
|
214
|
+
artist: 'Tech Podcast',
|
|
215
|
+
artwork: 'https://example.com/podcast-cover.jpg',
|
|
216
|
+
});
|
|
217
|
+
|
|
152
218
|
// Create compact audio player
|
|
153
219
|
const miniPlayer = await ScarlettPlayer.create({
|
|
154
220
|
container: '#mini-player',
|
|
@@ -202,15 +268,6 @@ For secure, sandboxed embeds:
|
|
|
202
268
|
allow="autoplay; fullscreen; picture-in-picture"
|
|
203
269
|
></iframe>
|
|
204
270
|
|
|
205
|
-
<!-- Audio player iframe -->
|
|
206
|
-
<iframe
|
|
207
|
-
src="https://assets.thestreamplatform.com/scarlett-player/latest/iframe.html?src=https://example.com/audio.m3u8&type=audio"
|
|
208
|
-
width="100%"
|
|
209
|
-
height="120"
|
|
210
|
-
frameborder="0"
|
|
211
|
-
allow="autoplay"
|
|
212
|
-
></iframe>
|
|
213
|
-
|
|
214
271
|
<!-- With customization -->
|
|
215
272
|
<iframe
|
|
216
273
|
src="https://assets.thestreamplatform.com/scarlett-player/latest/iframe.html?src=https://example.com/stream.m3u8&autoplay=true&muted=true&brand-color=%23e50914"
|
|
@@ -224,29 +281,50 @@ For secure, sandboxed embeds:
|
|
|
224
281
|
|
|
225
282
|
#### iframe URL Parameters
|
|
226
283
|
|
|
227
|
-
|
|
284
|
+
`iframe.html` loads the Full build and reads these URL parameters (kebab-case
|
|
285
|
+
or camelCase):
|
|
228
286
|
- `src` (required)
|
|
229
|
-
- `
|
|
230
|
-
- `
|
|
287
|
+
- `autoplay`, `muted`, `loop` - `true` or `1` to enable
|
|
288
|
+
- `controls` - `false` or `0` to hide the control bar
|
|
231
289
|
- `poster`
|
|
232
290
|
- `brand-color`, `primary-color`, `background-color`
|
|
291
|
+
- `big-play-button` - omit to keep the centred play button, `false` or `0` to hide it
|
|
292
|
+
- `hide-delay`, `playback-rate`, `start-time`
|
|
293
|
+
- `share-url` - the page the viewer should be sent to. Setting it adds the share button; omitting it leaves the control bar unchanged. See [Sharing](#sharing)
|
|
294
|
+
- `embed-base-url` - optional canonical embed URL. Enables the **Embed** snippet target in the share sheet without leaking signed playback parameters
|
|
295
|
+
|
|
296
|
+
`share-url` is the one parameter the player cannot work out for itself. Inside
|
|
297
|
+
the iframe, `window.location.href` is the player page rather than your page, and
|
|
298
|
+
cross-origin rules stop anything reading the parent, so a share would otherwise
|
|
299
|
+
offer a link to the bare embed. Pass `embed-base-url` if you wish to offer an
|
|
300
|
+
`<iframe>` snippet option in the share sheet; omitting it excludes the embed
|
|
301
|
+
target to avoid leaking query parameters (such as signed media URLs) from
|
|
302
|
+
the running iframe.
|
|
303
|
+
|
|
304
|
+
The iframe page always creates a video player: it does not read a `type`
|
|
305
|
+
parameter in this version. For an audio or compact audio embed use the data
|
|
306
|
+
attributes or the programmatic API on your own page.
|
|
233
307
|
|
|
234
308
|
## Player Types
|
|
235
309
|
|
|
236
310
|
### Video Player (default)
|
|
237
311
|
|
|
238
312
|
Standard video player with full controls, fullscreen, picture-in-picture support.
|
|
313
|
+
Takes an HLS manifest or a progressive video file.
|
|
239
314
|
|
|
240
315
|
```html
|
|
241
316
|
<div data-scarlett-player data-src="video.m3u8"></div>
|
|
317
|
+
<div data-scarlett-player data-src="bout-13.mp4"></div>
|
|
242
318
|
```
|
|
243
319
|
|
|
244
320
|
### Audio Player
|
|
245
321
|
|
|
246
|
-
Full-sized audio player with
|
|
322
|
+
Full-sized audio player with album artwork, track info, and media session integration.
|
|
323
|
+
Takes an HLS manifest or a progressive audio file.
|
|
247
324
|
|
|
248
325
|
```html
|
|
249
326
|
<div data-scarlett-player data-src="audio.m3u8" data-type="audio"></div>
|
|
327
|
+
<div data-scarlett-player data-src="episode-42.mp3" data-type="audio"></div>
|
|
250
328
|
```
|
|
251
329
|
|
|
252
330
|
### Compact Audio Player
|
|
@@ -257,6 +335,52 @@ Minimal audio player for space-constrained layouts (64px height).
|
|
|
257
335
|
<div data-scarlett-player data-src="audio.m3u8" data-type="audio-mini"></div>
|
|
258
336
|
```
|
|
259
337
|
|
|
338
|
+
## Sharing
|
|
339
|
+
|
|
340
|
+
Off unless you ask for it. Give the embed the page URL and a share button
|
|
341
|
+
appears in the video control bar; leave it out and the control bar is exactly
|
|
342
|
+
what it has always been.
|
|
343
|
+
|
|
344
|
+
```html
|
|
345
|
+
<div
|
|
346
|
+
data-scarlett-player
|
|
347
|
+
data-src="https://example.com/stream.m3u8"
|
|
348
|
+
data-share-url="https://example.com/watch/abc"
|
|
349
|
+
></div>
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```html
|
|
353
|
+
<iframe
|
|
354
|
+
src="https://assets.thestreamplatform.com/scarlett-player/latest/iframe.html?src=https%3A%2F%2Fexample.com%2Fstream.m3u8&share-url=https%3A%2F%2Fexample.com%2Fwatch%2Fabc"
|
|
355
|
+
width="640" height="360" frameborder="0" allowfullscreen
|
|
356
|
+
allow="autoplay; fullscreen; picture-in-picture"
|
|
357
|
+
></iframe>
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The button opens the OS share sheet on a phone and an in-player sheet
|
|
361
|
+
everywhere else, offering copy link and, where a base URL is known, an embed
|
|
362
|
+
code. Everything it shares carries the current playback position.
|
|
363
|
+
|
|
364
|
+
**What gets shared is `data-share-url`, never `data-src`.** There is no
|
|
365
|
+
fallback, because playback URLs are frequently signed: sharing one would leak a
|
|
366
|
+
credential and hand the recipient a link that expires. That is also why the
|
|
367
|
+
embed cannot supply a default and the button stays off until you pass one.
|
|
368
|
+
|
|
369
|
+
A few limits worth knowing:
|
|
370
|
+
|
|
371
|
+
- **Video only.** The button is a registered control in the video control bar,
|
|
372
|
+
and the audio UIs render a fixed template with no control registry, so
|
|
373
|
+
`data-type="audio"` and `audio-mini` ignore `data-share-url`. The Audio build
|
|
374
|
+
ships no share plugin at all.
|
|
375
|
+
- **Needs the controls.** `data-controls="false"` removes the only way in, so
|
|
376
|
+
sharing is skipped along with the rest of the UI.
|
|
377
|
+
- **The embed code is opt-in separately.** The sheet's **Embed** option needs to
|
|
378
|
+
know where your `iframe.html` lives: pass `data-embed-base-url` (or `embed-base-url`
|
|
379
|
+
in `iframe.html`). Without it the option is left out rather than shown broken.
|
|
380
|
+
|
|
381
|
+
Full configuration (custom targets, icon, analytics hooks) lives in
|
|
382
|
+
[`@scarlett-player/share`](https://github.com/Hackney-Enterprises-Inc/scarlett-player/tree/main/packages/plugins/share).
|
|
383
|
+
|
|
260
384
|
## Multi-Tenant Branding
|
|
261
385
|
|
|
262
386
|
Perfect for The Stream Platform's white-label needs:
|
|
@@ -285,15 +409,15 @@ All builds are available at `https://assets.thestreamplatform.com/scarlett-playe
|
|
|
285
409
|
|
|
286
410
|
| Build | Files | Features |
|
|
287
411
|
|-------|-------|----------|
|
|
288
|
-
| **Full** | `embed.js` / `embed.umd.cjs` | Video + Audio + Analytics + Playlist + Media Session |
|
|
289
|
-
| **Video** | `embed.video.js` / `embed.video.umd.cjs` | Video player only (lightweight) |
|
|
290
|
-
| **Audio** | `embed.audio.js` / `embed.audio.umd.cjs` | Audio + Playlist + Media Session |
|
|
412
|
+
| **Full** | `embed.js` / `embed.umd.cjs` | Video + Audio + Analytics + Playlist + Media Session + Sharing |
|
|
413
|
+
| **Video** | `embed.video.js` / `embed.video.umd.cjs` | Video player only (lightweight), Sharing |
|
|
414
|
+
| **Audio** | `embed.audio.js` / `embed.audio.umd.cjs` | Audio + Playlist + Media Session, on `hls.js/light` (no ID3, no sharing) |
|
|
291
415
|
|
|
292
416
|
**Which build should I use?**
|
|
293
417
|
|
|
294
418
|
- Use **Full** (`embed.umd.cjs`) if you need both video and audio, or want analytics
|
|
295
419
|
- Use **Video** (`embed.video.umd.cjs`) for video-only sites to reduce bundle size
|
|
296
|
-
- Use **Audio** (`embed.audio.umd.cjs`) for audio-only sites (podcasts, music streaming)
|
|
420
|
+
- Use **Audio** (`embed.audio.umd.cjs`) for audio-only sites (podcasts, music streaming). It is built on `hls.js/light`, so it cannot read ID3 timed metadata: see [Audio build: hls.js/light](#audio-build-hlsjslight)
|
|
297
421
|
|
|
298
422
|
**Note:** Using a build without support for a player type will throw an error. For example, using the Video build and setting `data-type="audio"` will fail with a helpful error message.
|
|
299
423
|
|
|
@@ -337,13 +461,14 @@ const options: EmbedPlayerOptions = {
|
|
|
337
461
|
|
|
338
462
|
## Browser Support
|
|
339
463
|
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
- Firefox 88+
|
|
464
|
+
- Chrome / Edge 80+
|
|
465
|
+
- Firefox 78+
|
|
343
466
|
- Safari 14+
|
|
344
467
|
- iOS Safari 14+
|
|
345
468
|
- Android Chrome 90+
|
|
346
469
|
|
|
470
|
+
All three bundles are built for ES2020.
|
|
471
|
+
|
|
347
472
|
## Keyboard Shortcuts
|
|
348
473
|
|
|
349
474
|
When `data-keyboard` is enabled (default):
|
|
@@ -423,8 +548,9 @@ MIT
|
|
|
423
548
|
|
|
424
549
|
## Documentation
|
|
425
550
|
|
|
426
|
-
|
|
427
|
-
- [
|
|
551
|
+
- [Architecture](https://github.com/Hackney-Enterprises-Inc/scarlett-player/blob/main/docs/architecture.md)
|
|
552
|
+
- [Plugin authoring](https://github.com/Hackney-Enterprises-Inc/scarlett-player/blob/main/docs/plugin-authoring.md)
|
|
553
|
+
- Live demo: https://scarlettplayer.com
|
|
428
554
|
|
|
429
555
|
## Support
|
|
430
556
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified embed creator factory
|
|
3
|
+
*
|
|
4
|
+
* This module creates the embed API with configurable plugin availability.
|
|
5
|
+
* Each build (full, video, audio) uses this with different plugin sets.
|
|
6
|
+
*/
|
|
7
|
+
import { ScarlettPlayer, type Plugin } from '@scarlett-player/core';
|
|
8
|
+
import type { EmbedConfig, PlayerType, ScarlettPlayerGlobal } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Plugin creators that builds can provide.
|
|
11
|
+
*
|
|
12
|
+
* `hls` and `native` are the two provider plugins. They are not
|
|
13
|
+
* interchangeable and they are not alternatives: `PluginManager.selectProvider`
|
|
14
|
+
* walks the registered providers in registration order and takes the first
|
|
15
|
+
* whose `canPlay()` accepts the source, so a build that omits `native` answers
|
|
16
|
+
* `PROVIDER_NOT_FOUND` for every progressive file. That was the shipped
|
|
17
|
+
* behaviour up to 1.7.0: an `.mp3` or `.mp4` `data-src` failed in every embed
|
|
18
|
+
* build, including the audio one.
|
|
19
|
+
*/
|
|
20
|
+
export interface PluginCreators {
|
|
21
|
+
hls: () => Plugin;
|
|
22
|
+
/**
|
|
23
|
+
* Native media element provider (progressive MP4/WebM/MOV/MKV/OGV/M4V and
|
|
24
|
+
* MP3/WAV/OGG/FLAC/AAC/M4A/Opus/WebA). Optional so a build can still be
|
|
25
|
+
* assembled without it, but every shipped embed build passes it.
|
|
26
|
+
*/
|
|
27
|
+
native?: () => Plugin;
|
|
28
|
+
videoUI?: (config: any) => Plugin;
|
|
29
|
+
audioUI?: (config: any) => Plugin;
|
|
30
|
+
analytics?: (config: any) => Plugin;
|
|
31
|
+
playlist?: (config: any) => Plugin;
|
|
32
|
+
mediaSession?: (config: any) => Plugin;
|
|
33
|
+
watermark?: (config: any) => Plugin;
|
|
34
|
+
captions?: (config: any) => Plugin;
|
|
35
|
+
/**
|
|
36
|
+
* Touch gestures: double-tap the sides to seek, tap to toggle the controls.
|
|
37
|
+
*
|
|
38
|
+
* Video builds only. The embed passes no config at all, because the plugin
|
|
39
|
+
* decides for itself whether to arm: its `enabled` default is `'auto'`,
|
|
40
|
+
* gated on `matchMedia('(any-pointer: coarse)')`, so it installs wherever a
|
|
41
|
+
* coarse pointer exists (a touchscreen laptop included) and a mouse still
|
|
42
|
+
* never triggers any of it. Forcing `enabled: true` here would instead put a
|
|
43
|
+
* gesture surface on a pure-mouse desktop with no touch to serve.
|
|
44
|
+
*/
|
|
45
|
+
gestures?: (config: any) => Plugin;
|
|
46
|
+
/**
|
|
47
|
+
* Share sheet, copy link and embed codes.
|
|
48
|
+
*
|
|
49
|
+
* Video builds only, and only when the embed was given a share URL. The
|
|
50
|
+
* plugin contributes a control through `registerControl('share')` in
|
|
51
|
+
* `@scarlett-player/ui`, and the audio UIs render a fixed template with no
|
|
52
|
+
* control registry, so an audio player has nowhere to put the button.
|
|
53
|
+
*/
|
|
54
|
+
share?: (config: any) => Plugin;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create an embed player with the given plugins
|
|
58
|
+
*/
|
|
59
|
+
export declare function createEmbedPlayer(container: HTMLElement, config: Partial<EmbedConfig>, pluginCreators: PluginCreators, availableTypes: PlayerType[]): Promise<ScarlettPlayer | null>;
|
|
60
|
+
/**
|
|
61
|
+
* Initialize a player from a DOM element with data attributes
|
|
62
|
+
*/
|
|
63
|
+
export declare function initElement(element: HTMLElement, pluginCreators: PluginCreators, availableTypes: PlayerType[]): Promise<ScarlettPlayer | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Initialize all players on the page
|
|
66
|
+
*/
|
|
67
|
+
export declare function initAll(pluginCreators: PluginCreators, availableTypes: PlayerType[]): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Create the global ScarlettPlayer API
|
|
70
|
+
*/
|
|
71
|
+
export declare function createScarlettPlayerAPI(pluginCreators: PluginCreators, availableTypes: PlayerType[], version: string): ScarlettPlayerGlobal;
|
|
72
|
+
/**
|
|
73
|
+
* Setup auto-initialization on DOMContentLoaded
|
|
74
|
+
*/
|
|
75
|
+
export declare function setupAutoInit(pluginCreators: PluginCreators, availableTypes: PlayerType[]): void;
|
|
76
|
+
//# sourceMappingURL=create-embed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-embed.d.ts","sourceRoot":"","sources":["../src/create-embed.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAgB,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAsB,UAAU,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAGjG;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACvC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;IACnC;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,CAAC;CACjC;AAmCD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,EAC5B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,UAAU,EAAE,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAsKhC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,UAAU,EAAE,GAC3B,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAehC;AAWD;;GAEG;AACH,wBAAsB,OAAO,CAC3B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,UAAU,EAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,UAAU,EAAE,EAC5B,OAAO,EAAE,MAAM,GACd,oBAAoB,CAyBtB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,cAAc,EAAE,cAAc,EAC9B,cAAc,EAAE,UAAU,EAAE,GAC3B,IAAI,CAUN"}
|