@flowplayer/spins 0.1.0-rc.10 → 0.1.0-rc.11

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 CHANGED
@@ -3,13 +3,12 @@
3
3
  A TypeScript library for creating Flowplayer playlist components optimized for short-form video content like Reels and Shorts.
4
4
 
5
5
  ```typescript
6
- import { spins } from "@flowplayer/spins";
6
+ import { createSpins } from "@flowplayer/spins";
7
7
 
8
- const spinsContainer = spins({
8
+ const spinsContainer = createSpins({
9
9
  playlist: "your-playlist-id",
10
10
  token: "your-token",
11
11
  lang: "en",
12
- ui: { theme: "minimal" }
13
12
  });
14
13
  document.body.appendChild(spinsContainer);
15
14
  ```
@@ -17,7 +16,7 @@ document.body.appendChild(spinsContainer);
17
16
  ### React Usage
18
17
 
19
18
  ```tsx
20
- import { spins, type SpinsConfig } from "@flowplayer/spins";
19
+ import { createSpins, type SpinsConfig } from "@flowplayer/spins";
21
20
  import { useEffect, useRef } from "react";
22
21
 
23
22
  function SpinsPlayer({ playlistId }: { playlistId: string }) {
@@ -25,11 +24,10 @@ function SpinsPlayer({ playlistId }: { playlistId: string }) {
25
24
 
26
25
  useEffect(() => {
27
26
  if (containerRef.current) {
28
- const spinsContainer = spins({
27
+ const spinsContainer = createSpins({
29
28
  playlist: playlistId,
30
29
  token: "your-token",
31
30
  lang: "en",
32
- ui: { theme: "minimal" }
33
31
  });
34
32
  containerRef.current.appendChild(spinsContainer);
35
33
  }
@@ -63,11 +61,9 @@ import { spins, type SpinsConfig } from "@flowplayer/spins";
63
61
 
64
62
  // Create a playlist component for short-form content
65
63
  const config: SpinsConfig = {
66
- playlist: "your-playlist-id", // or array of SpinConfig objects
64
+ playlist: "your-playlist-id", // or array of SpinItem objects
67
65
  token: "your-flowplayer-token",
68
- lang: "en",
69
- ui: { theme: "minimal" },
70
- autoplay: 1
66
+ lang: "en"
71
67
  };
72
68
 
73
69
  const spinsContainer = spins(config);
@@ -86,7 +82,7 @@ The component automatically handles playlist loading and provides the structure
86
82
 
87
83
  ## API Reference
88
84
 
89
- ### `spins(config: SpinsConfig): SpinsContainer`
85
+ ### `createSpins(config: SpinsConfig): SpinsContainer`
90
86
 
91
87
  Creates a Flowplayer playlist component container optimized for short-form video content.
92
88
 
@@ -95,17 +91,12 @@ Creates a Flowplayer playlist component container optimized for short-form video
95
91
  - `config.playlist: string | Array<SpinConfig>` - The playlist ID or array of spin configurations
96
92
  - `config.token: string` - Your Flowplayer token
97
93
  - `config.lang: string` - Language code (e.g., "en", "es")
98
- - `config.ui: object` - UI configuration options
99
- - `config.autoplay?: 0 | 1` - Enable/disable autoplay (optional)
100
- - `config.hls?: HLSConfig` - HLS-specific configuration (optional)
101
- - `config.ima?: PlayerIMAConfig` - IMA ads configuration (optional)
102
94
 
103
95
  #### Returns
104
96
 
105
- Returns a `SpinsContainer` (extends `HTMLDivElement`) with event handling capabilities:
97
+ Returns a `SpinsContainer` (extends `HTMLElement`) with event handling capabilities:
106
98
  - `on(event, handler)` - Subscribe to events
107
99
  - `off(event, handler)` - Unsubscribe from events
108
- - `emit(event, data)` - Emit custom events (internal use)
109
100
 
110
101
  #### Events
111
102
 
@@ -124,7 +115,7 @@ The function gracefully handles:
124
115
  The library exports TypeScript types for full type safety:
125
116
 
126
117
  ```typescript
127
- import { type SpinsConfig, type SpinConfig, type SpinsContainer } from "@flowplayer/spins";
118
+ import { type SpinsConfig, type SpinItem, type SpinsContainer } from "@flowplayer/spins";
128
119
  ```
129
120
 
130
121
  ### `SpinsConfig`
@@ -133,38 +124,29 @@ The main configuration interface:
133
124
 
134
125
  ```typescript
135
126
  interface SpinsConfig {
136
- playlist: string | Array<SpinConfig>;
127
+ playlist: string | Array<SpinItem>;
137
128
  token: string;
138
129
  lang: string;
139
- ui: Config["ui"];
140
- autoplay?: 0 | 1;
141
- hls?: HLSConfig["hls"];
142
- ima?: PlayerIMAConfig;
143
130
  }
144
131
  ```
145
132
 
146
- ### `SpinConfig`
133
+ ### `SpinItem`
147
134
 
148
135
  Individual spin configuration:
149
136
 
150
137
  ```typescript
151
- interface SpinConfig {
138
+ interface SpinItem {
152
139
  src: Config["src"];
153
140
  title?: string;
154
141
  poster?: string;
155
142
  description?: string;
156
143
  subtitles?: SubtitlesConfig["subtitles"];
157
- thumbnails: ThumbnailsConfig["thumbnails"];
158
- ima?: PlayerIMAConfig;
159
144
  }
160
145
  ```
161
146
 
162
147
  ## CSS Styling
163
148
 
164
149
  The component includes default CSS styling optimized for short-form video content. Styles are imported from:
165
- - `@flowplayer/spins/dist/spins.css` - Component-specific styles
166
- - Flowplayer CDN - Base player styles loaded automatically
167
-
168
150
  You can override styles by targeting the spins container and its children:
169
151
 
170
152
  ```css