tiny-essentials 1.28.4 → 1.28.6
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 +18 -1
- package/changelog/1/28/5.md +31 -0
- package/changelog/1/28/6.md +11 -0
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/basics/index.cjs +4 -0
- package/dist/v1/basics/index.d.mts +3 -2
- package/dist/v1/basics/index.mjs +3 -2
- package/dist/v1/basics/mediaContent.cjs +1 -0
- package/dist/v1/basics/mediaContent.d.mts +4 -0
- package/dist/v1/basics/mediaContent.mjs +1 -0
- package/dist/v1/basics/objChecker.cjs +16 -0
- package/dist/v1/basics/objChecker.d.mts +12 -0
- package/dist/v1/basics/objChecker.mjs +14 -0
- package/dist/v1/basics/objFilter.cjs +0 -2
- package/dist/v1/basics/objFilter.d.mts +0 -2
- package/dist/v1/basics/objFilter.mjs +1 -2
- package/dist/v1/basics/promiseUtils.cjs +101 -0
- package/dist/v1/basics/promiseUtils.d.mts +31 -0
- package/dist/v1/basics/promiseUtils.mjs +89 -0
- package/dist/v1/css/TinyLoadingScreen.min.css +1 -1
- package/dist/v1/index.cjs +4 -0
- package/dist/v1/index.d.mts +3 -2
- package/dist/v1/index.mjs +3 -2
- package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.cjs +318 -0
- package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.d.mts +143 -0
- package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.mjs +283 -0
- package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.cjs +315 -0
- package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.d.mts +143 -0
- package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.mjs +280 -0
- package/dist/v1/libs/TinyMediaPlayer/SoundCloud.cjs +792 -0
- package/dist/v1/libs/TinyMediaPlayer/SoundCloud.d.mts +300 -0
- package/dist/v1/libs/TinyMediaPlayer/SoundCloud.mjs +697 -0
- package/dist/v1/libs/TinyMediaPlayer/Youtube.cjs +783 -0
- package/dist/v1/libs/TinyMediaPlayer/Youtube.d.mts +355 -0
- package/dist/v1/libs/TinyMediaPlayer/Youtube.mjs +694 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.cjs +381 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.d.mts +704 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.mjs +343 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.cjs +546 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.d.mts +657 -0
- package/dist/v1/libs/TinyMediaPlayer/docs/YouTubePlayer.mjs +480 -0
- package/dist/v1/libs/TinyMediaPlayer/index.cjs +216 -0
- package/dist/v1/libs/TinyMediaPlayer/index.d.mts +162 -0
- package/dist/v1/libs/TinyMediaPlayer/index.mjs +190 -0
- package/dist/v1/libs/TinyMediaPlayer.cjs +627 -103
- package/dist/v1/libs/TinyMediaPlayer.d.mts +163 -65
- package/dist/v1/libs/TinyMediaPlayer.mjs +573 -93
- package/dist/v1/libs/TinyTimeout.cjs +4 -14
- package/dist/v1/libs/TinyTimeout.d.mts +1 -0
- package/dist/v1/libs/TinyTimeout.mjs +4 -13
- package/docs/v1/basics/mediaContent.md +1 -1
- package/docs/v1/basics/objChecker.md +13 -0
- package/docs/v1/basics/promiseUtils.md +32 -0
- package/docs/v1/libs/TinyMediaPlayer.md +268 -39
- package/docs/v1/libs/TinyTimeout.md +1 -14
- package/package.json +71 -10
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* https://developers.google.com/youtube/iframe_api_reference
|
|
5
|
+
* @fileoverview JSDoc type definitions for the YouTube IFrame Player API.
|
|
6
|
+
* This file provides full IntelliSense/autocomplete for the global `window.YT` object.
|
|
7
|
+
* @module youtube-api-docs
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents the current state of the player.
|
|
12
|
+
* @typedef {-1|0|1|2|3|5} YTPlayerState
|
|
13
|
+
* @property {-1} UNSTARTED - The video has not been started.
|
|
14
|
+
* @property {0} ENDED - The video has ended.
|
|
15
|
+
* @property {1} PLAYING - The video is playing.
|
|
16
|
+
* @property {2} PAUSED - The video is paused.
|
|
17
|
+
* @property {3} BUFFERING - The video is buffering.
|
|
18
|
+
* @property {5} CUED - The video is cued and ready to play.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the player error codes.
|
|
23
|
+
* @typedef {2|5|100|101|150} YTPlayerErrors
|
|
24
|
+
* @property {2} INVALIDPARAM - The request contains an invalid parameter value (e.g., invalid video ID).
|
|
25
|
+
* @property {5} INVALIDPLAYER - The content cannot be played in an HTML5 player or an HTML5 error occurred.
|
|
26
|
+
* @property {100} NOTFOUND - The requested video was not found (removed or private).
|
|
27
|
+
* @property {101} NOTALLOWED - The owner does not allow playback in embedded players.
|
|
28
|
+
* @property {150} NOTALLOWED_REDUNDANT - Same as 101.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The playback quality string.
|
|
33
|
+
* @typedef {'small'|'medium'|'large'|'hd720'|'hd1080'|'highres'} YTQuality
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Properties for 360° video playback, defining the viewing angle.
|
|
38
|
+
* @typedef {Object} YTSphericalProperties
|
|
39
|
+
* @property {number} yaw - Horizontal angle of view [0, 360].
|
|
40
|
+
* @property {number} pitch - Vertical angle of view [-90, 90].
|
|
41
|
+
* @property {number} roll - Rotational angle [-180, 180].
|
|
42
|
+
* @property {number} fov - Field of view [30, 120].
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Base structure for all YouTube Player Events.
|
|
47
|
+
* @typedef {Object} YouTubePlayerEventBase
|
|
48
|
+
* @property {YouTubePlayer} target - The player object that emitted the event.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Called when the player is ready to accept commands.
|
|
53
|
+
* @typedef {(event: YouTubePlayerEventBase) => void} OnReadyEvent
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Called when the video playback state changes (e.g., playing, paused).
|
|
58
|
+
* @typedef {(event: YouTubePlayerEventBase & { data: YTPlayerState }) => void} OnStateChangeEvent
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Called when an error occurs during video processing or playback.
|
|
63
|
+
* @typedef {(event: YouTubePlayerEventBase & { data: YTPlayerErrors }) => void} OnErrorEvent
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Called specifically when the playback quality setting is updated.
|
|
68
|
+
* @typedef {(event: YouTubePlayerEventBase & { data: YTQuality }) => void} OnPlaybackQualityChangeEvent
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Called when the video's speed (playback rate) changes or is set.
|
|
73
|
+
* @typedef {(event: YouTubePlayerEventBase & { data: number }) => void} OnPlaybackRateChangeEvent
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Called when a change occurs within the API module itself.
|
|
78
|
+
* @typedef {(event: YouTubePlayerEventBase & { data: any }) => void} OnApiChangeEvent
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Called when automatic playback is specifically blocked by the browser or platform rules.
|
|
83
|
+
* @typedef {(event: YouTubePlayerEventBase) => void} OnAutoplayBlockedEvent
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Container object for configuring event listeners on the player instance.
|
|
88
|
+
* @typedef {Object} YTPlayerOptionsEvents
|
|
89
|
+
* @property {OnReadyEvent} [onReady] - Called when the player is ready.
|
|
90
|
+
* @property {OnStateChangeEvent} [onStateChange] - Called when the state changes.
|
|
91
|
+
* @property {OnErrorEvent} [onError] - Called when an error occurs.
|
|
92
|
+
* @property {OnPlaybackQualityChangeEvent} [onPlaybackQualityChange] - Called when quality changes.
|
|
93
|
+
* @property {OnPlaybackRateChangeEvent} [onPlaybackRateChange] - Called when playback rate changes.
|
|
94
|
+
* @property {OnApiChangeEvent} [onApiChange] - Called when the API module changes.
|
|
95
|
+
* @property {OnAutoplayBlockedEvent} [onAutoplayBlocked] - Called when autoplay is blocked.
|
|
96
|
+
*/
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Configuration options for initializing the YouTube Player instance.
|
|
100
|
+
* @typedef {Object} YTPlayerOptions
|
|
101
|
+
* @property {number|string} [width=640] - Desired width of the player frame in pixels.
|
|
102
|
+
* @property {number|string} [height=390] - Desired height of the player frame in pixels.
|
|
103
|
+
* @property {string} [videoId] - The unique identifier for the YouTube video to load.
|
|
104
|
+
* @property {Object<string, any>} [playerVars] - Additional configuration parameters passed to the player.
|
|
105
|
+
* @property {YTPlayerOptionsEvents} [events] - An object containing event listeners to handle specific player events.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* List of valid names for all YouTube Player Event listeners.
|
|
110
|
+
* @typedef {'onReady'|'onStateChange'|'onError'|'onPlaybackQualityChange'|'onPlaybackRateChange'|'onApiChange'|'onAutoplayBlocked'} EventNames
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Options specifically used when queuing or loading a playlist.
|
|
115
|
+
* @typedef {Object} YTPlaylistOptions
|
|
116
|
+
* @property {'playlist'|'user_uploads'} [listType='playlist'] - Specifies whether to use a standard playlist or user uploads feed.
|
|
117
|
+
* @property {string|string[]} list - The ID of the target playlist or an array containing multiple video IDs.
|
|
118
|
+
* @property {number} [index=0] - The zero-based index of the first video that should be played from the list.
|
|
119
|
+
* @property {number} [startSeconds] - The specific time in seconds where the playback of the first video should begin.
|
|
120
|
+
*/
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Options used to cue or load a video based on its full media URL.
|
|
124
|
+
* @typedef {Object} VideoByUrlOptions
|
|
125
|
+
* @property {string} mediaContentUrl - The complete URL pointing to the desired YouTube video resource.
|
|
126
|
+
* @property {number} [startSeconds] - Optional time in seconds to begin playback from within the video.
|
|
127
|
+
* @property {number} [endSeconds] - Optional time in seconds when playback should stop within the video.
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Options used to cue or load a video based on its unique ID.
|
|
132
|
+
* @typedef {Object} VideoByIdOptions
|
|
133
|
+
* @property {string} videoId - The unique identifier of the target YouTube video.
|
|
134
|
+
* @property {number} [startSeconds] - Optional time in seconds to begin playback from within the video.
|
|
135
|
+
* @property {number} [endSeconds] - Optional time in seconds when playback should stop within the video.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Detailed data object representing the current status and metadata of a loaded YouTube video.
|
|
140
|
+
* @typedef {Object} VideoData
|
|
141
|
+
* @property {boolean|null} allowLiveDvr - Whether DVR capabilities are permitted for live content.
|
|
142
|
+
* @property {string|null} author - The name or ID of the video creator.
|
|
143
|
+
* @property {boolean|null} backgroundable - Indicates if the video can be played in the background while minimized.
|
|
144
|
+
* @property {string|null} cpn - Content Protection Network identifier.
|
|
145
|
+
* @property {number|null} errorCode - A specific error code if playback failed.
|
|
146
|
+
* @property {string|null} eventId - An ID related to a specific content event.
|
|
147
|
+
* @property {boolean|null} hasProgressBarBoundaries - Flag indicating if the progress bar has defined start/end boundaries.
|
|
148
|
+
* @property {boolean|null} isListed - Indicates if the video belongs to a list or series.
|
|
149
|
+
* @property {boolean|null} isLive - True if the content is currently streaming live.
|
|
150
|
+
* @property {boolean|null} isManifestless - Flag indicating if manifest files are not being used for streaming.
|
|
151
|
+
* @property {boolean|null} isMultiChannelAudio - Indicates support for multiple audio channels.
|
|
152
|
+
* @property {boolean|null} isPlayable - Overall flag indicating the video can be played by the player.
|
|
153
|
+
* @property {boolean|null} isPremiere - True if the content is a scheduled premiere.
|
|
154
|
+
* @property {boolean|null} isSeekable - Whether random access seeking within the video is allowed.
|
|
155
|
+
* @property {boolean|null} isWindowedLive - Indicates if it is a windowed live event.
|
|
156
|
+
* @property {string|null} itct - Indicator of Interactivity Content Tracking tag.
|
|
157
|
+
* @property {number|null} paidContentOverlayDurationMs - Duration in milliseconds for paid content overlays.
|
|
158
|
+
* @property {string|null} playerResponseCpn - Content Protection Network response identifier from the player itself.
|
|
159
|
+
* @property {number|null} progressBarEndPositionUtcTimeMillis - UTC time in milliseconds for the end of the video's progress bar.
|
|
160
|
+
* @property {number|null} progressBarStartPositionUtcTimeMillis - UTC time in milliseconds for the start of the video's progress bar.
|
|
161
|
+
* @property {string|null} title - The descriptive title of the video.
|
|
162
|
+
* @property {string|null} video_id - The unique ID string of the video content.
|
|
163
|
+
*/
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* The main YouTube Player class instance. Manages all player interactions and state.
|
|
167
|
+
*/
|
|
168
|
+
class YouTubePlayer {
|
|
169
|
+
/**
|
|
170
|
+
* Constructor for the YouTube Player. Initializes the player element.
|
|
171
|
+
* @param {string|HTMLElement} element - The DOM element or its ID where the player iframe will be inserted.
|
|
172
|
+
* @param {YTPlayerOptions} [options] - Optional configuration settings for the player initialization.
|
|
173
|
+
*/
|
|
174
|
+
constructor(element, options) {}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Stores and retrieves the title of the currently loaded video.
|
|
178
|
+
* @type {string|null|undefined}
|
|
179
|
+
*/
|
|
180
|
+
videoTitle = '';
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Retrieves a comprehensive snapshot of the current video metadata and status (e.g., ID, author, playability).
|
|
184
|
+
* @returns {Partial<VideoData>} A partial object containing various details about the loaded content.
|
|
185
|
+
*/
|
|
186
|
+
getVideoData() {
|
|
187
|
+
return {
|
|
188
|
+
allowLiveDvr: false,
|
|
189
|
+
author: '',
|
|
190
|
+
backgroundable: true,
|
|
191
|
+
cpn: '',
|
|
192
|
+
errorCode: null,
|
|
193
|
+
eventId: '',
|
|
194
|
+
hasProgressBarBoundaries: false,
|
|
195
|
+
isListed: true,
|
|
196
|
+
isLive: false,
|
|
197
|
+
isManifestless: false,
|
|
198
|
+
isMultiChannelAudio: false,
|
|
199
|
+
isPlayable: true,
|
|
200
|
+
isPremiere: false,
|
|
201
|
+
isSeekable: null,
|
|
202
|
+
isWindowedLive: false,
|
|
203
|
+
itct: '',
|
|
204
|
+
paidContentOverlayDurationMs: 0,
|
|
205
|
+
playerResponseCpn: '',
|
|
206
|
+
progressBarEndPositionUtcTimeMillis: null,
|
|
207
|
+
progressBarStartPositionUtcTimeMillis: null,
|
|
208
|
+
title: '',
|
|
209
|
+
video_id: '',
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Plays the loaded/selected video.
|
|
215
|
+
*
|
|
216
|
+
* The final player state after this function executes will be playing (1).
|
|
217
|
+
* @returns {void}
|
|
218
|
+
*/
|
|
219
|
+
playVideo() {}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Pauses the playing video.
|
|
223
|
+
*
|
|
224
|
+
* The final player state after this function executes will be paused (2)
|
|
225
|
+
* unless the player is in the ended (0) state when the function is called,
|
|
226
|
+
* in which case the player state will not change.
|
|
227
|
+
* @returns {void}
|
|
228
|
+
*/
|
|
229
|
+
pauseVideo() {}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Stops and cancels the current video playback.
|
|
233
|
+
*
|
|
234
|
+
* Important: Unlike the pauseVideo function, which leaves the player in the
|
|
235
|
+
* paused (2) state, the stopVideo function could put the player into any
|
|
236
|
+
* not-playing state, including ended (0), paused (2), video cued (5) or
|
|
237
|
+
* unstarted (-1).
|
|
238
|
+
* @returns {void}
|
|
239
|
+
*/
|
|
240
|
+
stopVideo() {}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Seeks to a specific time in the video.
|
|
244
|
+
* @param {number} seconds - The time to seek to.
|
|
245
|
+
* @param {boolean} [allowSeekAhead] - Whether to make a new request to the server if the time is outside the buffer.
|
|
246
|
+
* @returns {void}
|
|
247
|
+
*/
|
|
248
|
+
seekTo(seconds, allowSeekAhead) {}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Retrieves the current spherical properties for 360° video playback.
|
|
252
|
+
* @returns {YTSphericalProperties}
|
|
253
|
+
*/
|
|
254
|
+
getSphericalProperties() {
|
|
255
|
+
return { yaw: 0, pitch: 0, roll: 0, fov: 0 };
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Sets the orientation for 360° video playback.
|
|
260
|
+
* @param {YTSphericalProperties & { enableOrientationSensor?: boolean }} properties - The new orientation properties.
|
|
261
|
+
* @returns {void}
|
|
262
|
+
*/
|
|
263
|
+
setSphericalProperties(properties) {}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Loads and plays the next video in the playlist.
|
|
267
|
+
* @returns {void}
|
|
268
|
+
*/
|
|
269
|
+
nextVideo() {}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Loads and plays the previous video in the playlist.
|
|
273
|
+
* @returns {void}
|
|
274
|
+
*/
|
|
275
|
+
previousVideo() {}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Loads and plays the video at the specified index in the playlist.
|
|
279
|
+
* @param {number} index - The zero-based index of the video.
|
|
280
|
+
* @returns {void}
|
|
281
|
+
*/
|
|
282
|
+
playVideoAt(index) {}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Mutes the player.
|
|
286
|
+
* @returns {void}
|
|
287
|
+
*/
|
|
288
|
+
mute() {}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Unmutes the player.
|
|
292
|
+
* @returns {void}
|
|
293
|
+
*/
|
|
294
|
+
unMute() {}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Checks if the player is muted.
|
|
298
|
+
* @returns {boolean}
|
|
299
|
+
*/
|
|
300
|
+
isMuted() {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Sets the player volume.
|
|
306
|
+
* @param {number} volume - Volume level between 0 and 100.
|
|
307
|
+
* @returns {void}
|
|
308
|
+
*/
|
|
309
|
+
setVolume(volume) {}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Gets the current player volume between 0 and 100.
|
|
313
|
+
* @returns {number}
|
|
314
|
+
*/
|
|
315
|
+
getVolume() {
|
|
316
|
+
return 0;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Sets the size of the <iframe>.
|
|
321
|
+
* @param {number|string} width - Width in pixels.
|
|
322
|
+
* @param {number|string} height - Height in pixels.
|
|
323
|
+
* @returns {this}
|
|
324
|
+
*/
|
|
325
|
+
setSize(width, height) {
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Gets the current playback rate.
|
|
331
|
+
* @returns {number}
|
|
332
|
+
*/
|
|
333
|
+
getPlaybackRate() {
|
|
334
|
+
return 1;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Sets the suggested playback rate.
|
|
339
|
+
* @param {number} suggestedRate - The playback rate (e.g., 0.5, 1, 1.5, 2).
|
|
340
|
+
* @returns {void}
|
|
341
|
+
*/
|
|
342
|
+
setPlaybackRate(suggestedRate) {}
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Gets the available playback rates for the current video.
|
|
346
|
+
* @returns {number[]}
|
|
347
|
+
*/
|
|
348
|
+
getAvailablePlaybackRates() {
|
|
349
|
+
return [1];
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Sets whether the playlist should loop.
|
|
354
|
+
* @param {boolean} loopPlaylists - If true, the playlist repeats after the last video.
|
|
355
|
+
* @returns {void}
|
|
356
|
+
*/
|
|
357
|
+
setLoop(loopPlaylists) {}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Sets whether the playlist should be shuffled.
|
|
361
|
+
* @param {boolean} shufflePlaylist - If true, the playlist order is randomized.
|
|
362
|
+
* @returns {void}
|
|
363
|
+
*/
|
|
364
|
+
setShuffle(shufflePlaylist) {}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* Returns a number between 0 and 1 that specifies the percentage of the video
|
|
368
|
+
* that the player shows as buffered.
|
|
369
|
+
* @returns {number}
|
|
370
|
+
*/
|
|
371
|
+
getVideoLoadedFraction() {
|
|
372
|
+
return 0;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Returns the current player state.
|
|
377
|
+
* @returns {YTPlayerState}
|
|
378
|
+
*/
|
|
379
|
+
getPlayerState() {
|
|
380
|
+
return 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Returns the current time in seconds.
|
|
385
|
+
* @returns {number}
|
|
386
|
+
*/
|
|
387
|
+
getCurrentTime() {
|
|
388
|
+
return 0;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Returns the URL of the current video.
|
|
393
|
+
* @returns {string}
|
|
394
|
+
*/
|
|
395
|
+
getVideoUrl() {
|
|
396
|
+
return '';
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Returns the embed code of the current video.
|
|
401
|
+
* @returns {string}
|
|
402
|
+
*/
|
|
403
|
+
getVideoEmbedCode() {
|
|
404
|
+
return '';
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Returns the duration of the video in seconds.
|
|
409
|
+
* @returns {number}
|
|
410
|
+
*/
|
|
411
|
+
getDuration() {
|
|
412
|
+
return 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Returns the array of video IDs in the current playlist.
|
|
417
|
+
* @returns {string[]}
|
|
418
|
+
*/
|
|
419
|
+
getPlaylist() {
|
|
420
|
+
return [];
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Returns the index of the current video in the playlist.
|
|
425
|
+
* @returns {number}
|
|
426
|
+
*/
|
|
427
|
+
getPlaylistIndex() {
|
|
428
|
+
return 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Queues a video by its ID.
|
|
433
|
+
* @param {string|VideoByIdOptions} videoId - The ID of the video.
|
|
434
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
435
|
+
* @param {YTQuality} [quality] - The video quality
|
|
436
|
+
* @returns {void}
|
|
437
|
+
*/
|
|
438
|
+
cueVideoById(videoId, startSeconds, quality) {}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* Loads a video by its ID.
|
|
442
|
+
* @param {string|VideoByIdOptions} videoId - The ID of the video.
|
|
443
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
444
|
+
* @param {YTQuality} [quality] - The video quality
|
|
445
|
+
* @returns {void}
|
|
446
|
+
*/
|
|
447
|
+
loadVideoById(videoId, startSeconds, quality) {}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Queues a video by its URL.
|
|
451
|
+
* @param {string|VideoByUrlOptions} mediaContentUrl - The full URL of the YouTube video.
|
|
452
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
453
|
+
* @param {YTQuality} [quality] - The video quality
|
|
454
|
+
* @returns {void}
|
|
455
|
+
*/
|
|
456
|
+
cueVideoByUrl(mediaContentUrl, startSeconds, quality) {}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Loads a video by its URL.
|
|
460
|
+
* @param {string|VideoByUrlOptions} mediaContentUrl - The full URL of the YouTube video.
|
|
461
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
462
|
+
* @param {YTQuality} [quality] - The video quality.
|
|
463
|
+
* @returns {void}
|
|
464
|
+
*/
|
|
465
|
+
loadVideoByUrl(mediaContentUrl, startSeconds, quality) {}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Queues a playlist.
|
|
469
|
+
* @param {string|string[]|YTPlaylistOptions} playlist - The playlist ID, array of IDs, or options object.
|
|
470
|
+
* @param {number} [index=0] - The index of the first video.
|
|
471
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
472
|
+
* @returns {void}
|
|
473
|
+
*/
|
|
474
|
+
cuePlaylist(playlist, index, startSeconds) {}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Loads a playlist.
|
|
478
|
+
* @param {string|string[]|YTPlaylistOptions} playlist - The playlist ID, array of IDs, or options object.
|
|
479
|
+
* @param {number} [index=0] - The index of the first video.
|
|
480
|
+
* @param {number} [startSeconds] - The time to start at.
|
|
481
|
+
* @returns {void}
|
|
482
|
+
*/
|
|
483
|
+
loadPlaylist(playlist, index, startSeconds) {}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Adds an event listener.
|
|
487
|
+
* @param {EventNames} event - The event name.
|
|
488
|
+
* @param {string} listener - The listener is a string that specifies the function
|
|
489
|
+
* that will execute when the specified event fires.
|
|
490
|
+
* @returns {void}
|
|
491
|
+
*/
|
|
492
|
+
addEventListener(event, listener) {}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Removes an event listener.
|
|
496
|
+
* @param {EventNames} event - The event name.
|
|
497
|
+
* @param {string} listener - The listener is a string that identifies the function
|
|
498
|
+
* that will no longer execute when the specified event fires.
|
|
499
|
+
* @returns {void}
|
|
500
|
+
*/
|
|
501
|
+
removeEventListener(event, listener) {}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Returns the DOM node of the <iframe>.
|
|
505
|
+
* @returns {HTMLElement}
|
|
506
|
+
*/
|
|
507
|
+
getIframe() {
|
|
508
|
+
return document.createElement('iframe');
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Returns the options available for the current module.
|
|
513
|
+
* @param {string} [module] - The name of the module.
|
|
514
|
+
* @returns {Object<string, any>}
|
|
515
|
+
*/
|
|
516
|
+
getOptions(module) {
|
|
517
|
+
return {};
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Retrieves an option for a specific module.
|
|
522
|
+
* @param {any} module - The name of the module.
|
|
523
|
+
* @param {any} option - The name of the option.
|
|
524
|
+
* @returns {any}
|
|
525
|
+
*/
|
|
526
|
+
getOption(module, option) {
|
|
527
|
+
return undefined;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Sets an option for a specific module.
|
|
532
|
+
* @param {any} module - The name of the module.
|
|
533
|
+
* @param {any} option - The name of the option.
|
|
534
|
+
* @param {any} value - The value to set.
|
|
535
|
+
* @returns {void}
|
|
536
|
+
*/
|
|
537
|
+
setOption(module, option, value) {}
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Destroys the player and removes the <iframe>.
|
|
541
|
+
* @returns {void}
|
|
542
|
+
*/
|
|
543
|
+
destroy() {}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
module.exports = YouTubePlayer;
|