@flowplayer/spins 0.7.0 → 0.9.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/README.md +53 -0
- package/dist/index.js +221 -65
- package/dist/types.d.ts +27 -0
- package/package.json +16 -14
package/README.md
CHANGED
|
@@ -130,6 +130,8 @@ interface SpinsConfig {
|
|
|
130
130
|
ui?: number; // UI configuration bitmask
|
|
131
131
|
ima?: PlayerIMAConfig; // IMA ads configuration
|
|
132
132
|
adsFrequency?: number; // Show ads every Nth spin (default: 10)
|
|
133
|
+
closeButton?: boolean; // Render a close button overlay (default: false)
|
|
134
|
+
articleLabel?: string; // Label for article links (default: "Read more")
|
|
133
135
|
share?: ShareConfig; // Share plugin configuration
|
|
134
136
|
consent?: number; // Consent plugin configuration
|
|
135
137
|
plugins?: string[]; // List of plugins to enable
|
|
@@ -198,6 +200,9 @@ spinsContainer.addSpins([
|
|
|
198
200
|
- `detail.spin`: The spin container HTMLElement
|
|
199
201
|
- `detail.index`: Spin index
|
|
200
202
|
|
|
203
|
+
- `CLOSE` - Fired when the user clicks the close button (requires `closeButton: true`)
|
|
204
|
+
- No detail payload — the library does not remove the container; the implementor is responsible for teardown
|
|
205
|
+
|
|
201
206
|
#### Media Events (`mediaEvents`)
|
|
202
207
|
|
|
203
208
|
- `PLAY` - Playback started/resumed
|
|
@@ -207,6 +212,7 @@ spinsContainer.addSpins([
|
|
|
207
212
|
- `CAN_PLAY` - Ready to play
|
|
208
213
|
- `TIME_UPDATE` - Playback position changed
|
|
209
214
|
- `SEEKING` - User seeking
|
|
215
|
+
- `SEEKED` - Seeking completed
|
|
210
216
|
- `ENDED` - Playback ended
|
|
211
217
|
|
|
212
218
|
All media events include:
|
|
@@ -278,6 +284,7 @@ interface SpinsConfig {
|
|
|
278
284
|
ui?: number;
|
|
279
285
|
ima?: PlayerIMAConfig;
|
|
280
286
|
adsFrequency?: number;
|
|
287
|
+
articleLabel?: string;
|
|
281
288
|
share?: ShareConfig;
|
|
282
289
|
consent?: number;
|
|
283
290
|
plugins?: string[];
|
|
@@ -294,6 +301,7 @@ interface SpinItem {
|
|
|
294
301
|
title?: string;
|
|
295
302
|
poster?: string;
|
|
296
303
|
description?: string;
|
|
304
|
+
article_url?: string; // absolute http/https URL rendered as a link pill
|
|
297
305
|
subtitles?: SubtitlesConfig;
|
|
298
306
|
}
|
|
299
307
|
```
|
|
@@ -395,6 +403,51 @@ container.onPlayerEvent(adEvents.AD_COMPLETED, (e) => {
|
|
|
395
403
|
document.body.appendChild(container);
|
|
396
404
|
```
|
|
397
405
|
|
|
406
|
+
### Article Links
|
|
407
|
+
|
|
408
|
+
Each spin can display a link pill (e.g. "Read more") that opens an associated article. Set `article_url` per item and optionally override the label feed-wide with `articleLabel`.
|
|
409
|
+
|
|
410
|
+
```typescript
|
|
411
|
+
const container = createSpins({
|
|
412
|
+
playlist: [
|
|
413
|
+
{
|
|
414
|
+
url: "https://example.com/video1.mp4",
|
|
415
|
+
title: "Breaking news",
|
|
416
|
+
article_url: "https://example.com/article-1",
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
url: "https://example.com/video2.mp4",
|
|
420
|
+
title: "Follow-up story",
|
|
421
|
+
article_url: "https://example.com/article-2",
|
|
422
|
+
},
|
|
423
|
+
],
|
|
424
|
+
token: "your-token",
|
|
425
|
+
articleLabel: "Go to article", // default: "Read more"
|
|
426
|
+
});
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
Only absolute `http`/`https` URLs are accepted. The link renders as a styled pill button above the player controls and opens in a new tab. Customers can restyle it via the `.fp-spin-link` CSS class.
|
|
430
|
+
|
|
431
|
+
### Overlay with Close Button
|
|
432
|
+
|
|
433
|
+
The `closeButton` option is designed for overlay patterns where the player covers part or all of the screen. When clicked, it dispatches a `spins:close` event on the container — the library never removes itself, leaving teardown to the implementor.
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
import { createSpins, spinEvents } from "@flowplayer/spins";
|
|
437
|
+
|
|
438
|
+
const container = createSpins({
|
|
439
|
+
playlist: "your-playlist-id",
|
|
440
|
+
token: "your-token",
|
|
441
|
+
closeButton: true,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
container.addEventListener(spinEvents.CLOSE, () => {
|
|
445
|
+
container.remove();
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
document.body.appendChild(container);
|
|
449
|
+
```
|
|
450
|
+
|
|
398
451
|
### Advertising Configuration
|
|
399
452
|
|
|
400
453
|
```typescript
|