@twick/live-player 0.14.0 → 0.14.3
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 +178 -158
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1626 -1589
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1626 -1589
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/LICENSE +0 -197
package/README.md
CHANGED
|
@@ -1,158 +1,178 @@
|
|
|
1
|
-
# @twick/live-player
|
|
2
|
-
|
|
3
|
-
A React component for video playback and control
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
##
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
{
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
###
|
|
141
|
-
|
|
142
|
-
- `
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
- `
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
1
|
+
# @twick/live-player
|
|
2
|
+
|
|
3
|
+
A React component for video playback and control with advanced timeline support.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides a powerful video player component that supports complex timeline-based video playback, custom controls, and real-time rendering of video projects with multiple tracks and elements.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Video playback with custom controls
|
|
12
|
+
- Time tracking and duration management
|
|
13
|
+
- Project data support for complex video configurations
|
|
14
|
+
- Customizable video dimensions
|
|
15
|
+
- Play/pause state management
|
|
16
|
+
- High-performance video rendering
|
|
17
|
+
- Timeline-based element rendering
|
|
18
|
+
- Real-time project updates
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- React 18 or higher
|
|
23
|
+
- Browser environment with HTML5 Video support
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @twick/live-player
|
|
29
|
+
# or
|
|
30
|
+
pnpm add @twick/live-player
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import React, { useState } from "react";
|
|
37
|
+
import projectData from "./sample";
|
|
38
|
+
import { LivePlayer } from "@twick/live-player";
|
|
39
|
+
|
|
40
|
+
function VideoPlayerComp() {
|
|
41
|
+
const [playing, setPlaying] = useState(false);
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div>
|
|
45
|
+
<button onClick={() => setPlaying((prev) => !prev)}>Toggle playback</button>
|
|
46
|
+
<LivePlayer
|
|
47
|
+
projectData={projectData} // Your video project configuration
|
|
48
|
+
videoSize={{
|
|
49
|
+
width: 720,
|
|
50
|
+
height: 1280,
|
|
51
|
+
}}
|
|
52
|
+
playing={playing}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export default VideoPlayerComp;
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Project Data Structure
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"input": {
|
|
66
|
+
"properties": {
|
|
67
|
+
"width": 720,
|
|
68
|
+
"height": 1280
|
|
69
|
+
},
|
|
70
|
+
"timeline": [
|
|
71
|
+
{
|
|
72
|
+
"id": "t-element",
|
|
73
|
+
"type": "element",
|
|
74
|
+
"elements": [
|
|
75
|
+
{
|
|
76
|
+
"id": "e-244f8d5a3baa",
|
|
77
|
+
"type": "rect",
|
|
78
|
+
"s": 0,
|
|
79
|
+
"e": 5,
|
|
80
|
+
"props": {
|
|
81
|
+
"width": 720,
|
|
82
|
+
"height": 1280,
|
|
83
|
+
"fill": "#FFF000"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"name": "element"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"id": "t-element",
|
|
91
|
+
"type": "element",
|
|
92
|
+
"elements": [
|
|
93
|
+
{
|
|
94
|
+
"id": "e-244f8d5a3bba",
|
|
95
|
+
"type": "text",
|
|
96
|
+
"s": 0,
|
|
97
|
+
"e": 1,
|
|
98
|
+
"props": {
|
|
99
|
+
"text": "Hello Guys!",
|
|
100
|
+
"fontSize": 100,
|
|
101
|
+
"fill": "#FF0000"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"id": "e-244f8d5a3bbb",
|
|
106
|
+
"type": "text",
|
|
107
|
+
"s": 1,
|
|
108
|
+
"e": 4,
|
|
109
|
+
"props": {
|
|
110
|
+
"text": "Welcome to the world of Twick!",
|
|
111
|
+
"fontSize": 100,
|
|
112
|
+
"fill": "#FF0000",
|
|
113
|
+
"maxWidth": 500,
|
|
114
|
+
"textAlign": "center",
|
|
115
|
+
"textWrap": true
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
"name": "element"
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"version": 1
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## API Reference
|
|
128
|
+
|
|
129
|
+
### Required Props
|
|
130
|
+
|
|
131
|
+
- `projectData`: Object containing video project configuration
|
|
132
|
+
- `videoSize`: Object specifying video dimensions
|
|
133
|
+
```typescript
|
|
134
|
+
{
|
|
135
|
+
width: number;
|
|
136
|
+
height: number;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Optional Props
|
|
141
|
+
|
|
142
|
+
- `playing`: Boolean to control play/pause state
|
|
143
|
+
- `onDurationChange`: Callback function when video duration changes
|
|
144
|
+
- `onTimeUpdate`: Callback function for time updates during playback
|
|
145
|
+
|
|
146
|
+
### Components
|
|
147
|
+
|
|
148
|
+
- `LivePlayer`: Main video player component
|
|
149
|
+
|
|
150
|
+
### Types
|
|
151
|
+
|
|
152
|
+
- `LivePlayerProps`: Props interface for LivePlayer component
|
|
153
|
+
- `VideoSize`: Interface for video dimensions
|
|
154
|
+
- `ProjectData`: Interface for video project configuration
|
|
155
|
+
|
|
156
|
+
For complete API documentation, refer to the generated documentation.
|
|
157
|
+
|
|
158
|
+
## Browser Support
|
|
159
|
+
|
|
160
|
+
This library requires a browser environment with support for:
|
|
161
|
+
- HTML5 Video
|
|
162
|
+
- Modern JavaScript features (ES2020+)
|
|
163
|
+
|
|
164
|
+
## Documentation
|
|
165
|
+
|
|
166
|
+
For complete documentation, refer to the project documentation site.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
This package is licensed under the **Sustainable Use License (SUL) Version 1.0**.
|
|
171
|
+
|
|
172
|
+
- Free for use in commercial and non-commercial apps
|
|
173
|
+
- Can be modified and self-hosted
|
|
174
|
+
- Cannot be sold, rebranded, or distributed as a standalone SDK
|
|
175
|
+
|
|
176
|
+
For commercial licensing inquiries, contact: contact@kifferai.com
|
|
177
|
+
|
|
178
|
+
For full license terms, see the main LICENSE.md file in the project root.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { generateId } from './helpers/player.utils';
|
|
1
2
|
import { getBaseProject } from './helpers/player.utils';
|
|
2
3
|
import { LivePlayer } from './components/live-player';
|
|
3
4
|
import { LivePlayerProvider } from './context/live-player-context';
|
|
4
5
|
import { PLAYER_STATE } from './helpers/constants';
|
|
5
6
|
import { useLivePlayerContext } from './context/live-player-context';
|
|
6
7
|
|
|
8
|
+
export { generateId }
|
|
9
|
+
|
|
7
10
|
export { getBaseProject }
|
|
8
11
|
|
|
9
12
|
export { LivePlayer }
|