@flowplayer/spins 0.5.0 → 0.6.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 +7 -36
- package/dist/index.js +28 -31
- package/dist/types.d.ts +176 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ Creates a Flowplayer playlist component container optimized for short-form video
|
|
|
88
88
|
|
|
89
89
|
#### Parameters
|
|
90
90
|
|
|
91
|
-
- `config.playlist: string | Array<
|
|
91
|
+
- `config.playlist: string | Array<SpinItem>` - The playlist ID or array of spin configurations
|
|
92
92
|
- `config.token: string` - Your Flowplayer token
|
|
93
93
|
- `config.lang: string` - Language code (e.g., "en", "es")
|
|
94
94
|
|
|
@@ -97,19 +97,13 @@ Creates a Flowplayer playlist component container optimized for short-form video
|
|
|
97
97
|
Returns a `SpinsContainer` (extends `HTMLElement`) with event handling capabilities:
|
|
98
98
|
- `on(event, handler)` - Subscribe to events
|
|
99
99
|
- `off(event, handler)` - Unsubscribe from events
|
|
100
|
+
- `addSpins(spins: SpinItem[])` - Adds more spins dynamically
|
|
100
101
|
|
|
101
102
|
#### Events
|
|
102
103
|
|
|
103
104
|
- `SPIN_CREATED` - Fired when a new spin is created
|
|
104
105
|
- `SPIN_IN_VIEWPORT` - Fired when a spin enters the viewport
|
|
105
106
|
|
|
106
|
-
#### Error Handling
|
|
107
|
-
|
|
108
|
-
The function gracefully handles:
|
|
109
|
-
- Network errors (API unavailable, timeout, etc.)
|
|
110
|
-
- Invalid playlist configurations
|
|
111
|
-
- HTTP errors (404, 500, etc.)
|
|
112
|
-
|
|
113
107
|
## TypeScript Support
|
|
114
108
|
|
|
115
109
|
The library exports TypeScript types for full type safety:
|
|
@@ -136,11 +130,10 @@ Individual spin configuration:
|
|
|
136
130
|
|
|
137
131
|
```typescript
|
|
138
132
|
interface SpinItem {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
subtitles?: SubtitlesConfig["subtitles"];
|
|
133
|
+
url: string | { src: string; type: string }
|
|
134
|
+
title?: string
|
|
135
|
+
poster?: string
|
|
136
|
+
description?: string
|
|
144
137
|
}
|
|
145
138
|
```
|
|
146
139
|
|
|
@@ -150,7 +143,7 @@ The component includes default CSS styling optimized for short-form video conten
|
|
|
150
143
|
You can override styles by targeting the spins container and its children:
|
|
151
144
|
|
|
152
145
|
```css
|
|
153
|
-
.spins-container {
|
|
146
|
+
.fp-spins-container {
|
|
154
147
|
/* Base spins container styles */
|
|
155
148
|
}
|
|
156
149
|
|
|
@@ -166,28 +159,6 @@ flowplayer-spin {
|
|
|
166
159
|
- [Bun](https://bun.sh/) runtime
|
|
167
160
|
- TypeScript 5+
|
|
168
161
|
|
|
169
|
-
### Scripts
|
|
170
|
-
|
|
171
|
-
```bash
|
|
172
|
-
# Development with Storybook
|
|
173
|
-
bun run dev
|
|
174
|
-
|
|
175
|
-
# Build the library
|
|
176
|
-
bun run build
|
|
177
|
-
|
|
178
|
-
# Build TypeScript declarations
|
|
179
|
-
bun run build:dts
|
|
180
|
-
|
|
181
|
-
# Run tests
|
|
182
|
-
bun run test
|
|
183
|
-
|
|
184
|
-
# Lint and format code
|
|
185
|
-
bun run lint
|
|
186
|
-
|
|
187
|
-
# Build Storybook for production
|
|
188
|
-
bun run build-storybook
|
|
189
|
-
```
|
|
190
|
-
|
|
191
162
|
## Contributing
|
|
192
163
|
|
|
193
164
|
This project uses:
|