@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/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
- import type { YoutubePlayerPlugin } from './definitions';
3
- import type { IPlayerSize, IPlayerState, IPlayerOptions, RequiredKeys, IPlaylistOptions, IPlaybackQuality, IVideoOptionsById, IVideoOptionsByUrl, Events, PlayerEvent } from './web/models/models';
2
+ import type { PlayerEventListenerOptions, PlayerIdOptions, PlayVideoAtOptions, PlaylistMethodOptions, SeekToOptions, SetLoopOptions, SetPlaybackQualityOptions, SetPlaybackRateOptions, SetShuffleOptions, SetSizeOptions, SetVolumeOptions, ToggleFullScreenOptions, VideoByIdMethodOptions, VideoByUrlMethodOptions, YoutubePlayerPlugin } from './definitions';
3
+ import type { IPlayerSize, IPlayerState, IPlayerOptions, RequiredKeys, IPlaybackQuality, IVideoOptionsById, IVideoOptionsByUrl, PlayerEvent } from './web/models/models';
4
4
  export declare function YT(): any;
5
5
  export declare function Player(): any;
6
6
  export declare function PlayerState(): any;
@@ -23,32 +23,32 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
23
23
  playerReady: boolean;
24
24
  player: string;
25
25
  } | undefined>;
26
- destroy(playerId: string): Promise<{
26
+ destroy({ playerId }: PlayerIdOptions): Promise<{
27
27
  result: {
28
28
  method: string;
29
29
  value: boolean;
30
30
  };
31
31
  }>;
32
32
  /*********/
33
- stopVideo(playerId: string): Promise<{
33
+ stopVideo({ playerId }: PlayerIdOptions): Promise<{
34
34
  result: {
35
35
  method: string;
36
36
  value: boolean;
37
37
  };
38
38
  }>;
39
- playVideo(playerId: string): Promise<{
39
+ playVideo({ playerId }: PlayerIdOptions): Promise<{
40
40
  result: {
41
41
  method: string;
42
42
  value: boolean;
43
43
  };
44
44
  }>;
45
- pauseVideo(playerId: string): Promise<{
45
+ pauseVideo({ playerId }: PlayerIdOptions): Promise<{
46
46
  result: {
47
47
  method: string;
48
48
  value: boolean;
49
49
  };
50
50
  }>;
51
- seekTo(playerId: string, seconds: number, allowSeekAhead: boolean): Promise<{
51
+ seekTo({ playerId, seconds, allowSeekAhead, }: SeekToOptions): Promise<{
52
52
  result: {
53
53
  method: string;
54
54
  value: boolean;
@@ -56,28 +56,28 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
56
56
  allowSeekAhead: boolean;
57
57
  };
58
58
  }>;
59
- loadVideoById(playerId: string, options: IVideoOptionsById): Promise<{
59
+ loadVideoById({ playerId, options, }: VideoByIdMethodOptions): Promise<{
60
60
  result: {
61
61
  method: string;
62
62
  value: boolean;
63
63
  options: IVideoOptionsById;
64
64
  };
65
65
  }>;
66
- cueVideoById(playerId: string, options: IVideoOptionsById): Promise<{
66
+ cueVideoById({ playerId, options, }: VideoByIdMethodOptions): Promise<{
67
67
  result: {
68
68
  method: string;
69
69
  value: boolean;
70
70
  options: IVideoOptionsById;
71
71
  };
72
72
  }>;
73
- loadVideoByUrl(playerId: string, options: IVideoOptionsByUrl): Promise<{
73
+ loadVideoByUrl({ playerId, options, }: VideoByUrlMethodOptions): Promise<{
74
74
  result: {
75
75
  method: string;
76
76
  value: boolean;
77
77
  options: IVideoOptionsByUrl;
78
78
  };
79
79
  }>;
80
- cueVideoByUrl(playerId: string, options: IVideoOptionsByUrl): Promise<{
80
+ cueVideoByUrl({ playerId, options, }: VideoByUrlMethodOptions): Promise<{
81
81
  result: {
82
82
  method: string;
83
83
  value: boolean;
@@ -86,13 +86,13 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
86
86
  }>;
87
87
  /*********/
88
88
  /*********/
89
- cuePlaylist(playerId: string, playlistOptions: IPlaylistOptions): Promise<{
89
+ cuePlaylist({ playerId, playlistOptions, }: PlaylistMethodOptions): Promise<{
90
90
  result: {
91
91
  method: string;
92
92
  value: boolean;
93
93
  };
94
94
  }>;
95
- loadPlaylist(playerId: string, playlistOptions: IPlaylistOptions): Promise<{
95
+ loadPlaylist({ playerId, playlistOptions, }: PlaylistMethodOptions): Promise<{
96
96
  result: {
97
97
  method: string;
98
98
  value: boolean;
@@ -100,38 +100,38 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
100
100
  }>;
101
101
  /*********/
102
102
  /*********/
103
- nextVideo(playerId: string): Promise<{
103
+ nextVideo({ playerId }: PlayerIdOptions): Promise<{
104
104
  result: {
105
105
  method: string;
106
106
  value: boolean;
107
107
  };
108
108
  }>;
109
- previousVideo(playerId: string): Promise<{
109
+ previousVideo({ playerId }: PlayerIdOptions): Promise<{
110
110
  result: {
111
111
  method: string;
112
112
  value: boolean;
113
113
  };
114
114
  }>;
115
- playVideoAt(playerId: string, index: number): Promise<{
115
+ playVideoAt({ playerId, index }: PlayVideoAtOptions): Promise<{
116
116
  result: {
117
117
  method: string;
118
118
  value: boolean;
119
119
  };
120
120
  }>;
121
121
  /*********/
122
- getPlaybackRate(playerId: string): Promise<{
122
+ getPlaybackRate({ playerId }: PlayerIdOptions): Promise<{
123
123
  result: {
124
124
  method: string;
125
125
  value: number;
126
126
  };
127
127
  }>;
128
- setPlaybackRate(playerId: string, rate: number): Promise<{
128
+ setPlaybackRate({ playerId, suggestedRate, }: SetPlaybackRateOptions): Promise<{
129
129
  result: {
130
130
  method: string;
131
131
  value: boolean;
132
132
  };
133
133
  }>;
134
- getAvailablePlaybackRates(playerId: string): Promise<{
134
+ getAvailablePlaybackRates({ playerId, }: PlayerIdOptions): Promise<{
135
135
  result: {
136
136
  method: string;
137
137
  value: number[];
@@ -140,13 +140,13 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
140
140
  /*********/
141
141
  /*********/
142
142
  /*********/
143
- setLoop(playerId: string, loop: boolean): Promise<{
143
+ setLoop({ playerId, loopPlaylists }: SetLoopOptions): Promise<{
144
144
  result: {
145
145
  method: string;
146
146
  value: boolean;
147
147
  };
148
148
  }>;
149
- setShuffle(playerId: string, shuffle: boolean): Promise<{
149
+ setShuffle({ playerId, shufflePlaylist, }: SetShuffleOptions): Promise<{
150
150
  result: {
151
151
  method: string;
152
152
  value: boolean;
@@ -154,31 +154,31 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
154
154
  }>;
155
155
  /*********/
156
156
  /*********/
157
- mute(playerId: string): Promise<{
157
+ mute({ playerId }: PlayerIdOptions): Promise<{
158
158
  result: {
159
159
  method: string;
160
160
  value: boolean;
161
161
  };
162
162
  }>;
163
- unMute(playerId: string): Promise<{
163
+ unMute({ playerId }: PlayerIdOptions): Promise<{
164
164
  result: {
165
165
  method: string;
166
166
  value: boolean;
167
167
  };
168
168
  }>;
169
- isMuted(playerId: string): Promise<{
169
+ isMuted({ playerId }: PlayerIdOptions): Promise<{
170
170
  result: {
171
171
  method: string;
172
172
  value: boolean;
173
173
  };
174
174
  }>;
175
- setVolume(playerId: string, volume: number): Promise<{
175
+ setVolume({ playerId, volume }: SetVolumeOptions): Promise<{
176
176
  result: {
177
177
  method: string;
178
178
  value: number;
179
179
  };
180
180
  }>;
181
- getVolume(playerId: string): Promise<{
181
+ getVolume({ playerId }: PlayerIdOptions): Promise<{
182
182
  result: {
183
183
  method: string;
184
184
  value: number;
@@ -186,7 +186,7 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
186
186
  }>;
187
187
  /*********/
188
188
  /*********/
189
- setSize(playerId: string, width: number, height: number): Promise<{
189
+ setSize({ playerId, width, height, }: SetSizeOptions): Promise<{
190
190
  result: {
191
191
  method: string;
192
192
  value: IPlayerSize;
@@ -194,13 +194,13 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
194
194
  }>;
195
195
  /*********/
196
196
  /*********/
197
- getVideoLoadedFraction(playerId: string): Promise<{
197
+ getVideoLoadedFraction({ playerId }: PlayerIdOptions): Promise<{
198
198
  result: {
199
199
  method: string;
200
200
  value: number;
201
201
  };
202
202
  }>;
203
- getPlayerState(playerId: string): Promise<{
203
+ getPlayerState({ playerId }: PlayerIdOptions): Promise<{
204
204
  result: {
205
205
  method: string;
206
206
  value: number;
@@ -212,13 +212,13 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
212
212
  value: Map<string, IPlayerState>;
213
213
  };
214
214
  }>;
215
- getCurrentTime(playerId: string): Promise<{
215
+ getCurrentTime({ playerId }: PlayerIdOptions): Promise<{
216
216
  result: {
217
217
  method: string;
218
218
  value: number;
219
219
  };
220
220
  }>;
221
- toggleFullScreen(playerId: string, isFullScreen: boolean | null | undefined): Promise<{
221
+ toggleFullScreen({ playerId, isFullScreen, }: ToggleFullScreenOptions): Promise<{
222
222
  result: {
223
223
  method: string;
224
224
  value: boolean | null | undefined;
@@ -226,19 +226,19 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
226
226
  }>;
227
227
  /*********/
228
228
  /*********/
229
- getPlaybackQuality(playerId: string): Promise<{
229
+ getPlaybackQuality({ playerId, }: PlayerIdOptions): Promise<{
230
230
  result: {
231
231
  method: string;
232
232
  value: IPlaybackQuality;
233
233
  };
234
234
  }>;
235
- setPlaybackQuality(playerId: string, playbackQuality: IPlaybackQuality): Promise<{
235
+ setPlaybackQuality({ playerId, suggestedQuality, }: SetPlaybackQualityOptions): Promise<{
236
236
  result: {
237
237
  method: string;
238
238
  value: boolean;
239
239
  };
240
240
  }>;
241
- getAvailableQualityLevels(playerId: string): Promise<{
241
+ getAvailableQualityLevels({ playerId, }: PlayerIdOptions): Promise<{
242
242
  result: {
243
243
  method: string;
244
244
  value: IPlaybackQuality[];
@@ -246,19 +246,19 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
246
246
  }>;
247
247
  /*********/
248
248
  /*********/
249
- getDuration(playerId: string): Promise<{
249
+ getDuration({ playerId }: PlayerIdOptions): Promise<{
250
250
  result: {
251
251
  method: string;
252
252
  value: number;
253
253
  };
254
254
  }>;
255
- getVideoUrl(playerId: string): Promise<{
255
+ getVideoUrl({ playerId }: PlayerIdOptions): Promise<{
256
256
  result: {
257
257
  method: string;
258
258
  value: string;
259
259
  };
260
260
  }>;
261
- getVideoEmbedCode(playerId: string): Promise<{
261
+ getVideoEmbedCode({ playerId }: PlayerIdOptions): Promise<{
262
262
  result: {
263
263
  method: string;
264
264
  value: string;
@@ -266,13 +266,13 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
266
266
  }>;
267
267
  /*********/
268
268
  /*********/
269
- getPlaylist(playerId: string): Promise<{
269
+ getPlaylist({ playerId }: PlayerIdOptions): Promise<{
270
270
  result: {
271
271
  method: string;
272
272
  value: string[];
273
273
  };
274
274
  }>;
275
- getPlaylistIndex(playerId: string): Promise<{
275
+ getPlaylistIndex({ playerId }: PlayerIdOptions): Promise<{
276
276
  result: {
277
277
  method: string;
278
278
  value: number;
@@ -280,15 +280,15 @@ export declare class YoutubePlayerPluginWeb extends WebPlugin implements Youtube
280
280
  }>;
281
281
  /*********/
282
282
  /*********/
283
- getIframe(playerId: string): Promise<{
283
+ getIframe({ playerId }: PlayerIdOptions): Promise<{
284
284
  result: {
285
285
  method: string;
286
286
  value: HTMLIFrameElement;
287
287
  };
288
288
  }>;
289
289
  /*********/
290
- addEventListener<TEvent extends PlayerEvent>(playerId: string, eventName: keyof Events, listener: (event: TEvent) => void): void;
291
- removeEventListener<TEvent extends PlayerEvent>(playerId: string, eventName: keyof Events, listener: (event: TEvent) => void): void;
290
+ addEventListener<TEvent extends PlayerEvent>({ playerId, eventName, listener, }: PlayerEventListenerOptions<TEvent>): void;
291
+ removeEventListener<TEvent extends PlayerEvent>({ playerId, eventName, listener, }: PlayerEventListenerOptions<TEvent>): void;
292
292
  /*********/
293
293
  getPluginVersion(): Promise<{
294
294
  version: string;
package/dist/esm/web.js CHANGED
@@ -168,7 +168,7 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
168
168
  return Promise.resolve(playerReady);
169
169
  }
170
170
  }
171
- async destroy(playerId) {
171
+ async destroy({ playerId }) {
172
172
  this.playerLogger.log(`player "${playerId}" -> destroy`);
173
173
  this.players[playerId].destroy();
174
174
  return Promise.resolve({ result: { method: 'destroy', value: true } });
@@ -178,27 +178,27 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
178
178
  // Stops and cancels loading of the current video. This function should be reserved for rare situations when you know that the user will not be watching
179
179
  // additional video in the player. If your intent is to pause the video, you should just call the pauseVideo function. If you want to change the video
180
180
  // that the player is playing, you can call one of the queueing functions without calling stopVideo first.
181
- async stopVideo(playerId) {
181
+ async stopVideo({ playerId }) {
182
182
  this.playerLogger.log(`player "${playerId}" -> stopVideo`);
183
183
  this.players[playerId].stopVideo();
184
184
  return Promise.resolve({ result: { method: 'stopVideo', value: true } });
185
185
  }
186
186
  // Plays the currently cued/loaded video. The final player state after this function executes will be playing (1).
187
- async playVideo(playerId) {
187
+ async playVideo({ playerId }) {
188
188
  this.playerLogger.log(`player "${playerId}" -> playVideo`);
189
189
  this.players[playerId].playVideo();
190
190
  return Promise.resolve({ result: { method: 'playVideo', value: true } });
191
191
  }
192
192
  // Pauses the currently playing video. The final player state after this function executes will be paused (2) unless the player is in the ended (0)
193
193
  // state when the function is called, in which case the player state will not change.
194
- async pauseVideo(playerId) {
194
+ async pauseVideo({ playerId }) {
195
195
  this.playerLogger.log(`player "${playerId}" -> pauseVideo`);
196
196
  this.players[playerId].pauseVideo();
197
197
  return Promise.resolve({ result: { method: 'pauseVideo', value: true } });
198
198
  }
199
199
  // Seeks to a specified time in the video. If the player is paused when the function is called, it will remain paused. If the function is called from
200
200
  // another state (playing, video cued, etc.), the player will play the video.
201
- async seekTo(playerId, seconds, allowSeekAhead) {
201
+ async seekTo({ playerId, seconds, allowSeekAhead, }) {
202
202
  this.playerLogger.log(`player "${playerId}" -> seekTo ${seconds} seconds`);
203
203
  this.players[playerId].seekTo(seconds, allowSeekAhead);
204
204
  return Promise.resolve({
@@ -206,23 +206,23 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
206
206
  });
207
207
  }
208
208
  // Loads and plays the specified video.
209
- async loadVideoById(playerId, options) {
209
+ async loadVideoById({ playerId, options, }) {
210
210
  this.playerLogger.log(`player "${playerId}" -> loadVideoById with options ${options}`);
211
211
  this.players[playerId].loadVideoById(options);
212
212
  return Promise.resolve({ result: { method: 'loadVideoById', value: true, options: options } });
213
213
  }
214
214
  // Loads the specified video's thumbnail and prepares the player to play the video. The player does not request the FLV until playVideo() or seekTo() is called.
215
- async cueVideoById(playerId, options) {
215
+ async cueVideoById({ playerId, options, }) {
216
216
  this.playerLogger.log(`player "${playerId}" -> cueVideoById with options ${options}`);
217
217
  this.players[playerId].cueVideoById(options);
218
218
  return Promise.resolve({ result: { method: 'cueVideoById', value: true, options: options } });
219
219
  }
220
- async loadVideoByUrl(playerId, options) {
220
+ async loadVideoByUrl({ playerId, options, }) {
221
221
  this.playerLogger.log(`player "${playerId}" -> loadVideoByUrl with options ${options}`);
222
222
  this.players[playerId].loadVideoByUrl(options);
223
223
  return Promise.resolve({ result: { method: 'loadVideoByUrl', value: true, options: options } });
224
224
  }
225
- async cueVideoByUrl(playerId, options) {
225
+ async cueVideoByUrl({ playerId, options, }) {
226
226
  this.playerLogger.log(`player "${playerId}" -> cueVideoByUrl with options ${options}`);
227
227
  this.players[playerId].cueVideoByUrl(options);
228
228
  return Promise.resolve({ result: { method: 'cueVideoByUrl', value: true, options: options } });
@@ -230,12 +230,12 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
230
230
  /*********/
231
231
  // Methods for playing playlist.
232
232
  /*********/
233
- async cuePlaylist(playerId, playlistOptions) {
233
+ async cuePlaylist({ playerId, playlistOptions, }) {
234
234
  this.playerLogger.log(`player "${playerId}" -> cuePlaylist with options ${JSON.stringify(playlistOptions)}`);
235
235
  this.players[playerId].cuePlaylist(playlistOptions);
236
236
  return Promise.resolve({ result: { method: 'cuePlaylist', value: true } });
237
237
  }
238
- async loadPlaylist(playerId, playlistOptions) {
238
+ async loadPlaylist({ playerId, playlistOptions, }) {
239
239
  this.playerLogger.log(`player "${playerId}" -> loadPlaylist with options ${playlistOptions}`);
240
240
  this.players[playerId].loadPlaylist(playlistOptions);
241
241
  return Promise.resolve({ result: { method: 'loadPlaylist', value: true } });
@@ -243,33 +243,33 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
243
243
  /*********/
244
244
  // Methods for playing video in playlist.
245
245
  /*********/
246
- async nextVideo(playerId) {
246
+ async nextVideo({ playerId }) {
247
247
  this.playerLogger.log(`player "${playerId}" -> nextVideo`);
248
248
  this.players[playerId].nextVideo();
249
249
  return Promise.resolve({ result: { method: 'nextVideo', value: true } });
250
250
  }
251
- async previousVideo(playerId) {
251
+ async previousVideo({ playerId }) {
252
252
  this.playerLogger.log(`player "${playerId}" -> previousVideo`);
253
253
  this.players[playerId].previousVideo();
254
254
  return Promise.resolve({ result: { method: 'previousVideo', value: true } });
255
255
  }
256
- async playVideoAt(playerId, index) {
256
+ async playVideoAt({ playerId, index }) {
257
257
  this.playerLogger.log(`player "${playerId}" -> playVideoAt`);
258
258
  this.players[playerId].playVideoAt(index);
259
259
  return Promise.resolve({ result: { method: 'playVideoAt', value: true } });
260
260
  }
261
261
  /*********/
262
262
  // Methods for adjusting the playback speed.
263
- async getPlaybackRate(playerId) {
263
+ async getPlaybackRate({ playerId }) {
264
264
  this.playerLogger.log(`player "${playerId}" -> getPlaybackRate`);
265
265
  return Promise.resolve({ result: { method: 'getPlaybackRate', value: this.players[playerId].getPlaybackRate() } });
266
266
  }
267
- async setPlaybackRate(playerId, rate) {
267
+ async setPlaybackRate({ playerId, suggestedRate, }) {
268
268
  this.playerLogger.log(`player "${playerId}" -> setPlaybackRate`);
269
- this.players[playerId].setPlaybackRate(rate);
269
+ this.players[playerId].setPlaybackRate(suggestedRate);
270
270
  return Promise.resolve({ result: { method: 'setPlaybackRate', value: true } });
271
271
  }
272
- async getAvailablePlaybackRates(playerId) {
272
+ async getAvailablePlaybackRates({ playerId, }) {
273
273
  this.playerLogger.log(`player -> getAvailablePlaybackRates`);
274
274
  return Promise.resolve({
275
275
  result: { method: 'getAvailablePlaybackRates', value: this.players[playerId].getAvailablePlaybackRates() },
@@ -279,44 +279,44 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
279
279
  /*********/
280
280
  // Methods for playlist playback settings
281
281
  /*********/
282
- async setLoop(playerId, loop) {
282
+ async setLoop({ playerId, loopPlaylists }) {
283
283
  this.playerLogger.log(`player "${playerId}" -> setLoop`);
284
- this.players[playerId].setLoop(loop);
284
+ this.players[playerId].setLoop(loopPlaylists);
285
285
  return Promise.resolve({ result: { method: 'setLoop', value: true } });
286
286
  }
287
- async setShuffle(playerId, shuffle) {
287
+ async setShuffle({ playerId, shufflePlaylist, }) {
288
288
  this.playerLogger.log(`player "${playerId}" -> setShuffle`);
289
- this.players[playerId].setShuffle(shuffle);
289
+ this.players[playerId].setShuffle(shufflePlaylist);
290
290
  return Promise.resolve({ result: { method: 'setShuffle', value: true } });
291
291
  }
292
292
  /*********/
293
293
  // Methods changing the player volume.
294
294
  /*********/
295
295
  // Mutes the player.
296
- async mute(playerId) {
296
+ async mute({ playerId }) {
297
297
  this.playerLogger.log(`player "${playerId}" -> mute`);
298
298
  this.players[playerId].mute();
299
299
  return Promise.resolve({ result: { method: 'mute', value: true } });
300
300
  }
301
301
  // Unmutes the player.
302
- async unMute(playerId) {
302
+ async unMute({ playerId }) {
303
303
  this.playerLogger.log(`player "${playerId}" -> unMute`);
304
304
  this.players[playerId].unMute();
305
305
  return Promise.resolve({ result: { method: 'unMute', value: true } });
306
306
  }
307
307
  // Returns true if the player is muted, false if not.
308
- async isMuted(playerId) {
308
+ async isMuted({ playerId }) {
309
309
  this.playerLogger.log(`player "${playerId}" -> isMuted`);
310
310
  return Promise.resolve({ result: { method: 'isMuted', value: this.players[playerId].isMuted() } });
311
311
  }
312
312
  // Sets the volume. Accepts an integer between 0 and 100.
313
- async setVolume(playerId, volume) {
313
+ async setVolume({ playerId, volume }) {
314
314
  this.playerLogger.log(`player "${playerId}" -> setVolume ${volume}`);
315
315
  this.players[playerId].setVolume(volume);
316
316
  return Promise.resolve({ result: { method: 'setVolume', value: volume } });
317
317
  }
318
318
  // Returns the player's current volume, an integer between 0 and 100. Note that getVolume() will return the volume even if the player is muted.
319
- async getVolume(playerId) {
319
+ async getVolume({ playerId }) {
320
320
  this.playerLogger.log(`player "${playerId}" -> getVolume`);
321
321
  return Promise.resolve({ result: { method: 'getVolume', value: this.players[playerId].getVolume() } });
322
322
  }
@@ -324,7 +324,7 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
324
324
  // Methods setting the player size.
325
325
  /*********/
326
326
  // Sets the size in pixels of the <iframe> that contains the player.
327
- async setSize(playerId, width, height) {
327
+ async setSize({ playerId, width, height, }) {
328
328
  this.playerLogger.log(`player "${playerId}" -> setSize width: ${width} height: ${height}`);
329
329
  this.players[playerId].setSize(width, height);
330
330
  return Promise.resolve({ result: { method: 'setSize', value: { width: width, height: height } } });
@@ -334,7 +334,7 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
334
334
  /*********/
335
335
  // Returns a number between 0 and 1 that specifies the percentage of the video that the player shows as buffered.
336
336
  // This method returns a more reliable number than the now-deprecated getVideoBytesLoaded and getVideoBytesTotal methods.
337
- async getVideoLoadedFraction(playerId) {
337
+ async getVideoLoadedFraction({ playerId }) {
338
338
  this.playerLogger.log(`player "${playerId}" -> getVideoLoadedFraction`);
339
339
  return Promise.resolve({
340
340
  result: { method: 'getVideoLoadedFraction', value: this.players[playerId].getVideoLoadedFraction() },
@@ -347,7 +347,7 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
347
347
  // 2 – paused
348
348
  // 3 – buffering
349
349
  // 5 – video cued
350
- async getPlayerState(playerId) {
350
+ async getPlayerState({ playerId }) {
351
351
  this.playerLogger.log(`player "${playerId}" -> getPlayerState`);
352
352
  return Promise.resolve({ result: { method: 'getPlayerState', value: this.players[playerId].getPlayerState() } });
353
353
  }
@@ -356,11 +356,11 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
356
356
  return Promise.resolve({ result: { method: 'getAllPlayersEventsState', value: this.playersEventsState } });
357
357
  }
358
358
  // Returns the elapsed time in seconds since the video started playing.
359
- async getCurrentTime(playerId) {
359
+ async getCurrentTime({ playerId }) {
360
360
  this.playerLogger.log(`player "${playerId}" -> getCurrentTime`);
361
361
  return Promise.resolve({ result: { method: 'getCurrentTime', value: this.players[playerId].getCurrentTime() } });
362
362
  }
363
- async toggleFullScreen(playerId, isFullScreen) {
363
+ async toggleFullScreen({ playerId, isFullScreen, }) {
364
364
  this.playerLogger.log(`player "${playerId}" -> toggleFullScreen`);
365
365
  let { height, width } = this.defaultSizes;
366
366
  if (!isFullScreen) {
@@ -373,18 +373,18 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
373
373
  /*********/
374
374
  // Methods playback quality.
375
375
  /*********/
376
- async getPlaybackQuality(playerId) {
376
+ async getPlaybackQuality({ playerId, }) {
377
377
  this.playerLogger.log(`player "${playerId}" -> getPlaybackQuality`);
378
378
  return Promise.resolve({
379
379
  result: { method: 'getPlaybackQuality', value: this.players[playerId].getPlaybackQuality() },
380
380
  });
381
381
  }
382
- async setPlaybackQuality(playerId, playbackQuality) {
382
+ async setPlaybackQuality({ playerId, suggestedQuality, }) {
383
383
  this.playerLogger.log(`player "${playerId}" -> setPlaybackQuality`);
384
- this.players[playerId].setPlaybackQuality(playbackQuality);
384
+ this.players[playerId].setPlaybackQuality(suggestedQuality);
385
385
  return Promise.resolve({ result: { method: 'setPlaybackQuality', value: true } });
386
386
  }
387
- async getAvailableQualityLevels(playerId) {
387
+ async getAvailableQualityLevels({ playerId, }) {
388
388
  this.playerLogger.log(`player "${playerId}" -> getAvailableQualityLevels`);
389
389
  return Promise.resolve({
390
390
  result: { method: 'getAvailableQualityLevels', value: this.players[playerId].getAvailableQualityLevels() },
@@ -393,15 +393,15 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
393
393
  /*********/
394
394
  // Methods for retrieving video information.
395
395
  /*********/
396
- async getDuration(playerId) {
396
+ async getDuration({ playerId }) {
397
397
  this.playerLogger.log(`player "${playerId}" -> getDuration`);
398
398
  return Promise.resolve({ result: { method: 'getDuration', value: this.players[playerId].getDuration() } });
399
399
  }
400
- async getVideoUrl(playerId) {
400
+ async getVideoUrl({ playerId }) {
401
401
  this.playerLogger.log(`player "${playerId}" -> getVideoUrl`);
402
402
  return Promise.resolve({ result: { method: 'getVideoUrl', value: this.players[playerId].getVideoUrl() } });
403
403
  }
404
- async getVideoEmbedCode(playerId) {
404
+ async getVideoEmbedCode({ playerId }) {
405
405
  this.playerLogger.log(`player "${playerId}" -> getVideoEmbedCode`);
406
406
  return Promise.resolve({
407
407
  result: { method: 'getVideoEmbedCode', value: this.players[playerId].getVideoEmbedCode() },
@@ -410,11 +410,11 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
410
410
  /*********/
411
411
  // Methods for retrieving playlist information.
412
412
  /*********/
413
- async getPlaylist(playerId) {
413
+ async getPlaylist({ playerId }) {
414
414
  this.playerLogger.log(`player "${playerId}" -> getPlaylist`);
415
415
  return Promise.resolve({ result: { method: 'getPlaylist', value: this.players[playerId].getPlaylist() } });
416
416
  }
417
- async getPlaylistIndex(playerId) {
417
+ async getPlaylistIndex({ playerId }) {
418
418
  this.playerLogger.log(`player "${playerId}" -> getPlaylistIndex`);
419
419
  return Promise.resolve({
420
420
  result: { method: 'getPlaylistIndex', value: this.players[playerId].getPlaylistIndex() },
@@ -423,17 +423,17 @@ export class YoutubePlayerPluginWeb extends WebPlugin {
423
423
  /*********/
424
424
  // Methods accessing and modifying DOM nodes.
425
425
  /*********/
426
- async getIframe(playerId) {
426
+ async getIframe({ playerId }) {
427
427
  this.playerLogger.log(`player "${playerId}" -> getIframe`);
428
428
  return Promise.resolve({ result: { method: 'getIframe', value: this.players[playerId].getIframe() } });
429
429
  }
430
430
  /*********/
431
431
  // Player event listeners.
432
- addEventListener(playerId, eventName, listener) {
432
+ addEventListener({ playerId, eventName, listener, }) {
433
433
  this.playerLogger.log(`player "${playerId}" -> addEventListener "${eventName}"`);
434
434
  this.players[playerId].addEventListener(eventName, listener);
435
435
  }
436
- removeEventListener(playerId, eventName, listener) {
436
+ removeEventListener({ playerId, eventName, listener, }) {
437
437
  this.playerLogger.log(`player "${playerId}" -> removeEventListener "${eventName}"`);
438
438
  this.players[playerId].removeEventListener(eventName, listener);
439
439
  }