@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
|
@@ -1,4 +1,62 @@
|
|
|
1
1
|
import type { IPlayerState, IPlayerOptions, IPlaylistOptions, IVideoOptionsById, IVideoOptionsByUrl, IPlaybackQuality, PlayerEvent, Events } from './web/models/models';
|
|
2
|
+
export interface PlayerIdOptions {
|
|
3
|
+
playerId: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SeekToOptions extends PlayerIdOptions {
|
|
6
|
+
playerId: string;
|
|
7
|
+
seconds: number;
|
|
8
|
+
allowSeekAhead: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface VideoByIdMethodOptions extends PlayerIdOptions {
|
|
11
|
+
playerId: string;
|
|
12
|
+
options: IVideoOptionsById;
|
|
13
|
+
}
|
|
14
|
+
export interface VideoByUrlMethodOptions extends PlayerIdOptions {
|
|
15
|
+
playerId: string;
|
|
16
|
+
options: IVideoOptionsByUrl;
|
|
17
|
+
}
|
|
18
|
+
export interface PlaylistMethodOptions extends PlayerIdOptions {
|
|
19
|
+
playerId: string;
|
|
20
|
+
playlistOptions: IPlaylistOptions;
|
|
21
|
+
}
|
|
22
|
+
export interface PlayVideoAtOptions extends PlayerIdOptions {
|
|
23
|
+
playerId: string;
|
|
24
|
+
index: number;
|
|
25
|
+
}
|
|
26
|
+
export interface SetVolumeOptions extends PlayerIdOptions {
|
|
27
|
+
playerId: string;
|
|
28
|
+
volume: number;
|
|
29
|
+
}
|
|
30
|
+
export interface SetSizeOptions extends PlayerIdOptions {
|
|
31
|
+
playerId: string;
|
|
32
|
+
width: number;
|
|
33
|
+
height: number;
|
|
34
|
+
}
|
|
35
|
+
export interface SetPlaybackRateOptions extends PlayerIdOptions {
|
|
36
|
+
playerId: string;
|
|
37
|
+
suggestedRate: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SetLoopOptions extends PlayerIdOptions {
|
|
40
|
+
playerId: string;
|
|
41
|
+
loopPlaylists: boolean;
|
|
42
|
+
}
|
|
43
|
+
export interface SetShuffleOptions extends PlayerIdOptions {
|
|
44
|
+
playerId: string;
|
|
45
|
+
shufflePlaylist: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface ToggleFullScreenOptions extends PlayerIdOptions {
|
|
48
|
+
playerId: string;
|
|
49
|
+
isFullScreen: boolean | null | undefined;
|
|
50
|
+
}
|
|
51
|
+
export interface SetPlaybackQualityOptions extends PlayerIdOptions {
|
|
52
|
+
playerId: string;
|
|
53
|
+
suggestedQuality: IPlaybackQuality;
|
|
54
|
+
}
|
|
55
|
+
export interface PlayerEventListenerOptions<TEvent extends PlayerEvent = PlayerEvent> extends PlayerIdOptions {
|
|
56
|
+
playerId: string;
|
|
57
|
+
eventName: keyof Events;
|
|
58
|
+
listener: (event: TEvent) => void;
|
|
59
|
+
}
|
|
2
60
|
/**
|
|
3
61
|
* YouTube Player Plugin interface for Capacitor.
|
|
4
62
|
* Provides methods to control YouTube video playback in your app.
|
|
@@ -36,10 +94,10 @@ export interface YoutubePlayerPlugin {
|
|
|
36
94
|
/**
|
|
37
95
|
* Destroy a player instance and free resources.
|
|
38
96
|
*
|
|
39
|
-
* @param
|
|
97
|
+
* @param options - Player instance options
|
|
40
98
|
* @returns Promise with operation result
|
|
41
99
|
*/
|
|
42
|
-
destroy(
|
|
100
|
+
destroy(options: PlayerIdOptions): Promise<{
|
|
43
101
|
result: {
|
|
44
102
|
method: string;
|
|
45
103
|
value: boolean;
|
|
@@ -49,10 +107,10 @@ export interface YoutubePlayerPlugin {
|
|
|
49
107
|
* Stop video playback and cancel loading.
|
|
50
108
|
* Use this sparingly - pauseVideo() is usually preferred.
|
|
51
109
|
*
|
|
52
|
-
* @param
|
|
110
|
+
* @param options - Player instance options
|
|
53
111
|
* @returns Promise with operation result
|
|
54
112
|
*/
|
|
55
|
-
stopVideo(
|
|
113
|
+
stopVideo(options: PlayerIdOptions): Promise<{
|
|
56
114
|
result: {
|
|
57
115
|
method: string;
|
|
58
116
|
value: boolean;
|
|
@@ -62,10 +120,10 @@ export interface YoutubePlayerPlugin {
|
|
|
62
120
|
* Play the currently cued or loaded video.
|
|
63
121
|
* Final player state will be PLAYING (1).
|
|
64
122
|
*
|
|
65
|
-
* @param
|
|
123
|
+
* @param options - Player instance options
|
|
66
124
|
* @returns Promise with operation result
|
|
67
125
|
*/
|
|
68
|
-
playVideo(
|
|
126
|
+
playVideo(options: PlayerIdOptions): Promise<{
|
|
69
127
|
result: {
|
|
70
128
|
method: string;
|
|
71
129
|
value: boolean;
|
|
@@ -75,10 +133,10 @@ export interface YoutubePlayerPlugin {
|
|
|
75
133
|
* Pause the currently playing video.
|
|
76
134
|
* Final player state will be PAUSED (2), unless already ENDED (0).
|
|
77
135
|
*
|
|
78
|
-
* @param
|
|
136
|
+
* @param options - Player instance options
|
|
79
137
|
* @returns Promise with operation result
|
|
80
138
|
*/
|
|
81
|
-
pauseVideo(
|
|
139
|
+
pauseVideo(options: PlayerIdOptions): Promise<{
|
|
82
140
|
result: {
|
|
83
141
|
method: string;
|
|
84
142
|
value: boolean;
|
|
@@ -88,12 +146,10 @@ export interface YoutubePlayerPlugin {
|
|
|
88
146
|
* Seek to a specific time in the video.
|
|
89
147
|
* If player is paused, it remains paused. If playing, continues playing.
|
|
90
148
|
*
|
|
91
|
-
* @param
|
|
92
|
-
* @param seconds - Time to seek to (in seconds)
|
|
93
|
-
* @param allowSeekAhead - Whether to make a new request to server if not buffered
|
|
149
|
+
* @param options - Player seek options
|
|
94
150
|
* @returns Promise with operation result including seek parameters
|
|
95
151
|
*/
|
|
96
|
-
seekTo(
|
|
152
|
+
seekTo(options: SeekToOptions): Promise<{
|
|
97
153
|
result: {
|
|
98
154
|
method: string;
|
|
99
155
|
value: boolean;
|
|
@@ -104,11 +160,10 @@ export interface YoutubePlayerPlugin {
|
|
|
104
160
|
/**
|
|
105
161
|
* Load and play a video by its YouTube ID.
|
|
106
162
|
*
|
|
107
|
-
* @param playerId - ID of the player
|
|
108
163
|
* @param options - Video loading options (ID, start time, quality, etc.)
|
|
109
164
|
* @returns Promise with operation result
|
|
110
165
|
*/
|
|
111
|
-
loadVideoById(
|
|
166
|
+
loadVideoById(options: VideoByIdMethodOptions): Promise<{
|
|
112
167
|
result: {
|
|
113
168
|
method: string;
|
|
114
169
|
value: boolean;
|
|
@@ -119,11 +174,10 @@ export interface YoutubePlayerPlugin {
|
|
|
119
174
|
* Cue a video by ID without playing it.
|
|
120
175
|
* Loads thumbnail and prepares player, but doesn't request video until playVideo() called.
|
|
121
176
|
*
|
|
122
|
-
* @param playerId - ID of the player
|
|
123
177
|
* @param options - Video cuing options (ID, start time, quality, etc.)
|
|
124
178
|
* @returns Promise with operation result
|
|
125
179
|
*/
|
|
126
|
-
cueVideoById(
|
|
180
|
+
cueVideoById(options: VideoByIdMethodOptions): Promise<{
|
|
127
181
|
result: {
|
|
128
182
|
method: string;
|
|
129
183
|
value: boolean;
|
|
@@ -133,11 +187,10 @@ export interface YoutubePlayerPlugin {
|
|
|
133
187
|
/**
|
|
134
188
|
* Load and play a video by its full URL.
|
|
135
189
|
*
|
|
136
|
-
* @param playerId - ID of the player
|
|
137
190
|
* @param options - Video loading options including media URL
|
|
138
191
|
* @returns Promise with operation result
|
|
139
192
|
*/
|
|
140
|
-
loadVideoByUrl(
|
|
193
|
+
loadVideoByUrl(options: VideoByUrlMethodOptions): Promise<{
|
|
141
194
|
result: {
|
|
142
195
|
method: string;
|
|
143
196
|
value: boolean;
|
|
@@ -147,11 +200,10 @@ export interface YoutubePlayerPlugin {
|
|
|
147
200
|
/**
|
|
148
201
|
* Cue a video by URL without playing it.
|
|
149
202
|
*
|
|
150
|
-
* @param playerId - ID of the player
|
|
151
203
|
* @param options - Video cuing options including media URL
|
|
152
204
|
* @returns Promise with operation result
|
|
153
205
|
*/
|
|
154
|
-
cueVideoByUrl(
|
|
206
|
+
cueVideoByUrl(options: VideoByUrlMethodOptions): Promise<{
|
|
155
207
|
result: {
|
|
156
208
|
method: string;
|
|
157
209
|
value: boolean;
|
|
@@ -162,11 +214,10 @@ export interface YoutubePlayerPlugin {
|
|
|
162
214
|
* Cue a playlist without playing it.
|
|
163
215
|
* Loads playlist and prepares first video.
|
|
164
216
|
*
|
|
165
|
-
* @param playerId - ID of the player
|
|
166
217
|
* @param playlistOptions - Playlist configuration (type, ID, index, etc.)
|
|
167
218
|
* @returns Promise with operation result
|
|
168
219
|
*/
|
|
169
|
-
cuePlaylist(
|
|
220
|
+
cuePlaylist(options: PlaylistMethodOptions): Promise<{
|
|
170
221
|
result: {
|
|
171
222
|
method: string;
|
|
172
223
|
value: boolean;
|
|
@@ -175,11 +226,10 @@ export interface YoutubePlayerPlugin {
|
|
|
175
226
|
/**
|
|
176
227
|
* Load and play a playlist.
|
|
177
228
|
*
|
|
178
|
-
* @param playerId - ID of the player
|
|
179
229
|
* @param playlistOptions - Playlist configuration (type, ID, index, etc.)
|
|
180
230
|
* @returns Promise with operation result
|
|
181
231
|
*/
|
|
182
|
-
loadPlaylist(
|
|
232
|
+
loadPlaylist(options: PlaylistMethodOptions): Promise<{
|
|
183
233
|
result: {
|
|
184
234
|
method: string;
|
|
185
235
|
value: boolean;
|
|
@@ -188,10 +238,10 @@ export interface YoutubePlayerPlugin {
|
|
|
188
238
|
/**
|
|
189
239
|
* Play the next video in the playlist.
|
|
190
240
|
*
|
|
191
|
-
* @param
|
|
241
|
+
* @param options - Player instance options
|
|
192
242
|
* @returns Promise with operation result
|
|
193
243
|
*/
|
|
194
|
-
nextVideo(
|
|
244
|
+
nextVideo(options: PlayerIdOptions): Promise<{
|
|
195
245
|
result: {
|
|
196
246
|
method: string;
|
|
197
247
|
value: boolean;
|
|
@@ -200,10 +250,10 @@ export interface YoutubePlayerPlugin {
|
|
|
200
250
|
/**
|
|
201
251
|
* Play the previous video in the playlist.
|
|
202
252
|
*
|
|
203
|
-
* @param
|
|
253
|
+
* @param options - Player instance options
|
|
204
254
|
* @returns Promise with operation result
|
|
205
255
|
*/
|
|
206
|
-
previousVideo(
|
|
256
|
+
previousVideo(options: PlayerIdOptions): Promise<{
|
|
207
257
|
result: {
|
|
208
258
|
method: string;
|
|
209
259
|
value: boolean;
|
|
@@ -212,11 +262,10 @@ export interface YoutubePlayerPlugin {
|
|
|
212
262
|
/**
|
|
213
263
|
* Play a specific video in the playlist by index.
|
|
214
264
|
*
|
|
215
|
-
* @param
|
|
216
|
-
* @param index - Zero-based index of the video to play
|
|
265
|
+
* @param options - Player playlist navigation options
|
|
217
266
|
* @returns Promise with operation result
|
|
218
267
|
*/
|
|
219
|
-
playVideoAt(
|
|
268
|
+
playVideoAt(options: PlayVideoAtOptions): Promise<{
|
|
220
269
|
result: {
|
|
221
270
|
method: string;
|
|
222
271
|
value: boolean;
|
|
@@ -225,10 +274,10 @@ export interface YoutubePlayerPlugin {
|
|
|
225
274
|
/**
|
|
226
275
|
* Mute the player audio.
|
|
227
276
|
*
|
|
228
|
-
* @param
|
|
277
|
+
* @param options - Player instance options
|
|
229
278
|
* @returns Promise with operation result
|
|
230
279
|
*/
|
|
231
|
-
mute(
|
|
280
|
+
mute(options: PlayerIdOptions): Promise<{
|
|
232
281
|
result: {
|
|
233
282
|
method: string;
|
|
234
283
|
value: boolean;
|
|
@@ -237,10 +286,10 @@ export interface YoutubePlayerPlugin {
|
|
|
237
286
|
/**
|
|
238
287
|
* Unmute the player audio.
|
|
239
288
|
*
|
|
240
|
-
* @param
|
|
289
|
+
* @param options - Player instance options
|
|
241
290
|
* @returns Promise with operation result
|
|
242
291
|
*/
|
|
243
|
-
unMute(
|
|
292
|
+
unMute(options: PlayerIdOptions): Promise<{
|
|
244
293
|
result: {
|
|
245
294
|
method: string;
|
|
246
295
|
value: boolean;
|
|
@@ -249,10 +298,10 @@ export interface YoutubePlayerPlugin {
|
|
|
249
298
|
/**
|
|
250
299
|
* Check if the player is currently muted.
|
|
251
300
|
*
|
|
252
|
-
* @param
|
|
301
|
+
* @param options - Player instance options
|
|
253
302
|
* @returns Promise with mute status (true = muted, false = not muted)
|
|
254
303
|
*/
|
|
255
|
-
isMuted(
|
|
304
|
+
isMuted(options: PlayerIdOptions): Promise<{
|
|
256
305
|
result: {
|
|
257
306
|
method: string;
|
|
258
307
|
value: boolean;
|
|
@@ -261,11 +310,10 @@ export interface YoutubePlayerPlugin {
|
|
|
261
310
|
/**
|
|
262
311
|
* Set the player volume level.
|
|
263
312
|
*
|
|
264
|
-
* @param
|
|
265
|
-
* @param volume - Volume level from 0 (silent) to 100 (max)
|
|
313
|
+
* @param options - Player volume options
|
|
266
314
|
* @returns Promise with the volume that was set
|
|
267
315
|
*/
|
|
268
|
-
setVolume(
|
|
316
|
+
setVolume(options: SetVolumeOptions): Promise<{
|
|
269
317
|
result: {
|
|
270
318
|
method: string;
|
|
271
319
|
value: number;
|
|
@@ -275,10 +323,10 @@ export interface YoutubePlayerPlugin {
|
|
|
275
323
|
* Get the current player volume level.
|
|
276
324
|
* Returns volume even if player is muted.
|
|
277
325
|
*
|
|
278
|
-
* @param
|
|
326
|
+
* @param options - Player instance options
|
|
279
327
|
* @returns Promise with current volume (0-100)
|
|
280
328
|
*/
|
|
281
|
-
getVolume(
|
|
329
|
+
getVolume(options: PlayerIdOptions): Promise<{
|
|
282
330
|
result: {
|
|
283
331
|
method: string;
|
|
284
332
|
value: number;
|
|
@@ -287,12 +335,10 @@ export interface YoutubePlayerPlugin {
|
|
|
287
335
|
/**
|
|
288
336
|
* Set the player dimensions in pixels.
|
|
289
337
|
*
|
|
290
|
-
* @param
|
|
291
|
-
* @param width - Width in pixels
|
|
292
|
-
* @param height - Height in pixels
|
|
338
|
+
* @param options - Player size options
|
|
293
339
|
* @returns Promise with the dimensions that were set
|
|
294
340
|
*/
|
|
295
|
-
setSize(
|
|
341
|
+
setSize(options: SetSizeOptions): Promise<{
|
|
296
342
|
result: {
|
|
297
343
|
method: string;
|
|
298
344
|
value: {
|
|
@@ -304,10 +350,10 @@ export interface YoutubePlayerPlugin {
|
|
|
304
350
|
/**
|
|
305
351
|
* Get the current playback rate.
|
|
306
352
|
*
|
|
307
|
-
* @param
|
|
353
|
+
* @param options - Player instance options
|
|
308
354
|
* @returns Promise with playback rate (e.g., 0.5, 1, 1.5, 2)
|
|
309
355
|
*/
|
|
310
|
-
getPlaybackRate(
|
|
356
|
+
getPlaybackRate(options: PlayerIdOptions): Promise<{
|
|
311
357
|
result: {
|
|
312
358
|
method: string;
|
|
313
359
|
value: number;
|
|
@@ -316,11 +362,10 @@ export interface YoutubePlayerPlugin {
|
|
|
316
362
|
/**
|
|
317
363
|
* Set the playback speed.
|
|
318
364
|
*
|
|
319
|
-
* @param
|
|
320
|
-
* @param suggestedRate - Desired playback rate (0.25 to 2.0)
|
|
365
|
+
* @param options - Playback rate options
|
|
321
366
|
* @returns Promise with operation result
|
|
322
367
|
*/
|
|
323
|
-
setPlaybackRate(
|
|
368
|
+
setPlaybackRate(options: SetPlaybackRateOptions): Promise<{
|
|
324
369
|
result: {
|
|
325
370
|
method: string;
|
|
326
371
|
value: boolean;
|
|
@@ -329,10 +374,10 @@ export interface YoutubePlayerPlugin {
|
|
|
329
374
|
/**
|
|
330
375
|
* Get list of available playback rates for current video.
|
|
331
376
|
*
|
|
332
|
-
* @param
|
|
377
|
+
* @param options - Player instance options
|
|
333
378
|
* @returns Promise with array of available rates
|
|
334
379
|
*/
|
|
335
|
-
getAvailablePlaybackRates(
|
|
380
|
+
getAvailablePlaybackRates(options: PlayerIdOptions): Promise<{
|
|
336
381
|
result: {
|
|
337
382
|
method: string;
|
|
338
383
|
value: number[];
|
|
@@ -342,11 +387,10 @@ export interface YoutubePlayerPlugin {
|
|
|
342
387
|
* Enable or disable playlist looping.
|
|
343
388
|
* When enabled, playlist will restart from beginning after last video.
|
|
344
389
|
*
|
|
345
|
-
* @param
|
|
346
|
-
* @param loopPlaylists - true to loop, false to stop after last video
|
|
390
|
+
* @param options - Playlist loop options
|
|
347
391
|
* @returns Promise with operation result
|
|
348
392
|
*/
|
|
349
|
-
setLoop(
|
|
393
|
+
setLoop(options: SetLoopOptions): Promise<{
|
|
350
394
|
result: {
|
|
351
395
|
method: string;
|
|
352
396
|
value: boolean;
|
|
@@ -355,11 +399,10 @@ export interface YoutubePlayerPlugin {
|
|
|
355
399
|
/**
|
|
356
400
|
* Enable or disable playlist shuffle.
|
|
357
401
|
*
|
|
358
|
-
* @param
|
|
359
|
-
* @param shufflePlaylist - true to shuffle, false for sequential
|
|
402
|
+
* @param options - Playlist shuffle options
|
|
360
403
|
* @returns Promise with operation result
|
|
361
404
|
*/
|
|
362
|
-
setShuffle(
|
|
405
|
+
setShuffle(options: SetShuffleOptions): Promise<{
|
|
363
406
|
result: {
|
|
364
407
|
method: string;
|
|
365
408
|
value: boolean;
|
|
@@ -369,10 +412,10 @@ export interface YoutubePlayerPlugin {
|
|
|
369
412
|
* Get the fraction of the video that has been buffered.
|
|
370
413
|
* More reliable than deprecated getVideoBytesLoaded/getVideoBytesTotal.
|
|
371
414
|
*
|
|
372
|
-
* @param
|
|
415
|
+
* @param options - Player instance options
|
|
373
416
|
* @returns Promise with fraction between 0 and 1
|
|
374
417
|
*/
|
|
375
|
-
getVideoLoadedFraction(
|
|
418
|
+
getVideoLoadedFraction(options: PlayerIdOptions): Promise<{
|
|
376
419
|
result: {
|
|
377
420
|
method: string;
|
|
378
421
|
value: number;
|
|
@@ -381,10 +424,10 @@ export interface YoutubePlayerPlugin {
|
|
|
381
424
|
/**
|
|
382
425
|
* Get the current state of the player.
|
|
383
426
|
*
|
|
384
|
-
* @param
|
|
427
|
+
* @param options - Player instance options
|
|
385
428
|
* @returns Promise with state: -1 (unstarted), 0 (ended), 1 (playing), 2 (paused), 3 (buffering), 5 (cued)
|
|
386
429
|
*/
|
|
387
|
-
getPlayerState(
|
|
430
|
+
getPlayerState(options: PlayerIdOptions): Promise<{
|
|
388
431
|
result: {
|
|
389
432
|
method: string;
|
|
390
433
|
value: number;
|
|
@@ -405,10 +448,10 @@ export interface YoutubePlayerPlugin {
|
|
|
405
448
|
/**
|
|
406
449
|
* Get the current playback position in seconds.
|
|
407
450
|
*
|
|
408
|
-
* @param
|
|
451
|
+
* @param options - Player instance options
|
|
409
452
|
* @returns Promise with current time in seconds
|
|
410
453
|
*/
|
|
411
|
-
getCurrentTime(
|
|
454
|
+
getCurrentTime(options: PlayerIdOptions): Promise<{
|
|
412
455
|
result: {
|
|
413
456
|
method: string;
|
|
414
457
|
value: number;
|
|
@@ -417,11 +460,10 @@ export interface YoutubePlayerPlugin {
|
|
|
417
460
|
/**
|
|
418
461
|
* Toggle fullscreen mode on or off.
|
|
419
462
|
*
|
|
420
|
-
* @param
|
|
421
|
-
* @param isFullScreen - true for fullscreen, false for normal, null/undefined to toggle
|
|
463
|
+
* @param options - Fullscreen options
|
|
422
464
|
* @returns Promise with the fullscreen state that was set
|
|
423
465
|
*/
|
|
424
|
-
toggleFullScreen(
|
|
466
|
+
toggleFullScreen(options: ToggleFullScreenOptions): Promise<{
|
|
425
467
|
result: {
|
|
426
468
|
method: string;
|
|
427
469
|
value: boolean | null | undefined;
|
|
@@ -430,10 +472,10 @@ export interface YoutubePlayerPlugin {
|
|
|
430
472
|
/**
|
|
431
473
|
* Get the current playback quality.
|
|
432
474
|
*
|
|
433
|
-
* @param
|
|
475
|
+
* @param options - Player instance options
|
|
434
476
|
* @returns Promise with quality level (small, medium, large, hd720, hd1080, highres, default)
|
|
435
477
|
*/
|
|
436
|
-
getPlaybackQuality(
|
|
478
|
+
getPlaybackQuality(options: PlayerIdOptions): Promise<{
|
|
437
479
|
result: {
|
|
438
480
|
method: string;
|
|
439
481
|
value: IPlaybackQuality;
|
|
@@ -443,11 +485,10 @@ export interface YoutubePlayerPlugin {
|
|
|
443
485
|
* Set the suggested playback quality.
|
|
444
486
|
* Actual quality may differ based on network conditions.
|
|
445
487
|
*
|
|
446
|
-
* @param
|
|
447
|
-
* @param suggestedQuality - Desired quality level
|
|
488
|
+
* @param options - Playback quality options
|
|
448
489
|
* @returns Promise with operation result
|
|
449
490
|
*/
|
|
450
|
-
setPlaybackQuality(
|
|
491
|
+
setPlaybackQuality(options: SetPlaybackQualityOptions): Promise<{
|
|
451
492
|
result: {
|
|
452
493
|
method: string;
|
|
453
494
|
value: boolean;
|
|
@@ -456,10 +497,10 @@ export interface YoutubePlayerPlugin {
|
|
|
456
497
|
/**
|
|
457
498
|
* Get list of available quality levels for current video.
|
|
458
499
|
*
|
|
459
|
-
* @param
|
|
500
|
+
* @param options - Player instance options
|
|
460
501
|
* @returns Promise with array of available quality levels
|
|
461
502
|
*/
|
|
462
|
-
getAvailableQualityLevels(
|
|
503
|
+
getAvailableQualityLevels(options: PlayerIdOptions): Promise<{
|
|
463
504
|
result: {
|
|
464
505
|
method: string;
|
|
465
506
|
value: IPlaybackQuality[];
|
|
@@ -468,10 +509,10 @@ export interface YoutubePlayerPlugin {
|
|
|
468
509
|
/**
|
|
469
510
|
* Get the duration of the current video in seconds.
|
|
470
511
|
*
|
|
471
|
-
* @param
|
|
512
|
+
* @param options - Player instance options
|
|
472
513
|
* @returns Promise with duration in seconds
|
|
473
514
|
*/
|
|
474
|
-
getDuration(
|
|
515
|
+
getDuration(options: PlayerIdOptions): Promise<{
|
|
475
516
|
result: {
|
|
476
517
|
method: string;
|
|
477
518
|
value: number;
|
|
@@ -480,10 +521,10 @@ export interface YoutubePlayerPlugin {
|
|
|
480
521
|
/**
|
|
481
522
|
* Get the YouTube.com URL for the current video.
|
|
482
523
|
*
|
|
483
|
-
* @param
|
|
524
|
+
* @param options - Player instance options
|
|
484
525
|
* @returns Promise with video URL
|
|
485
526
|
*/
|
|
486
|
-
getVideoUrl(
|
|
527
|
+
getVideoUrl(options: PlayerIdOptions): Promise<{
|
|
487
528
|
result: {
|
|
488
529
|
method: string;
|
|
489
530
|
value: string;
|
|
@@ -493,10 +534,10 @@ export interface YoutubePlayerPlugin {
|
|
|
493
534
|
* Get the embed code for the current video.
|
|
494
535
|
* Returns HTML iframe embed code.
|
|
495
536
|
*
|
|
496
|
-
* @param
|
|
537
|
+
* @param options - Player instance options
|
|
497
538
|
* @returns Promise with iframe embed code
|
|
498
539
|
*/
|
|
499
|
-
getVideoEmbedCode(
|
|
540
|
+
getVideoEmbedCode(options: PlayerIdOptions): Promise<{
|
|
500
541
|
result: {
|
|
501
542
|
method: string;
|
|
502
543
|
value: string;
|
|
@@ -505,10 +546,10 @@ export interface YoutubePlayerPlugin {
|
|
|
505
546
|
/**
|
|
506
547
|
* Get array of video IDs in the current playlist.
|
|
507
548
|
*
|
|
508
|
-
* @param
|
|
549
|
+
* @param options - Player instance options
|
|
509
550
|
* @returns Promise with array of video IDs
|
|
510
551
|
*/
|
|
511
|
-
getPlaylist(
|
|
552
|
+
getPlaylist(options: PlayerIdOptions): Promise<{
|
|
512
553
|
result: {
|
|
513
554
|
method: string;
|
|
514
555
|
value: string[];
|
|
@@ -517,10 +558,10 @@ export interface YoutubePlayerPlugin {
|
|
|
517
558
|
/**
|
|
518
559
|
* Get the index of the currently playing video in the playlist.
|
|
519
560
|
*
|
|
520
|
-
* @param
|
|
561
|
+
* @param options - Player instance options
|
|
521
562
|
* @returns Promise with zero-based index
|
|
522
563
|
*/
|
|
523
|
-
getPlaylistIndex(
|
|
564
|
+
getPlaylistIndex(options: PlayerIdOptions): Promise<{
|
|
524
565
|
result: {
|
|
525
566
|
method: string;
|
|
526
567
|
value: number;
|
|
@@ -530,10 +571,10 @@ export interface YoutubePlayerPlugin {
|
|
|
530
571
|
* Get the iframe DOM element for the player.
|
|
531
572
|
* Web platform only.
|
|
532
573
|
*
|
|
533
|
-
* @param
|
|
574
|
+
* @param options - Player instance options
|
|
534
575
|
* @returns Promise with iframe element
|
|
535
576
|
*/
|
|
536
|
-
getIframe(
|
|
577
|
+
getIframe(options: PlayerIdOptions): Promise<{
|
|
537
578
|
result: {
|
|
538
579
|
method: string;
|
|
539
580
|
value: HTMLIFrameElement;
|
|
@@ -541,26 +582,28 @@ export interface YoutubePlayerPlugin {
|
|
|
541
582
|
}>;
|
|
542
583
|
/**
|
|
543
584
|
* Add an event listener to the player.
|
|
585
|
+
* Web platform only.
|
|
544
586
|
*
|
|
545
|
-
* @param
|
|
546
|
-
* @param eventName - Name of the event (onReady, onStateChange, onError, etc.)
|
|
547
|
-
* @param listener - Callback function to handle the event
|
|
587
|
+
* @param options - Event listener options
|
|
548
588
|
* @example
|
|
549
589
|
* ```typescript
|
|
550
|
-
* YoutubePlayer.addEventListener(
|
|
590
|
+
* YoutubePlayer.addEventListener({
|
|
591
|
+
* playerId: 'my-player',
|
|
592
|
+
* eventName: 'onStateChange',
|
|
593
|
+
* listener: (event) => {
|
|
551
594
|
* console.log('Player state:', event.data);
|
|
595
|
+
* },
|
|
552
596
|
* });
|
|
553
597
|
* ```
|
|
554
598
|
*/
|
|
555
|
-
addEventListener<TEvent extends PlayerEvent>(
|
|
599
|
+
addEventListener<TEvent extends PlayerEvent>(options: PlayerEventListenerOptions<TEvent>): void;
|
|
556
600
|
/**
|
|
557
601
|
* Remove an event listener from the player.
|
|
602
|
+
* Web platform only.
|
|
558
603
|
*
|
|
559
|
-
* @param
|
|
560
|
-
* @param eventName - Name of the event to remove listener from
|
|
561
|
-
* @param listener - The callback function to remove
|
|
604
|
+
* @param options - Event listener options
|
|
562
605
|
*/
|
|
563
|
-
removeEventListener<TEvent extends PlayerEvent>(
|
|
606
|
+
removeEventListener<TEvent extends PlayerEvent>(options: PlayerEventListenerOptions<TEvent>): void;
|
|
564
607
|
/**
|
|
565
608
|
* Get the plugin version number.
|
|
566
609
|
* Returns platform-specific version information.
|