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