@flowplayer/spins 0.8.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 +52 -0
- package/dist/index.js +221 -65
- package/dist/types.d.ts +25 -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
|
|
@@ -279,6 +284,7 @@ interface SpinsConfig {
|
|
|
279
284
|
ui?: number;
|
|
280
285
|
ima?: PlayerIMAConfig;
|
|
281
286
|
adsFrequency?: number;
|
|
287
|
+
articleLabel?: string;
|
|
282
288
|
share?: ShareConfig;
|
|
283
289
|
consent?: number;
|
|
284
290
|
plugins?: string[];
|
|
@@ -295,6 +301,7 @@ interface SpinItem {
|
|
|
295
301
|
title?: string;
|
|
296
302
|
poster?: string;
|
|
297
303
|
description?: string;
|
|
304
|
+
article_url?: string; // absolute http/https URL rendered as a link pill
|
|
298
305
|
subtitles?: SubtitlesConfig;
|
|
299
306
|
}
|
|
300
307
|
```
|
|
@@ -396,6 +403,51 @@ container.onPlayerEvent(adEvents.AD_COMPLETED, (e) => {
|
|
|
396
403
|
document.body.appendChild(container);
|
|
397
404
|
```
|
|
398
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
|
+
|
|
399
451
|
### Advertising Configuration
|
|
400
452
|
|
|
401
453
|
```typescript
|