@videojs/react 10.0.0-beta.30 → 10.0.0-beta.31
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/dist/default/i18n/context.js.map +1 -1
- package/dist/default/i18n/create-i18n.js +3 -1
- package/dist/default/i18n/create-i18n.js.map +1 -1
- package/dist/default/i18n/get-provider-root-props.js +4 -2
- package/dist/default/i18n/get-provider-root-props.js.map +1 -1
- package/dist/default/player/container.js +16 -7
- package/dist/default/player/container.js.map +1 -1
- package/dist/default/presets/audio/minimal-skin.css +39 -7
- package/dist/default/presets/audio/skin.css +31 -7
- package/dist/default/presets/live-audio/minimal-skin.css +39 -7
- package/dist/default/presets/live-audio/skin.css +31 -7
- package/dist/default/presets/live-video/minimal-skin.css +39 -7
- package/dist/default/presets/live-video/minimal-skin.js +4 -1
- package/dist/default/presets/live-video/minimal-skin.js.map +1 -1
- package/dist/default/presets/live-video/minimal-skin.tailwind.js +4 -1
- package/dist/default/presets/live-video/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/presets/live-video/skin.css +31 -7
- package/dist/default/presets/live-video/skin.js +4 -1
- package/dist/default/presets/live-video/skin.js.map +1 -1
- package/dist/default/presets/live-video/skin.tailwind.js +4 -1
- package/dist/default/presets/live-video/skin.tailwind.js.map +1 -1
- package/dist/default/presets/video/minimal-skin.css +39 -7
- package/dist/default/presets/video/minimal-skin.js +27 -11
- package/dist/default/presets/video/minimal-skin.js.map +1 -1
- package/dist/default/presets/video/minimal-skin.tailwind.js +28 -12
- package/dist/default/presets/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/default/presets/video/skin.css +31 -7
- package/dist/default/presets/video/skin.js +27 -11
- package/dist/default/presets/video/skin.js.map +1 -1
- package/dist/default/presets/video/skin.tailwind.js +28 -12
- package/dist/default/presets/video/skin.tailwind.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/button-group.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/button-group.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/menu.js +8 -7
- package/dist/default/skins/dist/default/default/tailwind/components/menu.js.map +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/time.js +1 -1
- package/dist/default/skins/dist/default/default/tailwind/components/time.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/button-group.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/button-group.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/menu.js +8 -7
- package/dist/default/skins/dist/default/minimal/tailwind/components/menu.js.map +1 -1
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js +2 -2
- package/dist/default/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/default/ui/hooks/use-slider.js +1 -2
- package/dist/default/ui/hooks/use-slider.js.map +1 -1
- package/dist/dev/i18n/context.d.ts +3 -1
- package/dist/dev/i18n/context.d.ts.map +1 -1
- package/dist/dev/i18n/context.js.map +1 -1
- package/dist/dev/i18n/create-i18n.d.ts.map +1 -1
- package/dist/dev/i18n/create-i18n.js +3 -1
- package/dist/dev/i18n/create-i18n.js.map +1 -1
- package/dist/dev/i18n/get-provider-root-props.js +4 -2
- package/dist/dev/i18n/get-provider-root-props.js.map +1 -1
- package/dist/dev/player/container.d.ts.map +1 -1
- package/dist/dev/player/container.js +16 -7
- package/dist/dev/player/container.js.map +1 -1
- package/dist/dev/presets/audio/minimal-skin.css +39 -7
- package/dist/dev/presets/audio/skin.css +31 -7
- package/dist/dev/presets/live-audio/minimal-skin.css +39 -7
- package/dist/dev/presets/live-audio/skin.css +31 -7
- package/dist/dev/presets/live-video/minimal-skin.css +39 -7
- package/dist/dev/presets/live-video/minimal-skin.js +4 -1
- package/dist/dev/presets/live-video/minimal-skin.js.map +1 -1
- package/dist/dev/presets/live-video/minimal-skin.tailwind.js +4 -1
- package/dist/dev/presets/live-video/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/presets/live-video/skin.css +31 -7
- package/dist/dev/presets/live-video/skin.js +4 -1
- package/dist/dev/presets/live-video/skin.js.map +1 -1
- package/dist/dev/presets/live-video/skin.tailwind.js +4 -1
- package/dist/dev/presets/live-video/skin.tailwind.js.map +1 -1
- package/dist/dev/presets/video/minimal-skin.css +39 -7
- package/dist/dev/presets/video/minimal-skin.d.ts.map +1 -1
- package/dist/dev/presets/video/minimal-skin.js +27 -11
- package/dist/dev/presets/video/minimal-skin.js.map +1 -1
- package/dist/dev/presets/video/minimal-skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/video/minimal-skin.tailwind.js +28 -12
- package/dist/dev/presets/video/minimal-skin.tailwind.js.map +1 -1
- package/dist/dev/presets/video/skin.css +31 -7
- package/dist/dev/presets/video/skin.d.ts.map +1 -1
- package/dist/dev/presets/video/skin.js +27 -11
- package/dist/dev/presets/video/skin.js.map +1 -1
- package/dist/dev/presets/video/skin.tailwind.d.ts.map +1 -1
- package/dist/dev/presets/video/skin.tailwind.js +28 -12
- package/dist/dev/presets/video/skin.tailwind.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/button-group.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/button-group.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/menu.js +8 -7
- package/dist/dev/skins/dist/default/default/tailwind/components/menu.js.map +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/time.js +1 -1
- package/dist/dev/skins/dist/default/default/tailwind/components/time.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/button-group.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/button-group.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/controls.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/menu.js +8 -7
- package/dist/dev/skins/dist/default/minimal/tailwind/components/menu.js.map +1 -1
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js +2 -2
- package/dist/dev/skins/dist/default/minimal/tailwind/components/time.js.map +1 -1
- package/dist/dev/ui/hooks/use-slider.d.ts.map +1 -1
- package/dist/dev/ui/hooks/use-slider.js +1 -2
- package/dist/dev/ui/hooks/use-slider.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/concepts/media-sources.md +26 -2
- package/docs/concepts/skins.md +48 -16
- package/docs/how-to/customize-skins.md +7933 -50
- package/docs/how-to/i18n-switch-locale.md +27 -0
- package/docs/how-to/installation.md +4 -4
- package/docs/how-to/migrate-from-plyr.md +1 -1
- package/docs/llms.txt +7 -0
- package/docs/reference/cloudflare-video.md +223 -0
- package/docs/reference/dash-video.md +55 -0
- package/docs/reference/feature-metadata.md +3 -1
- package/docs/reference/hls-audio.md +27 -1
- package/docs/reference/hls-video.md +39 -1
- package/docs/reference/hlsjs-video.md +627 -0
- package/docs/reference/native-hls-video.md +41 -0
- package/docs/reference/shaka-video.md +359 -0
- package/docs/reference/spotify-audio.md +188 -0
- package/docs/reference/tiktok-video.md +280 -0
- package/docs/reference/title.md +1 -1
- package/docs/reference/twitch-video.md +211 -0
- package/docs/reference/vimeo-video.md +736 -0
- package/docs/reference/youtube-video.md +339 -0
- package/package.json +8 -8
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
# TikTokVideo
|
|
2
|
+
|
|
3
|
+
Video component that plays TikTok videos through the TikTok embed player
|
|
4
|
+
|
|
5
|
+
Video component that plays TikTok videos through the [TikTok embed player](https://developers.tiktok.com/doc/embed-player). TikTok videos are portrait, and the player won’t draw its chrome below 325×578, so the element starts at that size rather than the usual 300×150.
|
|
6
|
+
|
|
7
|
+
## Load a source
|
|
8
|
+
|
|
9
|
+
`src` takes a TikTok video URL or a raw numeric video id. The `@user/video/<id>` URLs the app hands out, `share/video/<id>` links, and `player/v1/<id>` embed URLs all work.
|
|
10
|
+
|
|
11
|
+
tsx
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<TikTokVideo src="https://www.tiktok.com/@_luwes/video/7527476667770522893" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Controls
|
|
18
|
+
|
|
19
|
+
TikTok always draws part of its own chrome: the center play button, author header, and social rail are always visible. `controls` adds the progress bar and control buttons on top of those. Without `controls`, the element ignores pointer events, so a [player skin](../concepts/skins.md) above it receives every click.
|
|
20
|
+
|
|
21
|
+
## Deferred startup
|
|
22
|
+
|
|
23
|
+
TikTok builds its player lazily: until something starts playback, the embed has no video element, reports a duration of 0, and silently drops commands. The element works around this by starting a muted autoplay and pausing it immediately, so the embed answers play, pause, and seek before the first play.
|
|
24
|
+
|
|
25
|
+
Two settings opt out. `preload="none"` skips the warm-up, leaving the network untouched until the viewer presses play, and the controls inert until then. `controls` hands playback to TikTok’s own chrome instead.
|
|
26
|
+
|
|
27
|
+
## Behavior
|
|
28
|
+
|
|
29
|
+
* Mute works, but there’s no volume control: the embed reports a level but takes no command to set one.
|
|
30
|
+
* No playback rate and no text tracks; captions are toggled with `engine.tiktok.closed_caption`.
|
|
31
|
+
* `poster` and `playsInline` never reach the embed: it always plays inline and draws the video’s own cover image.
|
|
32
|
+
* Changing `controls` or `loop` after the embed is up rebuilds it; rewriting the iframe URL is the only reload TikTok allows.
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Basic Usage
|
|
37
|
+
|
|
38
|
+
App.tsx
|
|
39
|
+
|
|
40
|
+
App.css
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
import { TikTokVideo } from '@videojs/react/media/tiktok-video';
|
|
44
|
+
|
|
45
|
+
export default function BasicUsage() {
|
|
46
|
+
return (
|
|
47
|
+
<div className="tiktok-video">
|
|
48
|
+
<TikTokVideo src="https://www.tiktok.com/@_luwes/video/7527476667770522893" controls />
|
|
49
|
+
</div>
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
```
|
|
54
|
+
/* TikTok videos are portrait: the element floors itself at 325x578. */
|
|
55
|
+
.tiktok-video {
|
|
56
|
+
display: block;
|
|
57
|
+
width: 325px;
|
|
58
|
+
height: 578px;
|
|
59
|
+
margin-inline: auto;
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API Reference
|
|
64
|
+
|
|
65
|
+
### Props
|
|
66
|
+
|
|
67
|
+
Accepts these Video.js-specific props:
|
|
68
|
+
|
|
69
|
+
Prop
|
|
70
|
+
|
|
71
|
+
Type
|
|
72
|
+
|
|
73
|
+
Default
|
|
74
|
+
|
|
75
|
+
Details
|
|
76
|
+
|
|
77
|
+
`autoplay`
|
|
78
|
+
|
|
79
|
+
`boolean`
|
|
80
|
+
|
|
81
|
+
`false`
|
|
82
|
+
|
|
83
|
+
`controls`
|
|
84
|
+
|
|
85
|
+
`boolean`
|
|
86
|
+
|
|
87
|
+
`false`
|
|
88
|
+
|
|
89
|
+
`defaultMuted`
|
|
90
|
+
|
|
91
|
+
`boolean`
|
|
92
|
+
|
|
93
|
+
`false`
|
|
94
|
+
|
|
95
|
+
`loop`
|
|
96
|
+
|
|
97
|
+
`boolean`
|
|
98
|
+
|
|
99
|
+
`false`
|
|
100
|
+
|
|
101
|
+
`muted`
|
|
102
|
+
|
|
103
|
+
`boolean`
|
|
104
|
+
|
|
105
|
+
`false`
|
|
106
|
+
|
|
107
|
+
`playsInline`
|
|
108
|
+
|
|
109
|
+
`boolean`
|
|
110
|
+
|
|
111
|
+
`true`
|
|
112
|
+
|
|
113
|
+
`poster`
|
|
114
|
+
|
|
115
|
+
`string`
|
|
116
|
+
|
|
117
|
+
`''`
|
|
118
|
+
|
|
119
|
+
`preload`
|
|
120
|
+
|
|
121
|
+
`MediaPreloadType`
|
|
122
|
+
|
|
123
|
+
`'metadata'`
|
|
124
|
+
|
|
125
|
+
`source`
|
|
126
|
+
|
|
127
|
+
`TikTokSource | null`
|
|
128
|
+
|
|
129
|
+
`null`
|
|
130
|
+
|
|
131
|
+
▸
|
|
132
|
+
|
|
133
|
+
Description
|
|
134
|
+
|
|
135
|
+
TikTok URL or id in `src`, player params under `engine.tiktok`. Re-derives `src`; equal sources skip reload.
|
|
136
|
+
|
|
137
|
+
`src`
|
|
138
|
+
|
|
139
|
+
`string`
|
|
140
|
+
|
|
141
|
+
`''`
|
|
142
|
+
|
|
143
|
+
### Engine options
|
|
144
|
+
|
|
145
|
+
#### `source.engine.tiktok`
|
|
146
|
+
|
|
147
|
+
Pass [TikTok player parameters](https://developers.tiktok.com/doc/embed-player) under `source.engine.tiktok`, spelled exactly as TikTok spells them, each one `0` or `1`, plus anything TikTok adds next. [Media Sources](../concepts/media-sources.md) covers how engine options fit into a structured source.
|
|
148
|
+
|
|
149
|
+
`autoplay`, `controls`, `loop`, and `muted` come from the props of the same name, so they have no `engine.tiktok` spelling.
|
|
150
|
+
|
|
151
|
+
tsx
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
<TikTokVideo
|
|
155
|
+
source={{
|
|
156
|
+
src: 'https://www.tiktok.com/@_luwes/video/7527476667770522893',
|
|
157
|
+
engine: { tiktok: { closed_caption: 0, rel: 1 } },
|
|
158
|
+
}}
|
|
159
|
+
/>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Option
|
|
163
|
+
|
|
164
|
+
Type
|
|
165
|
+
|
|
166
|
+
Details
|
|
167
|
+
|
|
168
|
+
`closed_caption`
|
|
169
|
+
|
|
170
|
+
`0 | 1`
|
|
171
|
+
|
|
172
|
+
▸
|
|
173
|
+
|
|
174
|
+
Description
|
|
175
|
+
|
|
176
|
+
Show the closed-caption button. Defaults to `1`.
|
|
177
|
+
|
|
178
|
+
`description`
|
|
179
|
+
|
|
180
|
+
`0 | 1`
|
|
181
|
+
|
|
182
|
+
▸
|
|
183
|
+
|
|
184
|
+
Description
|
|
185
|
+
|
|
186
|
+
Show the video description. Defaults to `0`.
|
|
187
|
+
|
|
188
|
+
`fullscreen_button`
|
|
189
|
+
|
|
190
|
+
`0 | 1`
|
|
191
|
+
|
|
192
|
+
▸
|
|
193
|
+
|
|
194
|
+
Description
|
|
195
|
+
|
|
196
|
+
Show the fullscreen button. Defaults to `1`.
|
|
197
|
+
|
|
198
|
+
`music_info`
|
|
199
|
+
|
|
200
|
+
`0 | 1`
|
|
201
|
+
|
|
202
|
+
▸
|
|
203
|
+
|
|
204
|
+
Description
|
|
205
|
+
|
|
206
|
+
Show the track the video uses. Defaults to `0`.
|
|
207
|
+
|
|
208
|
+
`native_context_menu`
|
|
209
|
+
|
|
210
|
+
`0 | 1`
|
|
211
|
+
|
|
212
|
+
▸
|
|
213
|
+
|
|
214
|
+
Description
|
|
215
|
+
|
|
216
|
+
Show the browser's native context menu. Defaults to `1`.
|
|
217
|
+
|
|
218
|
+
`play_button`
|
|
219
|
+
|
|
220
|
+
`0 | 1`
|
|
221
|
+
|
|
222
|
+
▸
|
|
223
|
+
|
|
224
|
+
Description
|
|
225
|
+
|
|
226
|
+
Show the play button. Defaults to `1`.
|
|
227
|
+
|
|
228
|
+
`progress_bar`
|
|
229
|
+
|
|
230
|
+
`0 | 1`
|
|
231
|
+
|
|
232
|
+
▸
|
|
233
|
+
|
|
234
|
+
Description
|
|
235
|
+
|
|
236
|
+
Show the progress bar. Defaults to `1`.
|
|
237
|
+
|
|
238
|
+
`referrerPolicy`
|
|
239
|
+
|
|
240
|
+
`ReferrerPolicy`
|
|
241
|
+
|
|
242
|
+
▸
|
|
243
|
+
|
|
244
|
+
Description
|
|
245
|
+
|
|
246
|
+
`referrerpolicy` for the embed iframe. Not a TikTok player parameter.
|
|
247
|
+
|
|
248
|
+
`rel`
|
|
249
|
+
|
|
250
|
+
`0 | 1`
|
|
251
|
+
|
|
252
|
+
▸
|
|
253
|
+
|
|
254
|
+
Description
|
|
255
|
+
|
|
256
|
+
Draw related videos from TikTok's recommendations (`1`) or the author's own videos (`0`). Defaults to `1`.
|
|
257
|
+
|
|
258
|
+
`timestamp`
|
|
259
|
+
|
|
260
|
+
`0 | 1`
|
|
261
|
+
|
|
262
|
+
▸
|
|
263
|
+
|
|
264
|
+
Description
|
|
265
|
+
|
|
266
|
+
Show the current playback time and duration. Defaults to `1`.
|
|
267
|
+
|
|
268
|
+
`volume_control`
|
|
269
|
+
|
|
270
|
+
`0 | 1`
|
|
271
|
+
|
|
272
|
+
▸
|
|
273
|
+
|
|
274
|
+
Description
|
|
275
|
+
|
|
276
|
+
Show the volume control. Defaults to `1`.
|
|
277
|
+
|
|
278
|
+
### Ref
|
|
279
|
+
|
|
280
|
+
Forwards its ref to the rendered `<iframe>`. The ref is an [HTMLIFrameElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement). Control playback with the component props and player APIs rather than the iframe ref.
|
package/docs/reference/title.md
CHANGED
|
@@ -32,7 +32,7 @@ A title can come from two places. The player uses the first one that has a value
|
|
|
32
32
|
|
|
33
33
|
If neither has a value, there is nothing to show and the title hides itself.
|
|
34
34
|
|
|
35
|
-
The title is player input, not player state, so change it the way you set it in the first place. The store exposes the resolved `title` to read, and nothing to write.
|
|
35
|
+
The title is player input, not player state, so change it the way you set it in the first place. The store exposes the resolved `title` to read, and nothing to write. That resolution belongs to the [metadata feature](./feature-metadata.md), which the video and audio presets include.
|
|
36
36
|
|
|
37
37
|
tsx
|
|
38
38
|
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
# TwitchVideo
|
|
2
|
+
|
|
3
|
+
Video component that plays Twitch videos and live channels through the Twitch embed player
|
|
4
|
+
|
|
5
|
+
Video component that plays Twitch videos and live channels through the [Twitch embed player](https://dev.twitch.tv/docs/embed/video-and-clips/). Twitch’s own chrome stays hidden by default, so it drops into a [player skin](../concepts/skins.md) like any other media component; set `controls` to use Twitch’s UI instead.
|
|
6
|
+
|
|
7
|
+
## Load a source
|
|
8
|
+
|
|
9
|
+
`src` takes a video URL (`twitch.tv/videos/<id>`) or a channel URL (`twitch.tv/<channel>`), with or without the `www.` and `go.` hosts. A channel URL plays the channel’s live stream. Clips (`clips.twitch.tv`) are a different embed and aren’t supported.
|
|
10
|
+
|
|
11
|
+
tsx
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
<TwitchVideo src="https://www.twitch.tv/videos/106400740" />
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Live channels
|
|
18
|
+
|
|
19
|
+
A channel embed behaves like a live media component:
|
|
20
|
+
|
|
21
|
+
* `duration` reports `Infinity` while the stream is live.
|
|
22
|
+
* Seeking is unavailable: the embed exposes no DVR window.
|
|
23
|
+
* The stream going away and coming back dispatch `offline` and `online` events.
|
|
24
|
+
* `loop` never repeats a channel; a live stream doesn’t end.
|
|
25
|
+
|
|
26
|
+
## Parent hostnames
|
|
27
|
+
|
|
28
|
+
Twitch checks the embedding page’s ancestors against a `parent` allowlist and won’t play unless the current page is on it. The element always includes your page’s own hostname, so a plain embed needs no setup. When your player is itself framed by other hostnames, name each of them under `engine.twitch.parent`:
|
|
29
|
+
|
|
30
|
+
tsx
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
<TwitchVideo
|
|
34
|
+
source={{
|
|
35
|
+
src: 'https://www.twitch.tv/videos/106400740',
|
|
36
|
+
engine: { twitch: { parent: ['embed.example.com'] } },
|
|
37
|
+
}}
|
|
38
|
+
/>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Behavior
|
|
42
|
+
|
|
43
|
+
* Volume and mute both work, like a native `<video>`.
|
|
44
|
+
* `playbackRate` is reported but never applied: the embed has no rate command.
|
|
45
|
+
* `loop` restarts a finished video from the top; the embed has no loop parameter.
|
|
46
|
+
* `controls` is read when the embed is built; changing it later doesn’t take effect, since rebuilding the iframe would lose the playback session.
|
|
47
|
+
* Fullscreen targets the iframe, so Twitch’s own chrome shows in fullscreen.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
### Basic Usage
|
|
52
|
+
|
|
53
|
+
App.tsx
|
|
54
|
+
|
|
55
|
+
App.css
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
import { TwitchVideo } from '@videojs/react/media/twitch-video';
|
|
59
|
+
|
|
60
|
+
export default function BasicUsage() {
|
|
61
|
+
return (
|
|
62
|
+
<div className="twitch-video">
|
|
63
|
+
<TwitchVideo src="https://www.twitch.tv/videos/106400740" controls />
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
```
|
|
69
|
+
.twitch-video {
|
|
70
|
+
width: 100%;
|
|
71
|
+
aspect-ratio: 16 / 9;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## API Reference
|
|
76
|
+
|
|
77
|
+
### Props
|
|
78
|
+
|
|
79
|
+
Accepts these Video.js-specific props:
|
|
80
|
+
|
|
81
|
+
Prop
|
|
82
|
+
|
|
83
|
+
Type
|
|
84
|
+
|
|
85
|
+
Default
|
|
86
|
+
|
|
87
|
+
Details
|
|
88
|
+
|
|
89
|
+
`autoplay`
|
|
90
|
+
|
|
91
|
+
`boolean`
|
|
92
|
+
|
|
93
|
+
`false`
|
|
94
|
+
|
|
95
|
+
`controls`
|
|
96
|
+
|
|
97
|
+
`boolean`
|
|
98
|
+
|
|
99
|
+
`false`
|
|
100
|
+
|
|
101
|
+
`defaultMuted`
|
|
102
|
+
|
|
103
|
+
`boolean`
|
|
104
|
+
|
|
105
|
+
`false`
|
|
106
|
+
|
|
107
|
+
`loop`
|
|
108
|
+
|
|
109
|
+
`boolean`
|
|
110
|
+
|
|
111
|
+
`false`
|
|
112
|
+
|
|
113
|
+
`muted`
|
|
114
|
+
|
|
115
|
+
`boolean`
|
|
116
|
+
|
|
117
|
+
`false`
|
|
118
|
+
|
|
119
|
+
`playsInline`
|
|
120
|
+
|
|
121
|
+
`boolean`
|
|
122
|
+
|
|
123
|
+
`true`
|
|
124
|
+
|
|
125
|
+
`poster`
|
|
126
|
+
|
|
127
|
+
`string`
|
|
128
|
+
|
|
129
|
+
`''`
|
|
130
|
+
|
|
131
|
+
`preload`
|
|
132
|
+
|
|
133
|
+
`MediaPreloadType`
|
|
134
|
+
|
|
135
|
+
`'metadata'`
|
|
136
|
+
|
|
137
|
+
`source`
|
|
138
|
+
|
|
139
|
+
`TwitchSource | null`
|
|
140
|
+
|
|
141
|
+
`null`
|
|
142
|
+
|
|
143
|
+
▸
|
|
144
|
+
|
|
145
|
+
Description
|
|
146
|
+
|
|
147
|
+
Twitch VOD or channel URL in `src`, plus embed parameters under `engine.twitch`. Replacing it re-derives `src`.
|
|
148
|
+
|
|
149
|
+
`src`
|
|
150
|
+
|
|
151
|
+
`string`
|
|
152
|
+
|
|
153
|
+
`''`
|
|
154
|
+
|
|
155
|
+
### Engine options
|
|
156
|
+
|
|
157
|
+
#### `source.engine.twitch`
|
|
158
|
+
|
|
159
|
+
Pass [Twitch embed parameters](https://dev.twitch.tv/docs/embed/video-and-clips/) under `source.engine.twitch`, spelled exactly as Twitch spells them, plus anything Twitch adds next. [Media Sources](../concepts/media-sources.md) covers how engine options fit into a structured source.
|
|
160
|
+
|
|
161
|
+
`controls`, `autoplay`, and `muted` come from the props of the same name, and the video or channel comes from `src`, so none of those have an `engine.twitch` spelling.
|
|
162
|
+
|
|
163
|
+
Option
|
|
164
|
+
|
|
165
|
+
Type
|
|
166
|
+
|
|
167
|
+
Details
|
|
168
|
+
|
|
169
|
+
`collection`
|
|
170
|
+
|
|
171
|
+
`string`
|
|
172
|
+
|
|
173
|
+
▸
|
|
174
|
+
|
|
175
|
+
Description
|
|
176
|
+
|
|
177
|
+
Collection to play through, starting from the video named by `src`.
|
|
178
|
+
|
|
179
|
+
`parent`
|
|
180
|
+
|
|
181
|
+
`string | readonly string[]`
|
|
182
|
+
|
|
183
|
+
▸
|
|
184
|
+
|
|
185
|
+
Description
|
|
186
|
+
|
|
187
|
+
Every hostname the embed may be framed by. Twitch checks the frame's ancestors against it and refuses to play when the current page is missing, which is why the page's own hostname is always included on top of this.
|
|
188
|
+
|
|
189
|
+
`referrerPolicy`
|
|
190
|
+
|
|
191
|
+
`ReferrerPolicy`
|
|
192
|
+
|
|
193
|
+
▸
|
|
194
|
+
|
|
195
|
+
Description
|
|
196
|
+
|
|
197
|
+
`referrerpolicy` for the embed iframe. Not a Twitch embed parameter, so it never reaches the URL: the React player applies it to the iframe it renders, and the HTML player reads its own `referrerpolicy` attribute instead.
|
|
198
|
+
|
|
199
|
+
`time`
|
|
200
|
+
|
|
201
|
+
`string`
|
|
202
|
+
|
|
203
|
+
▸
|
|
204
|
+
|
|
205
|
+
Description
|
|
206
|
+
|
|
207
|
+
Start position, spelled the way Twitch spells timestamps: `1h30m10s`.
|
|
208
|
+
|
|
209
|
+
### Ref
|
|
210
|
+
|
|
211
|
+
Forwards its ref to the rendered `<iframe>`. The ref is an [HTMLIFrameElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement). Control playback with the component props and player APIs rather than the iframe ref.
|