tiny-essentials 1.28.6 → 1.28.8

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.
Files changed (54) hide show
  1. package/changelog/1/28/6.md +3 -0
  2. package/changelog/1/28/7.md +7 -0
  3. package/changelog/1/28/8.md +17 -0
  4. package/dist/v1/TinyBasicsEs.min.js +1 -1
  5. package/dist/v1/TinyDebugger.min.js +1 -0
  6. package/dist/v1/TinyEssentials.min.js +1 -1
  7. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  8. package/dist/v1/TinyRadioFm.min.js +1 -1
  9. package/dist/v1/TinyUploadClicker.min.js +1 -1
  10. package/dist/v1/basics/browserDetector.cjs +228 -0
  11. package/dist/v1/basics/browserDetector.d.mts +66 -0
  12. package/dist/v1/basics/browserDetector.mjs +207 -0
  13. package/dist/v1/basics/index.cjs +6 -0
  14. package/dist/v1/basics/index.d.mts +2 -1
  15. package/dist/v1/basics/index.mjs +2 -1
  16. package/dist/v1/build/TinyDebugger.cjs +7 -0
  17. package/dist/v1/build/TinyDebugger.d.mts +3 -0
  18. package/dist/v1/build/TinyDebugger.mjs +2 -0
  19. package/dist/v1/index.cjs +8 -0
  20. package/dist/v1/index.d.mts +3 -1
  21. package/dist/v1/index.mjs +4 -2
  22. package/dist/v1/libs/TinyDebugger.cjs +380 -0
  23. package/dist/v1/libs/TinyDebugger.d.mts +132 -0
  24. package/dist/v1/libs/TinyDebugger.mjs +351 -0
  25. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.cjs +66 -3
  26. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.d.mts +25 -0
  27. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.mjs +59 -3
  28. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.cjs +66 -3
  29. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.d.mts +25 -0
  30. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.mjs +59 -3
  31. package/dist/v1/libs/TinyMediaPlayer/Mock.cjs +333 -0
  32. package/dist/v1/libs/TinyMediaPlayer/Mock.d.mts +154 -0
  33. package/dist/v1/libs/TinyMediaPlayer/Mock.mjs +296 -0
  34. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.cjs +85 -1
  35. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.d.mts +25 -0
  36. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.mjs +75 -1
  37. package/dist/v1/libs/TinyMediaPlayer/Youtube.cjs +66 -3
  38. package/dist/v1/libs/TinyMediaPlayer/Youtube.d.mts +25 -0
  39. package/dist/v1/libs/TinyMediaPlayer/Youtube.mjs +56 -3
  40. package/dist/v1/libs/TinyMediaPlayer/index.cjs +45 -0
  41. package/dist/v1/libs/TinyMediaPlayer/index.d.mts +25 -0
  42. package/dist/v1/libs/TinyMediaPlayer/index.mjs +40 -0
  43. package/dist/v1/libs/TinyMediaPlayer.cjs +172 -10
  44. package/dist/v1/libs/TinyMediaPlayer.d.mts +47 -2
  45. package/dist/v1/libs/TinyMediaPlayer.mjs +160 -10
  46. package/dist/v1/libs/TinyPromiseQueue.cjs +6 -4
  47. package/dist/v1/libs/TinyPromiseQueue.d.mts +8 -6
  48. package/dist/v1/libs/TinyPromiseQueue.mjs +6 -4
  49. package/dist/v1/libs/TinyRadioFm.cjs +271 -138
  50. package/dist/v1/libs/TinyRadioFm.d.mts +67 -3
  51. package/dist/v1/libs/TinyRadioFm.mjs +239 -123
  52. package/docs/v1/libs/TinyMediaPlayer.md +52 -54
  53. package/docs/v1/libs/TinyRadioFm.md +25 -3
  54. package/package.json +13 -1
@@ -241,6 +241,16 @@ declare class YoutubeMediaAdapter extends BaseMediaAdapter {
241
241
  * @returns {boolean} True if the adapter is ready, false otherwise.
242
242
  */
243
243
  isReady(): boolean;
244
+ /**
245
+ * Checks whether the media adapter is paused.
246
+ * @returns {boolean} True if the adapter is ready, false otherwise.
247
+ */
248
+ isPaused(): boolean;
249
+ /**
250
+ * Checks whether the media adapter is ended.
251
+ * @returns {boolean} True if the adapter is ready, false otherwise.
252
+ */
253
+ isEnded(): boolean;
244
254
  /**
245
255
  * Asynchronously waits until the YouTube media adapter is fully initialized and ready.
246
256
  * @returns {Promise<void>} A promise that resolves once the adapter is ready.
@@ -290,6 +300,21 @@ declare class YoutubeMediaAdapter extends BaseMediaAdapter {
290
300
  * @throws {TypeError} If timeMs is not a number.
291
301
  */
292
302
  seek(timeMs: number): Promise<void>;
303
+ /**
304
+ * Checks whether the player is currently muted.
305
+ * @returns {boolean|null} True if muted, false otherwise.
306
+ */
307
+ isMuted(): boolean | null;
308
+ /**
309
+ * Mutes the current playback.
310
+ * @returns {Promise<void>}
311
+ */
312
+ mute(): Promise<void>;
313
+ /**
314
+ * Unmutes the current playback.
315
+ * @returns {Promise<void>}
316
+ */
317
+ unMute(): Promise<void>;
293
318
  /**
294
319
  * Retrieves the current playback time.
295
320
  * @returns {number} The current time in milliseconds.
@@ -266,6 +266,10 @@ class YoutubeMediaAdapter extends BaseMediaAdapter {
266
266
  #timeUpdateInterval = null;
267
267
  /** @type {number} */
268
268
  #pollingTimeUpdateValue = 250;
269
+ /** @type {boolean} */
270
+ #isPaused = false;
271
+ /** @type {boolean} */
272
+ #isEnded = false;
269
273
  get pollingTimeUpdateValue() {
270
274
  checkDestroy(this.#destroyed);
271
275
  return this.#pollingTimeUpdateValue;
@@ -341,6 +345,22 @@ class YoutubeMediaAdapter extends BaseMediaAdapter {
341
345
  checkDestroy(this.#destroyed);
342
346
  return this.#isReady;
343
347
  }
348
+ /**
349
+ * Checks whether the media adapter is paused.
350
+ * @returns {boolean} True if the adapter is ready, false otherwise.
351
+ */
352
+ isPaused() {
353
+ checkDestroy(this.#destroyed);
354
+ return this.#isPaused;
355
+ }
356
+ /**
357
+ * Checks whether the media adapter is ended.
358
+ * @returns {boolean} True if the adapter is ready, false otherwise.
359
+ */
360
+ isEnded() {
361
+ checkDestroy(this.#destroyed);
362
+ return this.#isEnded;
363
+ }
344
364
  /**
345
365
  * Asynchronously waits until the YouTube media adapter is fully initialized and ready.
346
366
  * @returns {Promise<void>} A promise that resolves once the adapter is ready.
@@ -447,12 +467,21 @@ class YoutubeMediaAdapter extends BaseMediaAdapter {
447
467
  if (ytEvent === 'onStateChange') {
448
468
  const state = args[0];
449
469
  if (isValidObj(state)) {
450
- if (state.data === YoutubeMediaAdapter.PlayerState.PLAYING)
470
+ if (state.data === YoutubeMediaAdapter.PlayerState.PLAYING) {
471
+ this.#isPaused = false;
472
+ this.#isEnded = false;
451
473
  masterEmitter.emit('play');
452
- if (state.data === YoutubeMediaAdapter.PlayerState.PAUSED)
474
+ }
475
+ if (state.data === YoutubeMediaAdapter.PlayerState.PAUSED) {
476
+ this.#isPaused = true;
477
+ this.#isEnded = false;
453
478
  masterEmitter.emit('pause');
454
- if (state.data === YoutubeMediaAdapter.PlayerState.ENDED)
479
+ }
480
+ if (state.data === YoutubeMediaAdapter.PlayerState.ENDED) {
481
+ this.#isPaused = false;
482
+ this.#isEnded = true;
455
483
  masterEmitter.emit('ended');
484
+ }
456
485
  }
457
486
  }
458
487
  return result;
@@ -560,6 +589,30 @@ class YoutubeMediaAdapter extends BaseMediaAdapter {
560
589
  const targetTimeInSeconds = timeMs / 1000;
561
590
  this.#player?.seekTo(targetTimeInSeconds, true);
562
591
  }
592
+ /**
593
+ * Checks whether the player is currently muted.
594
+ * @returns {boolean|null} True if muted, false otherwise.
595
+ */
596
+ isMuted() {
597
+ checkDestroy(this.#destroyed);
598
+ return this.#player?.isMuted() ?? null;
599
+ }
600
+ /**
601
+ * Mutes the current playback.
602
+ * @returns {Promise<void>}
603
+ */
604
+ async mute() {
605
+ checkDestroy(this.#destroyed);
606
+ this.#player?.mute();
607
+ }
608
+ /**
609
+ * Unmutes the current playback.
610
+ * @returns {Promise<void>}
611
+ */
612
+ async unMute() {
613
+ checkDestroy(this.#destroyed);
614
+ this.#player?.unMute();
615
+ }
563
616
  /**
564
617
  * Retrieves the current playback time.
565
618
  * @returns {number} The current time in milliseconds.
@@ -70,6 +70,24 @@ class BaseMediaAdapter extends events.EventEmitter {
70
70
  throw new Error('Method "isReady" must be implemented by the subclass.');
71
71
  }
72
72
 
73
+ /**
74
+ * Checks whether the media adapter is paused.
75
+ * @returns {boolean} True if the adapter is ready, false otherwise.
76
+ */
77
+ isPaused() {
78
+ checkDestroy(this.#destroyed);
79
+ throw new Error('Method "isPaused" must be implemented by the subclass.');
80
+ }
81
+
82
+ /**
83
+ * Checks whether the media adapter is ended.
84
+ * @returns {boolean} True if the adapter is ready, false otherwise.
85
+ */
86
+ isEnded() {
87
+ checkDestroy(this.#destroyed);
88
+ throw new Error('Method "isEnded" must be implemented by the subclass.');
89
+ }
90
+
73
91
  /**
74
92
  * Asynchronously waits until the content media adapter is fully initialized and ready.
75
93
  * @returns {Promise<void>} A promise that resolves once the adapter is ready.
@@ -127,6 +145,33 @@ class BaseMediaAdapter extends events.EventEmitter {
127
145
  throw new Error('Method "seek" must be implemented by the subclass.');
128
146
  }
129
147
 
148
+ /**
149
+ * Checks whether the player is currently muted.
150
+ * @returns {boolean|null} True if muted, false otherwise.
151
+ */
152
+ isMuted() {
153
+ checkDestroy(this.#destroyed);
154
+ throw new Error('Method "isMuted" must be implemented by the subclass.');
155
+ }
156
+
157
+ /**
158
+ * Mutes the current playback.
159
+ * @returns {Promise<void>}
160
+ */
161
+ async mute() {
162
+ checkDestroy(this.#destroyed);
163
+ throw new Error('Method "mute" must be implemented by the subclass.');
164
+ }
165
+
166
+ /**
167
+ * Unmutes the current playback.
168
+ * @returns {Promise<void>}
169
+ */
170
+ async unMute() {
171
+ checkDestroy(this.#destroyed);
172
+ throw new Error('Method "unMute" must be implemented by the subclass.');
173
+ }
174
+
130
175
  /**
131
176
  * Retrieves the current playback time from the underlying API.
132
177
  * @returns {number} The current time in milliseconds.
@@ -77,6 +77,16 @@ declare class BaseMediaAdapter extends EventEmitter {
77
77
  * @returns {boolean} True if the adapter is ready, false otherwise.
78
78
  */
79
79
  isReady(): boolean;
80
+ /**
81
+ * Checks whether the media adapter is paused.
82
+ * @returns {boolean} True if the adapter is ready, false otherwise.
83
+ */
84
+ isPaused(): boolean;
85
+ /**
86
+ * Checks whether the media adapter is ended.
87
+ * @returns {boolean} True if the adapter is ready, false otherwise.
88
+ */
89
+ isEnded(): boolean;
80
90
  /**
81
91
  * Asynchronously waits until the content media adapter is fully initialized and ready.
82
92
  * @returns {Promise<void>} A promise that resolves once the adapter is ready.
@@ -110,6 +120,21 @@ declare class BaseMediaAdapter extends EventEmitter {
110
120
  * @returns {Promise<void>}
111
121
  */
112
122
  seek(timeMs: number): Promise<void>;
123
+ /**
124
+ * Checks whether the player is currently muted.
125
+ * @returns {boolean|null} True if muted, false otherwise.
126
+ */
127
+ isMuted(): boolean | null;
128
+ /**
129
+ * Mutes the current playback.
130
+ * @returns {Promise<void>}
131
+ */
132
+ mute(): Promise<void>;
133
+ /**
134
+ * Unmutes the current playback.
135
+ * @returns {Promise<void>}
136
+ */
137
+ unMute(): Promise<void>;
113
138
  /**
114
139
  * Retrieves the current playback time from the underlying API.
115
140
  * @returns {number} The current time in milliseconds.
@@ -58,6 +58,22 @@ class BaseMediaAdapter extends EventEmitter {
58
58
  checkDestroy(this.#destroyed);
59
59
  throw new Error('Method "isReady" must be implemented by the subclass.');
60
60
  }
61
+ /**
62
+ * Checks whether the media adapter is paused.
63
+ * @returns {boolean} True if the adapter is ready, false otherwise.
64
+ */
65
+ isPaused() {
66
+ checkDestroy(this.#destroyed);
67
+ throw new Error('Method "isPaused" must be implemented by the subclass.');
68
+ }
69
+ /**
70
+ * Checks whether the media adapter is ended.
71
+ * @returns {boolean} True if the adapter is ready, false otherwise.
72
+ */
73
+ isEnded() {
74
+ checkDestroy(this.#destroyed);
75
+ throw new Error('Method "isEnded" must be implemented by the subclass.');
76
+ }
61
77
  /**
62
78
  * Asynchronously waits until the content media adapter is fully initialized and ready.
63
79
  * @returns {Promise<void>} A promise that resolves once the adapter is ready.
@@ -109,6 +125,30 @@ class BaseMediaAdapter extends EventEmitter {
109
125
  checkDestroy(this.#destroyed);
110
126
  throw new Error('Method "seek" must be implemented by the subclass.');
111
127
  }
128
+ /**
129
+ * Checks whether the player is currently muted.
130
+ * @returns {boolean|null} True if muted, false otherwise.
131
+ */
132
+ isMuted() {
133
+ checkDestroy(this.#destroyed);
134
+ throw new Error('Method "isMuted" must be implemented by the subclass.');
135
+ }
136
+ /**
137
+ * Mutes the current playback.
138
+ * @returns {Promise<void>}
139
+ */
140
+ async mute() {
141
+ checkDestroy(this.#destroyed);
142
+ throw new Error('Method "mute" must be implemented by the subclass.');
143
+ }
144
+ /**
145
+ * Unmutes the current playback.
146
+ * @returns {Promise<void>}
147
+ */
148
+ async unMute() {
149
+ checkDestroy(this.#destroyed);
150
+ throw new Error('Method "unMute" must be implemented by the subclass.');
151
+ }
112
152
  /**
113
153
  * Retrieves the current playback time from the underlying API.
114
154
  * @returns {number} The current time in milliseconds.