@capgo/capacitor-youtube-player 8.2.0 → 8.2.2
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 +308 -190
- package/dist/docs.json +663 -441
- package/dist/esm/definitions.d.ts +139 -96
- package/dist/esm/web.d.ts +42 -42
- package/dist/esm/web.js +44 -44
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +44 -44
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +44 -44
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/YoutubePlayerPlugin/YoutubePlayerPlugin.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
# @capgo/capacitor-youtube-player
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
<a href="https://capgo.app/">
|
|
4
|
+
<img
|
|
5
|
+
src="https://raw.githubusercontent.com/Cap-go/capgo/main/assets/capgo_banner.png"
|
|
6
|
+
alt="Capgo - Instant updates for capacitor"
|
|
7
|
+
/>
|
|
8
|
+
</a>
|
|
3
9
|
|
|
4
10
|
<div align="center">
|
|
5
|
-
<h2
|
|
6
|
-
|
|
11
|
+
<h2>
|
|
12
|
+
<a href="https://capgo.app/?ref=plugin_youtube_player"> ➡️ Get Instant updates for your App with Capgo</a>
|
|
13
|
+
</h2>
|
|
14
|
+
<h2>
|
|
15
|
+
<a href="https://capgo.app/consulting/?ref=plugin_youtube_player">
|
|
16
|
+
Missing a feature? We’ll build the plugin for you 💪
|
|
17
|
+
</a>
|
|
18
|
+
</h2>
|
|
7
19
|
</div>
|
|
8
20
|
Embed YouTube player controls in Capacitor apps
|
|
9
21
|
|
|
@@ -15,10 +27,10 @@ The most complete doc is available here: https://capgo.app/docs/plugins/youtube-
|
|
|
15
27
|
|
|
16
28
|
| Plugin version | Capacitor compatibility | Maintained |
|
|
17
29
|
| -------------- | ----------------------- | ---------- |
|
|
18
|
-
| v8.\*.\* | v8.\*.\* | ✅
|
|
19
|
-
| v7.\*.\* | v7.\*.\* | On demand
|
|
20
|
-
| v6.\*.\* | v6.\*.\* | ❌
|
|
21
|
-
| v5.\*.\* | v5.\*.\* | ❌
|
|
30
|
+
| v8.\*.\* | v8.\*.\* | ✅ |
|
|
31
|
+
| v7.\*.\* | v7.\*.\* | On demand |
|
|
32
|
+
| v6.\*.\* | v6.\*.\* | ❌ |
|
|
33
|
+
| v5.\*.\* | v5.\*.\* | ❌ |
|
|
22
34
|
|
|
23
35
|
> **Note:** The major version of this plugin follows the major version of Capacitor. Use the version that matches your Capacitor installation (e.g., plugin v8 for Capacitor 8). Only the latest major version is actively maintained.
|
|
24
36
|
|
|
@@ -32,7 +44,9 @@ npx cap sync
|
|
|
32
44
|
## Native Implementation
|
|
33
45
|
|
|
34
46
|
### iOS
|
|
47
|
+
|
|
35
48
|
This plugin uses native **WKWebView** for iOS playback, which provides:
|
|
49
|
+
|
|
36
50
|
- **Fullscreen-only playback mode** for immersive viewing experience
|
|
37
51
|
- Direct YouTube iframe API integration
|
|
38
52
|
- Support for all YouTube iframe API parameters
|
|
@@ -43,7 +57,9 @@ This plugin uses native **WKWebView** for iOS playback, which provides:
|
|
|
43
57
|
**Important:** iOS always plays videos in fullscreen mode for the best user experience.
|
|
44
58
|
|
|
45
59
|
### Android
|
|
60
|
+
|
|
46
61
|
This plugin uses [android-youtube-player](https://github.com/PierfrancescoSoffritti/android-youtube-player) for native Android playback, which provides:
|
|
62
|
+
|
|
47
63
|
- **Modern, actively maintained library**
|
|
48
64
|
- Fullscreen support with immersive mode
|
|
49
65
|
- Direct YouTube iframe API integration
|
|
@@ -51,6 +67,8 @@ This plugin uses [android-youtube-player](https://github.com/PierfrancescoSoffri
|
|
|
51
67
|
- Cookie support via CookieManager
|
|
52
68
|
- **No API key required**
|
|
53
69
|
|
|
70
|
+
> Seeing `com.google.android.youtube.player` build errors? Upgrade to `@capgo/capacitor-youtube-player` **v8.2.0+** and run `npx cap sync android`. The plugin now uses the `android-youtube-player` library instead of the deprecated YouTube Android Player API.
|
|
71
|
+
|
|
54
72
|
**Note:** Uses YouTube's iframe API internally, providing a consistent experience across platforms.
|
|
55
73
|
|
|
56
74
|
## Privacy & GDPR Compliance
|
|
@@ -66,16 +84,18 @@ await YoutubePlayer.initialize({
|
|
|
66
84
|
playerId: 'my-player',
|
|
67
85
|
videoId: 'dQw4w9WgXcQ',
|
|
68
86
|
playerSize: { width: 640, height: 360 },
|
|
69
|
-
privacyEnhanced: true
|
|
87
|
+
privacyEnhanced: true, // Enable privacy-enhanced mode
|
|
70
88
|
});
|
|
71
89
|
```
|
|
72
90
|
|
|
73
91
|
**Important Platform Notes:**
|
|
92
|
+
|
|
74
93
|
- **Web**: The `privacyEnhanced` option uses `youtube-nocookie.com` domain for better privacy
|
|
75
94
|
- **iOS**: Uses native WKWebView for fullscreen-only playback with YouTube iframe API
|
|
76
95
|
- **Android**: Uses android-youtube-player library with YouTube iframe API
|
|
77
96
|
|
|
78
97
|
**For full GDPR compliance, you should also:**
|
|
98
|
+
|
|
79
99
|
- Display a cookie consent banner before loading videos
|
|
80
100
|
- Update your privacy policy to disclose YouTube's data collection
|
|
81
101
|
- Consider implementing a "click to load" placeholder for videos
|
|
@@ -93,16 +113,18 @@ await YoutubePlayer.initialize({
|
|
|
93
113
|
playerId: 'my-player',
|
|
94
114
|
videoId: 'dQw4w9WgXcQ',
|
|
95
115
|
playerSize: { width: 640, height: 360 },
|
|
96
|
-
cookies: 'CONSENT=YES+cb; VISITOR_INFO1_LIVE=xyz123'
|
|
116
|
+
cookies: 'CONSENT=YES+cb; VISITOR_INFO1_LIVE=xyz123', // Your YouTube cookies
|
|
97
117
|
});
|
|
98
118
|
```
|
|
99
119
|
|
|
100
120
|
**Platform Support:**
|
|
121
|
+
|
|
101
122
|
- **Web**: ✅ Cookies are set via `document.cookie` with `SameSite=None; Secure` attributes
|
|
102
123
|
- **iOS**: ✅ Cookies are set in WKWebView's HTTPCookieStore for the `.youtube.com` domain (native WKWebView, fullscreen-only mode)
|
|
103
124
|
- **Android**: ✅ Cookies are set via CookieManager in the WebView for YouTube domains
|
|
104
125
|
|
|
105
126
|
**Important Notes:**
|
|
127
|
+
|
|
106
128
|
- **Cookie Format**: Pass cookies as a semicolon-separated string (e.g., `"name1=value1; name2=value2"`)
|
|
107
129
|
- **Getting Cookies**: You can obtain valid YouTube cookies from your browser's developer tools when signed into YouTube
|
|
108
130
|
- **Security**: All cookies are automatically set with secure attributes (HTTPS only)
|
|
@@ -110,6 +132,7 @@ await YoutubePlayer.initialize({
|
|
|
110
132
|
- **Android**: Uses android-youtube-player library which is based on YouTube's iframe API, so cookies work similarly to the web platform
|
|
111
133
|
|
|
112
134
|
**Common YouTube Cookies:**
|
|
135
|
+
|
|
113
136
|
- `CONSENT`: YouTube consent cookie (helps with GDPR compliance)
|
|
114
137
|
- `VISITOR_INFO1_LIVE`: Visitor tracking cookie
|
|
115
138
|
- `YSC`: YouTube session cookie
|
|
@@ -233,14 +256,14 @@ Initialize a new YouTube player instance.
|
|
|
233
256
|
### destroy(...)
|
|
234
257
|
|
|
235
258
|
```typescript
|
|
236
|
-
destroy(
|
|
259
|
+
destroy(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
237
260
|
```
|
|
238
261
|
|
|
239
262
|
Destroy a player instance and free resources.
|
|
240
263
|
|
|
241
|
-
| Param
|
|
242
|
-
|
|
|
243
|
-
| **`
|
|
264
|
+
| Param | Type | Description |
|
|
265
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
266
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
244
267
|
|
|
245
268
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
246
269
|
|
|
@@ -250,15 +273,15 @@ Destroy a player instance and free resources.
|
|
|
250
273
|
### stopVideo(...)
|
|
251
274
|
|
|
252
275
|
```typescript
|
|
253
|
-
stopVideo(
|
|
276
|
+
stopVideo(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
254
277
|
```
|
|
255
278
|
|
|
256
279
|
Stop video playback and cancel loading.
|
|
257
280
|
Use this sparingly - pauseVideo() is usually preferred.
|
|
258
281
|
|
|
259
|
-
| Param
|
|
260
|
-
|
|
|
261
|
-
| **`
|
|
282
|
+
| Param | Type | Description |
|
|
283
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
284
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
262
285
|
|
|
263
286
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
264
287
|
|
|
@@ -268,15 +291,15 @@ Use this sparingly - pauseVideo() is usually preferred.
|
|
|
268
291
|
### playVideo(...)
|
|
269
292
|
|
|
270
293
|
```typescript
|
|
271
|
-
playVideo(
|
|
294
|
+
playVideo(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
272
295
|
```
|
|
273
296
|
|
|
274
297
|
Play the currently cued or loaded video.
|
|
275
298
|
Final player state will be PLAYING (1).
|
|
276
299
|
|
|
277
|
-
| Param
|
|
278
|
-
|
|
|
279
|
-
| **`
|
|
300
|
+
| Param | Type | Description |
|
|
301
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
302
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
280
303
|
|
|
281
304
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
282
305
|
|
|
@@ -286,15 +309,15 @@ Final player state will be PLAYING (1).
|
|
|
286
309
|
### pauseVideo(...)
|
|
287
310
|
|
|
288
311
|
```typescript
|
|
289
|
-
pauseVideo(
|
|
312
|
+
pauseVideo(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
290
313
|
```
|
|
291
314
|
|
|
292
315
|
Pause the currently playing video.
|
|
293
316
|
Final player state will be PAUSED (2), unless already ENDED (0).
|
|
294
317
|
|
|
295
|
-
| Param
|
|
296
|
-
|
|
|
297
|
-
| **`
|
|
318
|
+
| Param | Type | Description |
|
|
319
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
320
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
298
321
|
|
|
299
322
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
300
323
|
|
|
@@ -304,17 +327,15 @@ Final player state will be PAUSED (2), unless already ENDED (0).
|
|
|
304
327
|
### seekTo(...)
|
|
305
328
|
|
|
306
329
|
```typescript
|
|
307
|
-
seekTo(
|
|
330
|
+
seekTo(options: SeekToOptions) => Promise<{ result: { method: string; value: boolean; seconds: number; allowSeekAhead: boolean; }; }>
|
|
308
331
|
```
|
|
309
332
|
|
|
310
333
|
Seek to a specific time in the video.
|
|
311
334
|
If player is paused, it remains paused. If playing, continues playing.
|
|
312
335
|
|
|
313
|
-
| Param
|
|
314
|
-
|
|
|
315
|
-
| **`
|
|
316
|
-
| **`seconds`** | <code>number</code> | - Time to seek to (in seconds) |
|
|
317
|
-
| **`allowSeekAhead`** | <code>boolean</code> | - Whether to make a new request to server if not buffered |
|
|
336
|
+
| Param | Type | Description |
|
|
337
|
+
| ------------- | ------------------------------------------------------- | --------------------- |
|
|
338
|
+
| **`options`** | <code><a href="#seektooptions">SeekToOptions</a></code> | - Player seek options |
|
|
318
339
|
|
|
319
340
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; seconds: number; allowSeekAhead: boolean; }; }></code>
|
|
320
341
|
|
|
@@ -324,15 +345,14 @@ If player is paused, it remains paused. If playing, continues playing.
|
|
|
324
345
|
### loadVideoById(...)
|
|
325
346
|
|
|
326
347
|
```typescript
|
|
327
|
-
loadVideoById(
|
|
348
|
+
loadVideoById(options: VideoByIdMethodOptions) => Promise<{ result: { method: string; value: boolean; options: IVideoOptionsById; }; }>
|
|
328
349
|
```
|
|
329
350
|
|
|
330
351
|
Load and play a video by its YouTube ID.
|
|
331
352
|
|
|
332
|
-
| Param
|
|
333
|
-
|
|
|
334
|
-
| **`
|
|
335
|
-
| **`options`** | <code><a href="#ivideooptionsbyid">IVideoOptionsById</a></code> | - Video loading options (ID, start time, quality, etc.) |
|
|
353
|
+
| Param | Type | Description |
|
|
354
|
+
| ------------- | ------------------------------------------------------------------------- | ------------------------------------------------------- |
|
|
355
|
+
| **`options`** | <code><a href="#videobyidmethodoptions">VideoByIdMethodOptions</a></code> | - Video loading options (ID, start time, quality, etc.) |
|
|
336
356
|
|
|
337
357
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; options: <a href="#ivideooptionsbyid">IVideoOptionsById</a>; }; }></code>
|
|
338
358
|
|
|
@@ -342,16 +362,15 @@ Load and play a video by its YouTube ID.
|
|
|
342
362
|
### cueVideoById(...)
|
|
343
363
|
|
|
344
364
|
```typescript
|
|
345
|
-
cueVideoById(
|
|
365
|
+
cueVideoById(options: VideoByIdMethodOptions) => Promise<{ result: { method: string; value: boolean; options: IVideoOptionsById; }; }>
|
|
346
366
|
```
|
|
347
367
|
|
|
348
368
|
Cue a video by ID without playing it.
|
|
349
369
|
Loads thumbnail and prepares player, but doesn't request video until playVideo() called.
|
|
350
370
|
|
|
351
|
-
| Param
|
|
352
|
-
|
|
|
353
|
-
| **`
|
|
354
|
-
| **`options`** | <code><a href="#ivideooptionsbyid">IVideoOptionsById</a></code> | - Video cuing options (ID, start time, quality, etc.) |
|
|
371
|
+
| Param | Type | Description |
|
|
372
|
+
| ------------- | ------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
373
|
+
| **`options`** | <code><a href="#videobyidmethodoptions">VideoByIdMethodOptions</a></code> | - Video cuing options (ID, start time, quality, etc.) |
|
|
355
374
|
|
|
356
375
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; options: <a href="#ivideooptionsbyid">IVideoOptionsById</a>; }; }></code>
|
|
357
376
|
|
|
@@ -361,15 +380,14 @@ Loads thumbnail and prepares player, but doesn't request video until playVideo()
|
|
|
361
380
|
### loadVideoByUrl(...)
|
|
362
381
|
|
|
363
382
|
```typescript
|
|
364
|
-
loadVideoByUrl(
|
|
383
|
+
loadVideoByUrl(options: VideoByUrlMethodOptions) => Promise<{ result: { method: string; value: boolean; options: IVideoOptionsByUrl; }; }>
|
|
365
384
|
```
|
|
366
385
|
|
|
367
386
|
Load and play a video by its full URL.
|
|
368
387
|
|
|
369
|
-
| Param
|
|
370
|
-
|
|
|
371
|
-
| **`
|
|
372
|
-
| **`options`** | <code><a href="#ivideooptionsbyurl">IVideoOptionsByUrl</a></code> | - Video loading options including media URL |
|
|
388
|
+
| Param | Type | Description |
|
|
389
|
+
| ------------- | --------------------------------------------------------------------------- | ------------------------------------------- |
|
|
390
|
+
| **`options`** | <code><a href="#videobyurlmethodoptions">VideoByUrlMethodOptions</a></code> | - Video loading options including media URL |
|
|
373
391
|
|
|
374
392
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; options: <a href="#ivideooptionsbyurl">IVideoOptionsByUrl</a>; }; }></code>
|
|
375
393
|
|
|
@@ -379,15 +397,14 @@ Load and play a video by its full URL.
|
|
|
379
397
|
### cueVideoByUrl(...)
|
|
380
398
|
|
|
381
399
|
```typescript
|
|
382
|
-
cueVideoByUrl(
|
|
400
|
+
cueVideoByUrl(options: VideoByUrlMethodOptions) => Promise<{ result: { method: string; value: boolean; options: IVideoOptionsByUrl; }; }>
|
|
383
401
|
```
|
|
384
402
|
|
|
385
403
|
Cue a video by URL without playing it.
|
|
386
404
|
|
|
387
|
-
| Param
|
|
388
|
-
|
|
|
389
|
-
| **`
|
|
390
|
-
| **`options`** | <code><a href="#ivideooptionsbyurl">IVideoOptionsByUrl</a></code> | - Video cuing options including media URL |
|
|
405
|
+
| Param | Type | Description |
|
|
406
|
+
| ------------- | --------------------------------------------------------------------------- | ----------------------------------------- |
|
|
407
|
+
| **`options`** | <code><a href="#videobyurlmethodoptions">VideoByUrlMethodOptions</a></code> | - Video cuing options including media URL |
|
|
391
408
|
|
|
392
409
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; options: <a href="#ivideooptionsbyurl">IVideoOptionsByUrl</a>; }; }></code>
|
|
393
410
|
|
|
@@ -397,16 +414,15 @@ Cue a video by URL without playing it.
|
|
|
397
414
|
### cuePlaylist(...)
|
|
398
415
|
|
|
399
416
|
```typescript
|
|
400
|
-
cuePlaylist(
|
|
417
|
+
cuePlaylist(options: PlaylistMethodOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
401
418
|
```
|
|
402
419
|
|
|
403
420
|
Cue a playlist without playing it.
|
|
404
421
|
Loads playlist and prepares first video.
|
|
405
422
|
|
|
406
|
-
| Param
|
|
407
|
-
|
|
|
408
|
-
| **`
|
|
409
|
-
| **`playlistOptions`** | <code><a href="#iplaylistoptions">IPlaylistOptions</a></code> | - Playlist configuration (type, ID, index, etc.) |
|
|
423
|
+
| Param | Type |
|
|
424
|
+
| ------------- | ----------------------------------------------------------------------- |
|
|
425
|
+
| **`options`** | <code><a href="#playlistmethodoptions">PlaylistMethodOptions</a></code> |
|
|
410
426
|
|
|
411
427
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
412
428
|
|
|
@@ -416,15 +432,14 @@ Loads playlist and prepares first video.
|
|
|
416
432
|
### loadPlaylist(...)
|
|
417
433
|
|
|
418
434
|
```typescript
|
|
419
|
-
loadPlaylist(
|
|
435
|
+
loadPlaylist(options: PlaylistMethodOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
420
436
|
```
|
|
421
437
|
|
|
422
438
|
Load and play a playlist.
|
|
423
439
|
|
|
424
|
-
| Param
|
|
425
|
-
|
|
|
426
|
-
| **`
|
|
427
|
-
| **`playlistOptions`** | <code><a href="#iplaylistoptions">IPlaylistOptions</a></code> | - Playlist configuration (type, ID, index, etc.) |
|
|
440
|
+
| Param | Type |
|
|
441
|
+
| ------------- | ----------------------------------------------------------------------- |
|
|
442
|
+
| **`options`** | <code><a href="#playlistmethodoptions">PlaylistMethodOptions</a></code> |
|
|
428
443
|
|
|
429
444
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
430
445
|
|
|
@@ -434,14 +449,14 @@ Load and play a playlist.
|
|
|
434
449
|
### nextVideo(...)
|
|
435
450
|
|
|
436
451
|
```typescript
|
|
437
|
-
nextVideo(
|
|
452
|
+
nextVideo(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
438
453
|
```
|
|
439
454
|
|
|
440
455
|
Play the next video in the playlist.
|
|
441
456
|
|
|
442
|
-
| Param
|
|
443
|
-
|
|
|
444
|
-
| **`
|
|
457
|
+
| Param | Type | Description |
|
|
458
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
459
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
445
460
|
|
|
446
461
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
447
462
|
|
|
@@ -451,14 +466,14 @@ Play the next video in the playlist.
|
|
|
451
466
|
### previousVideo(...)
|
|
452
467
|
|
|
453
468
|
```typescript
|
|
454
|
-
previousVideo(
|
|
469
|
+
previousVideo(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
455
470
|
```
|
|
456
471
|
|
|
457
472
|
Play the previous video in the playlist.
|
|
458
473
|
|
|
459
|
-
| Param
|
|
460
|
-
|
|
|
461
|
-
| **`
|
|
474
|
+
| Param | Type | Description |
|
|
475
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
476
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
462
477
|
|
|
463
478
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
464
479
|
|
|
@@ -468,15 +483,14 @@ Play the previous video in the playlist.
|
|
|
468
483
|
### playVideoAt(...)
|
|
469
484
|
|
|
470
485
|
```typescript
|
|
471
|
-
playVideoAt(
|
|
486
|
+
playVideoAt(options: PlayVideoAtOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
472
487
|
```
|
|
473
488
|
|
|
474
489
|
Play a specific video in the playlist by index.
|
|
475
490
|
|
|
476
|
-
| Param
|
|
477
|
-
|
|
|
478
|
-
| **`
|
|
479
|
-
| **`index`** | <code>number</code> | - Zero-based index of the video to play |
|
|
491
|
+
| Param | Type | Description |
|
|
492
|
+
| ------------- | ----------------------------------------------------------------- | ------------------------------------ |
|
|
493
|
+
| **`options`** | <code><a href="#playvideoatoptions">PlayVideoAtOptions</a></code> | - Player playlist navigation options |
|
|
480
494
|
|
|
481
495
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
482
496
|
|
|
@@ -486,14 +500,14 @@ Play a specific video in the playlist by index.
|
|
|
486
500
|
### mute(...)
|
|
487
501
|
|
|
488
502
|
```typescript
|
|
489
|
-
mute(
|
|
503
|
+
mute(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
490
504
|
```
|
|
491
505
|
|
|
492
506
|
Mute the player audio.
|
|
493
507
|
|
|
494
|
-
| Param
|
|
495
|
-
|
|
|
496
|
-
| **`
|
|
508
|
+
| Param | Type | Description |
|
|
509
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
510
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
497
511
|
|
|
498
512
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
499
513
|
|
|
@@ -503,14 +517,14 @@ Mute the player audio.
|
|
|
503
517
|
### unMute(...)
|
|
504
518
|
|
|
505
519
|
```typescript
|
|
506
|
-
unMute(
|
|
520
|
+
unMute(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
507
521
|
```
|
|
508
522
|
|
|
509
523
|
Unmute the player audio.
|
|
510
524
|
|
|
511
|
-
| Param
|
|
512
|
-
|
|
|
513
|
-
| **`
|
|
525
|
+
| Param | Type | Description |
|
|
526
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
527
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
514
528
|
|
|
515
529
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
516
530
|
|
|
@@ -520,14 +534,14 @@ Unmute the player audio.
|
|
|
520
534
|
### isMuted(...)
|
|
521
535
|
|
|
522
536
|
```typescript
|
|
523
|
-
isMuted(
|
|
537
|
+
isMuted(options: PlayerIdOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
524
538
|
```
|
|
525
539
|
|
|
526
540
|
Check if the player is currently muted.
|
|
527
541
|
|
|
528
|
-
| Param
|
|
529
|
-
|
|
|
530
|
-
| **`
|
|
542
|
+
| Param | Type | Description |
|
|
543
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
544
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
531
545
|
|
|
532
546
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
533
547
|
|
|
@@ -537,15 +551,14 @@ Check if the player is currently muted.
|
|
|
537
551
|
### setVolume(...)
|
|
538
552
|
|
|
539
553
|
```typescript
|
|
540
|
-
setVolume(
|
|
554
|
+
setVolume(options: SetVolumeOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
541
555
|
```
|
|
542
556
|
|
|
543
557
|
Set the player volume level.
|
|
544
558
|
|
|
545
|
-
| Param
|
|
546
|
-
|
|
|
547
|
-
| **`
|
|
548
|
-
| **`volume`** | <code>number</code> | - Volume level from 0 (silent) to 100 (max) |
|
|
559
|
+
| Param | Type | Description |
|
|
560
|
+
| ------------- | ------------------------------------------------------------- | ----------------------- |
|
|
561
|
+
| **`options`** | <code><a href="#setvolumeoptions">SetVolumeOptions</a></code> | - Player volume options |
|
|
549
562
|
|
|
550
563
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
551
564
|
|
|
@@ -555,15 +568,15 @@ Set the player volume level.
|
|
|
555
568
|
### getVolume(...)
|
|
556
569
|
|
|
557
570
|
```typescript
|
|
558
|
-
getVolume(
|
|
571
|
+
getVolume(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
559
572
|
```
|
|
560
573
|
|
|
561
574
|
Get the current player volume level.
|
|
562
575
|
Returns volume even if player is muted.
|
|
563
576
|
|
|
564
|
-
| Param
|
|
565
|
-
|
|
|
566
|
-
| **`
|
|
577
|
+
| Param | Type | Description |
|
|
578
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
579
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
567
580
|
|
|
568
581
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
569
582
|
|
|
@@ -573,16 +586,14 @@ Returns volume even if player is muted.
|
|
|
573
586
|
### setSize(...)
|
|
574
587
|
|
|
575
588
|
```typescript
|
|
576
|
-
setSize(
|
|
589
|
+
setSize(options: SetSizeOptions) => Promise<{ result: { method: string; value: { width: number; height: number; }; }; }>
|
|
577
590
|
```
|
|
578
591
|
|
|
579
592
|
Set the player dimensions in pixels.
|
|
580
593
|
|
|
581
|
-
| Param
|
|
582
|
-
|
|
|
583
|
-
| **`
|
|
584
|
-
| **`width`** | <code>number</code> | - Width in pixels |
|
|
585
|
-
| **`height`** | <code>number</code> | - Height in pixels |
|
|
594
|
+
| Param | Type | Description |
|
|
595
|
+
| ------------- | --------------------------------------------------------- | --------------------- |
|
|
596
|
+
| **`options`** | <code><a href="#setsizeoptions">SetSizeOptions</a></code> | - Player size options |
|
|
586
597
|
|
|
587
598
|
**Returns:** <code>Promise<{ result: { method: string; value: { width: number; height: number; }; }; }></code>
|
|
588
599
|
|
|
@@ -592,14 +603,14 @@ Set the player dimensions in pixels.
|
|
|
592
603
|
### getPlaybackRate(...)
|
|
593
604
|
|
|
594
605
|
```typescript
|
|
595
|
-
getPlaybackRate(
|
|
606
|
+
getPlaybackRate(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
596
607
|
```
|
|
597
608
|
|
|
598
609
|
Get the current playback rate.
|
|
599
610
|
|
|
600
|
-
| Param
|
|
601
|
-
|
|
|
602
|
-
| **`
|
|
611
|
+
| Param | Type | Description |
|
|
612
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
613
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
603
614
|
|
|
604
615
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
605
616
|
|
|
@@ -609,15 +620,14 @@ Get the current playback rate.
|
|
|
609
620
|
### setPlaybackRate(...)
|
|
610
621
|
|
|
611
622
|
```typescript
|
|
612
|
-
setPlaybackRate(
|
|
623
|
+
setPlaybackRate(options: SetPlaybackRateOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
613
624
|
```
|
|
614
625
|
|
|
615
626
|
Set the playback speed.
|
|
616
627
|
|
|
617
|
-
| Param
|
|
618
|
-
|
|
|
619
|
-
| **`
|
|
620
|
-
| **`suggestedRate`** | <code>number</code> | - Desired playback rate (0.25 to 2.0) |
|
|
628
|
+
| Param | Type | Description |
|
|
629
|
+
| ------------- | ------------------------------------------------------------------------- | ----------------------- |
|
|
630
|
+
| **`options`** | <code><a href="#setplaybackrateoptions">SetPlaybackRateOptions</a></code> | - Playback rate options |
|
|
621
631
|
|
|
622
632
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
623
633
|
|
|
@@ -627,14 +637,14 @@ Set the playback speed.
|
|
|
627
637
|
### getAvailablePlaybackRates(...)
|
|
628
638
|
|
|
629
639
|
```typescript
|
|
630
|
-
getAvailablePlaybackRates(
|
|
640
|
+
getAvailablePlaybackRates(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number[]; }; }>
|
|
631
641
|
```
|
|
632
642
|
|
|
633
643
|
Get list of available playback rates for current video.
|
|
634
644
|
|
|
635
|
-
| Param
|
|
636
|
-
|
|
|
637
|
-
| **`
|
|
645
|
+
| Param | Type | Description |
|
|
646
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
647
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
638
648
|
|
|
639
649
|
**Returns:** <code>Promise<{ result: { method: string; value: number[]; }; }></code>
|
|
640
650
|
|
|
@@ -644,16 +654,15 @@ Get list of available playback rates for current video.
|
|
|
644
654
|
### setLoop(...)
|
|
645
655
|
|
|
646
656
|
```typescript
|
|
647
|
-
setLoop(
|
|
657
|
+
setLoop(options: SetLoopOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
648
658
|
```
|
|
649
659
|
|
|
650
660
|
Enable or disable playlist looping.
|
|
651
661
|
When enabled, playlist will restart from beginning after last video.
|
|
652
662
|
|
|
653
|
-
| Param
|
|
654
|
-
|
|
|
655
|
-
| **`
|
|
656
|
-
| **`loopPlaylists`** | <code>boolean</code> | - true to loop, false to stop after last video |
|
|
663
|
+
| Param | Type | Description |
|
|
664
|
+
| ------------- | --------------------------------------------------------- | ----------------------- |
|
|
665
|
+
| **`options`** | <code><a href="#setloopoptions">SetLoopOptions</a></code> | - Playlist loop options |
|
|
657
666
|
|
|
658
667
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
659
668
|
|
|
@@ -663,15 +672,14 @@ When enabled, playlist will restart from beginning after last video.
|
|
|
663
672
|
### setShuffle(...)
|
|
664
673
|
|
|
665
674
|
```typescript
|
|
666
|
-
setShuffle(
|
|
675
|
+
setShuffle(options: SetShuffleOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
667
676
|
```
|
|
668
677
|
|
|
669
678
|
Enable or disable playlist shuffle.
|
|
670
679
|
|
|
671
|
-
| Param
|
|
672
|
-
|
|
|
673
|
-
| **`
|
|
674
|
-
| **`shufflePlaylist`** | <code>boolean</code> | - true to shuffle, false for sequential |
|
|
680
|
+
| Param | Type | Description |
|
|
681
|
+
| ------------- | --------------------------------------------------------------- | -------------------------- |
|
|
682
|
+
| **`options`** | <code><a href="#setshuffleoptions">SetShuffleOptions</a></code> | - Playlist shuffle options |
|
|
675
683
|
|
|
676
684
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
677
685
|
|
|
@@ -681,15 +689,15 @@ Enable or disable playlist shuffle.
|
|
|
681
689
|
### getVideoLoadedFraction(...)
|
|
682
690
|
|
|
683
691
|
```typescript
|
|
684
|
-
getVideoLoadedFraction(
|
|
692
|
+
getVideoLoadedFraction(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
685
693
|
```
|
|
686
694
|
|
|
687
695
|
Get the fraction of the video that has been buffered.
|
|
688
696
|
More reliable than deprecated getVideoBytesLoaded/getVideoBytesTotal.
|
|
689
697
|
|
|
690
|
-
| Param
|
|
691
|
-
|
|
|
692
|
-
| **`
|
|
698
|
+
| Param | Type | Description |
|
|
699
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
700
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
693
701
|
|
|
694
702
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
695
703
|
|
|
@@ -699,14 +707,14 @@ More reliable than deprecated getVideoBytesLoaded/getVideoBytesTotal.
|
|
|
699
707
|
### getPlayerState(...)
|
|
700
708
|
|
|
701
709
|
```typescript
|
|
702
|
-
getPlayerState(
|
|
710
|
+
getPlayerState(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
703
711
|
```
|
|
704
712
|
|
|
705
713
|
Get the current state of the player.
|
|
706
714
|
|
|
707
|
-
| Param
|
|
708
|
-
|
|
|
709
|
-
| **`
|
|
715
|
+
| Param | Type | Description |
|
|
716
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
717
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
710
718
|
|
|
711
719
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
712
720
|
|
|
@@ -730,14 +738,14 @@ Useful for tracking multiple player instances.
|
|
|
730
738
|
### getCurrentTime(...)
|
|
731
739
|
|
|
732
740
|
```typescript
|
|
733
|
-
getCurrentTime(
|
|
741
|
+
getCurrentTime(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
734
742
|
```
|
|
735
743
|
|
|
736
744
|
Get the current playback position in seconds.
|
|
737
745
|
|
|
738
|
-
| Param
|
|
739
|
-
|
|
|
740
|
-
| **`
|
|
746
|
+
| Param | Type | Description |
|
|
747
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
748
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
741
749
|
|
|
742
750
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
743
751
|
|
|
@@ -747,15 +755,14 @@ Get the current playback position in seconds.
|
|
|
747
755
|
### toggleFullScreen(...)
|
|
748
756
|
|
|
749
757
|
```typescript
|
|
750
|
-
toggleFullScreen(
|
|
758
|
+
toggleFullScreen(options: ToggleFullScreenOptions) => Promise<{ result: { method: string; value: boolean | null | undefined; }; }>
|
|
751
759
|
```
|
|
752
760
|
|
|
753
761
|
Toggle fullscreen mode on or off.
|
|
754
762
|
|
|
755
|
-
| Param
|
|
756
|
-
|
|
|
757
|
-
| **`
|
|
758
|
-
| **`isFullScreen`** | <code>boolean \| null</code> | - true for fullscreen, false for normal, null/undefined to toggle |
|
|
763
|
+
| Param | Type | Description |
|
|
764
|
+
| ------------- | --------------------------------------------------------------------------- | -------------------- |
|
|
765
|
+
| **`options`** | <code><a href="#togglefullscreenoptions">ToggleFullScreenOptions</a></code> | - Fullscreen options |
|
|
759
766
|
|
|
760
767
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean | null; }; }></code>
|
|
761
768
|
|
|
@@ -765,14 +772,14 @@ Toggle fullscreen mode on or off.
|
|
|
765
772
|
### getPlaybackQuality(...)
|
|
766
773
|
|
|
767
774
|
```typescript
|
|
768
|
-
getPlaybackQuality(
|
|
775
|
+
getPlaybackQuality(options: PlayerIdOptions) => Promise<{ result: { method: string; value: IPlaybackQuality; }; }>
|
|
769
776
|
```
|
|
770
777
|
|
|
771
778
|
Get the current playback quality.
|
|
772
779
|
|
|
773
|
-
| Param
|
|
774
|
-
|
|
|
775
|
-
| **`
|
|
780
|
+
| Param | Type | Description |
|
|
781
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
782
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
776
783
|
|
|
777
784
|
**Returns:** <code>Promise<{ result: { method: string; value: <a href="#iplaybackquality">IPlaybackQuality</a>; }; }></code>
|
|
778
785
|
|
|
@@ -782,16 +789,15 @@ Get the current playback quality.
|
|
|
782
789
|
### setPlaybackQuality(...)
|
|
783
790
|
|
|
784
791
|
```typescript
|
|
785
|
-
setPlaybackQuality(
|
|
792
|
+
setPlaybackQuality(options: SetPlaybackQualityOptions) => Promise<{ result: { method: string; value: boolean; }; }>
|
|
786
793
|
```
|
|
787
794
|
|
|
788
795
|
Set the suggested playback quality.
|
|
789
796
|
Actual quality may differ based on network conditions.
|
|
790
797
|
|
|
791
|
-
| Param
|
|
792
|
-
|
|
|
793
|
-
| **`
|
|
794
|
-
| **`suggestedQuality`** | <code><a href="#iplaybackquality">IPlaybackQuality</a></code> | - Desired quality level |
|
|
798
|
+
| Param | Type | Description |
|
|
799
|
+
| ------------- | ------------------------------------------------------------------------------- | -------------------------- |
|
|
800
|
+
| **`options`** | <code><a href="#setplaybackqualityoptions">SetPlaybackQualityOptions</a></code> | - Playback quality options |
|
|
795
801
|
|
|
796
802
|
**Returns:** <code>Promise<{ result: { method: string; value: boolean; }; }></code>
|
|
797
803
|
|
|
@@ -801,14 +807,14 @@ Actual quality may differ based on network conditions.
|
|
|
801
807
|
### getAvailableQualityLevels(...)
|
|
802
808
|
|
|
803
809
|
```typescript
|
|
804
|
-
getAvailableQualityLevels(
|
|
810
|
+
getAvailableQualityLevels(options: PlayerIdOptions) => Promise<{ result: { method: string; value: IPlaybackQuality[]; }; }>
|
|
805
811
|
```
|
|
806
812
|
|
|
807
813
|
Get list of available quality levels for current video.
|
|
808
814
|
|
|
809
|
-
| Param
|
|
810
|
-
|
|
|
811
|
-
| **`
|
|
815
|
+
| Param | Type | Description |
|
|
816
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
817
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
812
818
|
|
|
813
819
|
**Returns:** <code>Promise<{ result: { method: string; value: IPlaybackQuality[]; }; }></code>
|
|
814
820
|
|
|
@@ -818,14 +824,14 @@ Get list of available quality levels for current video.
|
|
|
818
824
|
### getDuration(...)
|
|
819
825
|
|
|
820
826
|
```typescript
|
|
821
|
-
getDuration(
|
|
827
|
+
getDuration(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
822
828
|
```
|
|
823
829
|
|
|
824
830
|
Get the duration of the current video in seconds.
|
|
825
831
|
|
|
826
|
-
| Param
|
|
827
|
-
|
|
|
828
|
-
| **`
|
|
832
|
+
| Param | Type | Description |
|
|
833
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
834
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
829
835
|
|
|
830
836
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
831
837
|
|
|
@@ -835,14 +841,14 @@ Get the duration of the current video in seconds.
|
|
|
835
841
|
### getVideoUrl(...)
|
|
836
842
|
|
|
837
843
|
```typescript
|
|
838
|
-
getVideoUrl(
|
|
844
|
+
getVideoUrl(options: PlayerIdOptions) => Promise<{ result: { method: string; value: string; }; }>
|
|
839
845
|
```
|
|
840
846
|
|
|
841
847
|
Get the YouTube.com URL for the current video.
|
|
842
848
|
|
|
843
|
-
| Param
|
|
844
|
-
|
|
|
845
|
-
| **`
|
|
849
|
+
| Param | Type | Description |
|
|
850
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
851
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
846
852
|
|
|
847
853
|
**Returns:** <code>Promise<{ result: { method: string; value: string; }; }></code>
|
|
848
854
|
|
|
@@ -852,15 +858,15 @@ Get the YouTube.com URL for the current video.
|
|
|
852
858
|
### getVideoEmbedCode(...)
|
|
853
859
|
|
|
854
860
|
```typescript
|
|
855
|
-
getVideoEmbedCode(
|
|
861
|
+
getVideoEmbedCode(options: PlayerIdOptions) => Promise<{ result: { method: string; value: string; }; }>
|
|
856
862
|
```
|
|
857
863
|
|
|
858
864
|
Get the embed code for the current video.
|
|
859
865
|
Returns HTML iframe embed code.
|
|
860
866
|
|
|
861
|
-
| Param
|
|
862
|
-
|
|
|
863
|
-
| **`
|
|
867
|
+
| Param | Type | Description |
|
|
868
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
869
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
864
870
|
|
|
865
871
|
**Returns:** <code>Promise<{ result: { method: string; value: string; }; }></code>
|
|
866
872
|
|
|
@@ -870,14 +876,14 @@ Returns HTML iframe embed code.
|
|
|
870
876
|
### getPlaylist(...)
|
|
871
877
|
|
|
872
878
|
```typescript
|
|
873
|
-
getPlaylist(
|
|
879
|
+
getPlaylist(options: PlayerIdOptions) => Promise<{ result: { method: string; value: string[]; }; }>
|
|
874
880
|
```
|
|
875
881
|
|
|
876
882
|
Get array of video IDs in the current playlist.
|
|
877
883
|
|
|
878
|
-
| Param
|
|
879
|
-
|
|
|
880
|
-
| **`
|
|
884
|
+
| Param | Type | Description |
|
|
885
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
886
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
881
887
|
|
|
882
888
|
**Returns:** <code>Promise<{ result: { method: string; value: string[]; }; }></code>
|
|
883
889
|
|
|
@@ -887,14 +893,14 @@ Get array of video IDs in the current playlist.
|
|
|
887
893
|
### getPlaylistIndex(...)
|
|
888
894
|
|
|
889
895
|
```typescript
|
|
890
|
-
getPlaylistIndex(
|
|
896
|
+
getPlaylistIndex(options: PlayerIdOptions) => Promise<{ result: { method: string; value: number; }; }>
|
|
891
897
|
```
|
|
892
898
|
|
|
893
899
|
Get the index of the currently playing video in the playlist.
|
|
894
900
|
|
|
895
|
-
| Param
|
|
896
|
-
|
|
|
897
|
-
| **`
|
|
901
|
+
| Param | Type | Description |
|
|
902
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
903
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
898
904
|
|
|
899
905
|
**Returns:** <code>Promise<{ result: { method: string; value: number; }; }></code>
|
|
900
906
|
|
|
@@ -904,15 +910,15 @@ Get the index of the currently playing video in the playlist.
|
|
|
904
910
|
### getIframe(...)
|
|
905
911
|
|
|
906
912
|
```typescript
|
|
907
|
-
getIframe(
|
|
913
|
+
getIframe(options: PlayerIdOptions) => Promise<{ result: { method: string; value: HTMLIFrameElement; }; }>
|
|
908
914
|
```
|
|
909
915
|
|
|
910
916
|
Get the iframe DOM element for the player.
|
|
911
917
|
Web platform only.
|
|
912
918
|
|
|
913
|
-
| Param
|
|
914
|
-
|
|
|
915
|
-
| **`
|
|
919
|
+
| Param | Type | Description |
|
|
920
|
+
| ------------- | ----------------------------------------------------------- | ------------------------- |
|
|
921
|
+
| **`options`** | <code><a href="#playeridoptions">PlayerIdOptions</a></code> | - Player instance options |
|
|
916
922
|
|
|
917
923
|
**Returns:** <code>Promise<{ result: { method: string; value: any; }; }></code>
|
|
918
924
|
|
|
@@ -922,16 +928,15 @@ Web platform only.
|
|
|
922
928
|
### addEventListener(...)
|
|
923
929
|
|
|
924
930
|
```typescript
|
|
925
|
-
addEventListener<TEvent extends PlayerEvent>(
|
|
931
|
+
addEventListener<TEvent extends PlayerEvent>(options: PlayerEventListenerOptions<TEvent>) => void
|
|
926
932
|
```
|
|
927
933
|
|
|
928
934
|
Add an event listener to the player.
|
|
935
|
+
Web platform only.
|
|
929
936
|
|
|
930
|
-
| Param
|
|
931
|
-
|
|
|
932
|
-
| **`
|
|
933
|
-
| **`eventName`** | <code>keyof <a href="#events">Events</a></code> | - Name of the event (onReady, onStateChange, onError, etc.) |
|
|
934
|
-
| **`listener`** | <code>(event: TEvent) => void</code> | - Callback function to handle the event |
|
|
937
|
+
| Param | Type | Description |
|
|
938
|
+
| ------------- | ----------------------------------------------------------------------------------------------- | ------------------------ |
|
|
939
|
+
| **`options`** | <code><a href="#playereventlisteneroptions">PlayerEventListenerOptions</a><TEvent></code> | - Event listener options |
|
|
935
940
|
|
|
936
941
|
--------------------
|
|
937
942
|
|
|
@@ -939,16 +944,15 @@ Add an event listener to the player.
|
|
|
939
944
|
### removeEventListener(...)
|
|
940
945
|
|
|
941
946
|
```typescript
|
|
942
|
-
removeEventListener<TEvent extends PlayerEvent>(
|
|
947
|
+
removeEventListener<TEvent extends PlayerEvent>(options: PlayerEventListenerOptions<TEvent>) => void
|
|
943
948
|
```
|
|
944
949
|
|
|
945
950
|
Remove an event listener from the player.
|
|
951
|
+
Web platform only.
|
|
946
952
|
|
|
947
|
-
| Param
|
|
948
|
-
|
|
|
949
|
-
| **`
|
|
950
|
-
| **`eventName`** | <code>keyof <a href="#events">Events</a></code> | - Name of the event to remove listener from |
|
|
951
|
-
| **`listener`** | <code>(event: TEvent) => void</code> | - The callback function to remove |
|
|
953
|
+
| Param | Type | Description |
|
|
954
|
+
| ------------- | ----------------------------------------------------------------------------------------------- | ------------------------ |
|
|
955
|
+
| **`options`** | <code><a href="#playereventlisteneroptions">PlayerEventListenerOptions</a><TEvent></code> | - Event listener options |
|
|
952
956
|
|
|
953
957
|
--------------------
|
|
954
958
|
|
|
@@ -1025,6 +1029,22 @@ YouTube player parameters for customizing player behavior and appearance.
|
|
|
1025
1029
|
| **`start`** | <code>number</code> | Time in seconds to start playback |
|
|
1026
1030
|
|
|
1027
1031
|
|
|
1032
|
+
#### PlayerIdOptions
|
|
1033
|
+
|
|
1034
|
+
| Prop | Type |
|
|
1035
|
+
| -------------- | ------------------- |
|
|
1036
|
+
| **`playerId`** | <code>string</code> |
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
#### SeekToOptions
|
|
1040
|
+
|
|
1041
|
+
| Prop | Type |
|
|
1042
|
+
| -------------------- | -------------------- |
|
|
1043
|
+
| **`playerId`** | <code>string</code> |
|
|
1044
|
+
| **`seconds`** | <code>number</code> |
|
|
1045
|
+
| **`allowSeekAhead`** | <code>boolean</code> |
|
|
1046
|
+
|
|
1047
|
+
|
|
1028
1048
|
#### IVideoOptionsById
|
|
1029
1049
|
|
|
1030
1050
|
Options for loading a video by its YouTube ID.
|
|
@@ -1034,6 +1054,14 @@ Options for loading a video by its YouTube ID.
|
|
|
1034
1054
|
| **`videoId`** | <code>string</code> | YouTube video ID |
|
|
1035
1055
|
|
|
1036
1056
|
|
|
1057
|
+
#### VideoByIdMethodOptions
|
|
1058
|
+
|
|
1059
|
+
| Prop | Type |
|
|
1060
|
+
| -------------- | --------------------------------------------------------------- |
|
|
1061
|
+
| **`playerId`** | <code>string</code> |
|
|
1062
|
+
| **`options`** | <code><a href="#ivideooptionsbyid">IVideoOptionsById</a></code> |
|
|
1063
|
+
|
|
1064
|
+
|
|
1037
1065
|
#### IVideoOptionsByUrl
|
|
1038
1066
|
|
|
1039
1067
|
Options for loading a video by its media URL.
|
|
@@ -1043,6 +1071,22 @@ Options for loading a video by its media URL.
|
|
|
1043
1071
|
| **`mediaContentUrl`** | <code>string</code> | Full YouTube video URL |
|
|
1044
1072
|
|
|
1045
1073
|
|
|
1074
|
+
#### VideoByUrlMethodOptions
|
|
1075
|
+
|
|
1076
|
+
| Prop | Type |
|
|
1077
|
+
| -------------- | ----------------------------------------------------------------- |
|
|
1078
|
+
| **`playerId`** | <code>string</code> |
|
|
1079
|
+
| **`options`** | <code><a href="#ivideooptionsbyurl">IVideoOptionsByUrl</a></code> |
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
#### PlaylistMethodOptions
|
|
1083
|
+
|
|
1084
|
+
| Prop | Type |
|
|
1085
|
+
| --------------------- | ------------------------------------------------------------- |
|
|
1086
|
+
| **`playerId`** | <code>string</code> |
|
|
1087
|
+
| **`playlistOptions`** | <code><a href="#iplaylistoptions">IPlaylistOptions</a></code> |
|
|
1088
|
+
|
|
1089
|
+
|
|
1046
1090
|
#### IPlaylistOptions
|
|
1047
1091
|
|
|
1048
1092
|
Options for loading and playing YouTube playlists.
|
|
@@ -1057,6 +1101,55 @@ Options for loading and playing YouTube playlists.
|
|
|
1057
1101
|
| **`suggestedQuality`** | <code>string</code> | Suggested playback quality |
|
|
1058
1102
|
|
|
1059
1103
|
|
|
1104
|
+
#### PlayVideoAtOptions
|
|
1105
|
+
|
|
1106
|
+
| Prop | Type |
|
|
1107
|
+
| -------------- | ------------------- |
|
|
1108
|
+
| **`playerId`** | <code>string</code> |
|
|
1109
|
+
| **`index`** | <code>number</code> |
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
#### SetVolumeOptions
|
|
1113
|
+
|
|
1114
|
+
| Prop | Type |
|
|
1115
|
+
| -------------- | ------------------- |
|
|
1116
|
+
| **`playerId`** | <code>string</code> |
|
|
1117
|
+
| **`volume`** | <code>number</code> |
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
#### SetSizeOptions
|
|
1121
|
+
|
|
1122
|
+
| Prop | Type |
|
|
1123
|
+
| -------------- | ------------------- |
|
|
1124
|
+
| **`playerId`** | <code>string</code> |
|
|
1125
|
+
| **`width`** | <code>number</code> |
|
|
1126
|
+
| **`height`** | <code>number</code> |
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
#### SetPlaybackRateOptions
|
|
1130
|
+
|
|
1131
|
+
| Prop | Type |
|
|
1132
|
+
| ------------------- | ------------------- |
|
|
1133
|
+
| **`playerId`** | <code>string</code> |
|
|
1134
|
+
| **`suggestedRate`** | <code>number</code> |
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
#### SetLoopOptions
|
|
1138
|
+
|
|
1139
|
+
| Prop | Type |
|
|
1140
|
+
| ------------------- | -------------------- |
|
|
1141
|
+
| **`playerId`** | <code>string</code> |
|
|
1142
|
+
| **`loopPlaylists`** | <code>boolean</code> |
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
#### SetShuffleOptions
|
|
1146
|
+
|
|
1147
|
+
| Prop | Type |
|
|
1148
|
+
| --------------------- | -------------------- |
|
|
1149
|
+
| **`playerId`** | <code>string</code> |
|
|
1150
|
+
| **`shufflePlaylist`** | <code>boolean</code> |
|
|
1151
|
+
|
|
1152
|
+
|
|
1060
1153
|
#### Map
|
|
1061
1154
|
|
|
1062
1155
|
| Prop | Type |
|
|
@@ -1083,6 +1176,22 @@ Used to monitor which events have been triggered.
|
|
|
1083
1176
|
| **`events`** | <code>{ onReady?: unknown; onStateChange?: unknown; onPlaybackQualityChange?: unknown; onError?: unknown; }</code> | Event handlers and their states |
|
|
1084
1177
|
|
|
1085
1178
|
|
|
1179
|
+
#### ToggleFullScreenOptions
|
|
1180
|
+
|
|
1181
|
+
| Prop | Type |
|
|
1182
|
+
| ------------------ | ---------------------------- |
|
|
1183
|
+
| **`playerId`** | <code>string</code> |
|
|
1184
|
+
| **`isFullScreen`** | <code>boolean \| null</code> |
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
#### SetPlaybackQualityOptions
|
|
1188
|
+
|
|
1189
|
+
| Prop | Type |
|
|
1190
|
+
| ---------------------- | ------------------------------------------------------------- |
|
|
1191
|
+
| **`playerId`** | <code>string</code> |
|
|
1192
|
+
| **`suggestedQuality`** | <code><a href="#iplaybackquality">IPlaybackQuality</a></code> |
|
|
1193
|
+
|
|
1194
|
+
|
|
1086
1195
|
#### PlayerEvent
|
|
1087
1196
|
|
|
1088
1197
|
Base interface for events triggered by a player.
|
|
@@ -1092,6 +1201,15 @@ Base interface for events triggered by a player.
|
|
|
1092
1201
|
| **`target`** | <code>Element</code> | Video player corresponding to the event. |
|
|
1093
1202
|
|
|
1094
1203
|
|
|
1204
|
+
#### PlayerEventListenerOptions
|
|
1205
|
+
|
|
1206
|
+
| Prop | Type |
|
|
1207
|
+
| --------------- | ----------------------------------------------- |
|
|
1208
|
+
| **`playerId`** | <code>string</code> |
|
|
1209
|
+
| **`eventName`** | <code>keyof <a href="#events">Events</a></code> |
|
|
1210
|
+
| **`listener`** | <code>(event: TEvent) => void</code> |
|
|
1211
|
+
|
|
1212
|
+
|
|
1095
1213
|
#### Events
|
|
1096
1214
|
|
|
1097
1215
|
* Handlers for events fired by the player.
|