tiny-essentials 1.28.5 → 1.28.7

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 (36) hide show
  1. package/README.md +18 -1
  2. package/changelog/1/28/6.md +14 -0
  3. package/changelog/1/28/7.md +7 -0
  4. package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
  5. package/dist/v1/TinyEssentials.min.js +1 -1
  6. package/dist/v1/TinyIframeEvents.min.js +1 -1
  7. package/dist/v1/TinyLocalStorage.min.js +1 -1
  8. package/dist/v1/TinyMediaPlayer.min.js +1 -1
  9. package/dist/v1/TinyNewWinEvents.min.js +1 -1
  10. package/dist/v1/TinyRadioFm.min.js +1 -1
  11. package/dist/v1/TinySmartScroller.min.js +1 -1
  12. package/dist/v1/TinyUploadClicker.min.js +1 -1
  13. package/dist/v1/css/TinyLoadingScreen.min.css +1 -1
  14. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.cjs +80 -3
  15. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.d.mts +40 -0
  16. package/dist/v1/libs/TinyMediaPlayer/HtmlAudio.mjs +73 -3
  17. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.cjs +80 -3
  18. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.d.mts +40 -0
  19. package/dist/v1/libs/TinyMediaPlayer/HtmlVideo.mjs +73 -3
  20. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.cjs +846 -0
  21. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.d.mts +315 -0
  22. package/dist/v1/libs/TinyMediaPlayer/SoundCloud.mjs +745 -0
  23. package/dist/v1/libs/TinyMediaPlayer/Youtube.cjs +151 -12
  24. package/dist/v1/libs/TinyMediaPlayer/Youtube.d.mts +111 -0
  25. package/dist/v1/libs/TinyMediaPlayer/Youtube.mjs +131 -10
  26. package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.cjs +381 -0
  27. package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.d.mts +704 -0
  28. package/dist/v1/libs/TinyMediaPlayer/docs/SoundCloudWidget.mjs +343 -0
  29. package/dist/v1/libs/TinyMediaPlayer/index.cjs +79 -1
  30. package/dist/v1/libs/TinyMediaPlayer/index.d.mts +75 -0
  31. package/dist/v1/libs/TinyMediaPlayer/index.mjs +71 -1
  32. package/dist/v1/libs/TinyMediaPlayer.cjs +75 -0
  33. package/dist/v1/libs/TinyMediaPlayer.d.mts +22 -0
  34. package/dist/v1/libs/TinyMediaPlayer.mjs +71 -0
  35. package/docs/v1/libs/TinyMediaPlayer.md +56 -40
  36. package/package.json +55 -10
@@ -1 +1 @@
1
- .loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.6);display:absolute;justify-content:center;align-items:center;z-index:9999}.loading-overlay .loading-container{height:100%;width:100%;display:flex;align-items:center}.loading-overlay .loading-content{text-align:center;color:#fff;font-family:Arial,sans-serif;margin:auto}.loading-overlay .loading-spinner{position:relative;border:4px solid hsla(0,0%,100%,.3);border-top:4px solid #fff;border-radius:50%;width:50px;height:50px;margin:0 auto 15px;animation:loading-spin 1s linear infinite}.loading-overlay .loading-spinner::after{content:"";position:absolute;top:50%;left:50%;width:20px;height:20px;transform:translate(-50%, -50%);border-radius:50%;background:rgba(0,0,0,0);pointer-events:none}.loading-overlay .loading-message{font-size:1.2em;user-select:none !important}@keyframes loading-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
1
+ .loading-overlay{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.6);display:absolute;justify-content:center;align-items:center;z-index:9999}.loading-overlay .loading-container{height:100%;width:100%;display:flex;align-items:center}.loading-overlay .loading-content{text-align:center;color:#fff;font-family:Arial,sans-serif;margin:auto}.loading-overlay .loading-spinner{position:relative;border:4px solid rgba(255,255,255,.3);border-top:4px solid #fff;border-radius:50%;width:50px;height:50px;margin:0 auto 15px;animation:loading-spin 1s linear infinite}.loading-overlay .loading-spinner::after{content:"";position:absolute;top:50%;left:50%;width:20px;height:20px;transform:translate(-50%, -50%);border-radius:50%;background:rgba(0,0,0,0);pointer-events:none}.loading-overlay .loading-message{font-size:1.2em;user-select:none !important}@keyframes loading-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}
@@ -8,6 +8,7 @@ var index = require('./index.cjs');
8
8
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
9
9
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
10
10
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
11
+ * @typedef {import('./index.mjs').ContentData} ContentData
11
12
  */
12
13
 
13
14
 
@@ -71,6 +72,27 @@ class HtmlAudioAdapter extends index.BaseMediaAdapter {
71
72
  this.#audioElement.addEventListener('error', (error) => {
72
73
  this.emit('error', error);
73
74
  });
75
+ this.#audioElement.addEventListener('seeked', () => {
76
+ this.emit('seek', this.getCurrentTime());
77
+ });
78
+ }
79
+
80
+ /**
81
+ * Synchronously checks whether the media adapter is fully initialized and ready.
82
+ * @returns {boolean} True if the adapter is ready, false otherwise.
83
+ */
84
+ isReady() {
85
+ checkDestroy(this.#destroyed);
86
+ return true;
87
+ }
88
+
89
+ /**
90
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
91
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
92
+ */
93
+ async waitIsReady() {
94
+ checkDestroy(this.#destroyed);
95
+ return;
74
96
  }
75
97
 
76
98
  /**
@@ -91,8 +113,7 @@ class HtmlAudioAdapter extends index.BaseMediaAdapter {
91
113
  * @returns {boolean} True if the content is compatible, false otherwise.
92
114
  * @throws {TypeError} If content is not a valid object.
93
115
  */
94
- canHandle(content) {
95
- checkDestroy(this.#destroyed);
116
+ static canHandle(content) {
96
117
  if (!objChecker.isValidObj(content)) {
97
118
  throw new TypeError('Content must be a valid object.');
98
119
  }
@@ -103,6 +124,17 @@ class HtmlAudioAdapter extends index.BaseMediaAdapter {
103
124
  );
104
125
  }
105
126
 
127
+ /**
128
+ * Determines if the provided content is compatible with this adapter.
129
+ * @param {MediaContent} content - The media content object.
130
+ * @returns {boolean} True if the content is compatible, false otherwise.
131
+ * @throws {TypeError} If content is not a valid object.
132
+ */
133
+ canHandle(content) {
134
+ checkDestroy(this.#destroyed);
135
+ return HtmlAudioAdapter.canHandle(content);
136
+ }
137
+
106
138
  /**
107
139
  * Plays the audio content provided via the URL.
108
140
  * @param {MediaContent} content - The media content object containing the URL.
@@ -158,7 +190,33 @@ class HtmlAudioAdapter extends index.BaseMediaAdapter {
158
190
  }
159
191
  const currentTime = timeMs / 1000;
160
192
  this.#audioElement.currentTime = currentTime;
161
- this.emit('seek', currentTime);
193
+ }
194
+
195
+ /**
196
+ * Checks whether the player is currently muted.
197
+ * @returns {boolean} True if muted, false otherwise.
198
+ */
199
+ isMuted() {
200
+ checkDestroy(this.#destroyed);
201
+ return this.#audioElement.muted;
202
+ }
203
+
204
+ /**
205
+ * Mutes the current playback.
206
+ * @returns {Promise<void>}
207
+ */
208
+ async mute() {
209
+ checkDestroy(this.#destroyed);
210
+ this.#audioElement.muted = true;
211
+ }
212
+
213
+ /**
214
+ * Unmutes the current playback.
215
+ * @returns {Promise<void>}
216
+ */
217
+ async unMute() {
218
+ checkDestroy(this.#destroyed);
219
+ this.#audioElement.muted = false;
162
220
  }
163
221
 
164
222
  /**
@@ -242,6 +300,25 @@ class HtmlAudioAdapter extends index.BaseMediaAdapter {
242
300
  this.emit('volumeChange', value);
243
301
  }
244
302
 
303
+ /**
304
+ * Retrieves the metadata of the currently loaded content, returning a structured
305
+ * object containing details such as the content ID, title, author, and duration.
306
+ * @returns {Promise<ContentData>}
307
+ */
308
+ async getContentData() {
309
+ return {
310
+ id: '',
311
+ createdAt: '',
312
+ artistId: '',
313
+ artistName: '',
314
+ description: '',
315
+ title: '',
316
+ duration: 0,
317
+ avatar: '',
318
+ url: '',
319
+ };
320
+ }
321
+
245
322
  /**
246
323
  * Cleans up the adapter resources and marks it as destroyed.
247
324
  * @returns {Promise<void>}
@@ -2,10 +2,12 @@
2
2
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
3
3
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
4
4
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
5
+ * @typedef {import('./index.mjs').ContentData} ContentData
5
6
  */
6
7
  export type PictureDataType = import('../../basics/mediaContent.mjs').PictureDataType;
7
8
  export type MediaContent = import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>;
8
9
  export type ContentTimeData = import('./index.mjs').ContentTimeData;
10
+ export type ContentData = import('./index.mjs').ContentData;
9
11
  import { BaseMediaAdapter } from './index.mjs';
10
12
  /**
11
13
  * Concrete implementation of the BaseMediaAdapter using HTML5 Audio.
@@ -30,11 +32,28 @@ declare class HtmlAudioAdapter extends BaseMediaAdapter {
30
32
  * Initializes a new instance of the HtmlAudioAdapter.
31
33
  */
32
34
  constructor();
35
+ /**
36
+ * Synchronously checks whether the media adapter is fully initialized and ready.
37
+ * @returns {boolean} True if the adapter is ready, false otherwise.
38
+ */
39
+ isReady(): boolean;
40
+ /**
41
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
42
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
43
+ */
44
+ waitIsReady(): Promise<void>;
33
45
  /**
34
46
  * Retrieves a consolidated object containing all time-related metrics for the current media content.
35
47
  * @returns {ContentTimeData} An object containing total, current, remaining time, and playback percentage.
36
48
  */
37
49
  getTimeData(): ContentTimeData;
50
+ /**
51
+ * Determines if the provided content is compatible with this adapter.
52
+ * @param {MediaContent} content - The media content object.
53
+ * @returns {boolean} True if the content is compatible, false otherwise.
54
+ * @throws {TypeError} If content is not a valid object.
55
+ */
56
+ static canHandle(content: MediaContent): boolean;
38
57
  /**
39
58
  * Determines if the provided content is compatible with this adapter.
40
59
  * @param {MediaContent} content - The media content object.
@@ -66,6 +85,21 @@ declare class HtmlAudioAdapter extends BaseMediaAdapter {
66
85
  * @throws {TypeError} If timeMs is not a number.
67
86
  */
68
87
  seek(timeMs: number): Promise<void>;
88
+ /**
89
+ * Checks whether the player is currently muted.
90
+ * @returns {boolean} True if muted, false otherwise.
91
+ */
92
+ isMuted(): boolean;
93
+ /**
94
+ * Mutes the current playback.
95
+ * @returns {Promise<void>}
96
+ */
97
+ mute(): Promise<void>;
98
+ /**
99
+ * Unmutes the current playback.
100
+ * @returns {Promise<void>}
101
+ */
102
+ unMute(): Promise<void>;
69
103
  /**
70
104
  * Gets the current playback time.
71
105
  * @returns {number} The current time in milliseconds.
@@ -108,6 +142,12 @@ declare class HtmlAudioAdapter extends BaseMediaAdapter {
108
142
  * @throws {RangeError} If the volume is not between 0.0 and 1.0.
109
143
  */
110
144
  set volume(value: number);
145
+ /**
146
+ * Retrieves the metadata of the currently loaded content, returning a structured
147
+ * object containing details such as the content ID, title, author, and duration.
148
+ * @returns {Promise<ContentData>}
149
+ */
150
+ getContentData(): Promise<ContentData>;
111
151
  /**
112
152
  * Cleans up the adapter resources and marks it as destroyed.
113
153
  * @returns {Promise<void>}
@@ -2,6 +2,7 @@
2
2
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
3
3
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
4
4
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
5
+ * @typedef {import('./index.mjs').ContentData} ContentData
5
6
  */
6
7
  import { isValidObj } from '../../basics/objChecker.mjs';
7
8
  import { createCheckDestroyed } from '../utils.mjs';
@@ -57,6 +58,25 @@ class HtmlAudioAdapter extends BaseMediaAdapter {
57
58
  this.#audioElement.addEventListener('error', (error) => {
58
59
  this.emit('error', error);
59
60
  });
61
+ this.#audioElement.addEventListener('seeked', () => {
62
+ this.emit('seek', this.getCurrentTime());
63
+ });
64
+ }
65
+ /**
66
+ * Synchronously checks whether the media adapter is fully initialized and ready.
67
+ * @returns {boolean} True if the adapter is ready, false otherwise.
68
+ */
69
+ isReady() {
70
+ checkDestroy(this.#destroyed);
71
+ return true;
72
+ }
73
+ /**
74
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
75
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
76
+ */
77
+ async waitIsReady() {
78
+ checkDestroy(this.#destroyed);
79
+ return;
60
80
  }
61
81
  /**
62
82
  * Retrieves a consolidated object containing all time-related metrics for the current media content.
@@ -75,8 +95,7 @@ class HtmlAudioAdapter extends BaseMediaAdapter {
75
95
  * @returns {boolean} True if the content is compatible, false otherwise.
76
96
  * @throws {TypeError} If content is not a valid object.
77
97
  */
78
- canHandle(content) {
79
- checkDestroy(this.#destroyed);
98
+ static canHandle(content) {
80
99
  if (!isValidObj(content)) {
81
100
  throw new TypeError('Content must be a valid object.');
82
101
  }
@@ -84,6 +103,16 @@ class HtmlAudioAdapter extends BaseMediaAdapter {
84
103
  (content.url.startsWith('http') || content.url.startsWith('blob:')) &&
85
104
  (content.mediaType === undefined || content.mediaType === 'audio'));
86
105
  }
106
+ /**
107
+ * Determines if the provided content is compatible with this adapter.
108
+ * @param {MediaContent} content - The media content object.
109
+ * @returns {boolean} True if the content is compatible, false otherwise.
110
+ * @throws {TypeError} If content is not a valid object.
111
+ */
112
+ canHandle(content) {
113
+ checkDestroy(this.#destroyed);
114
+ return HtmlAudioAdapter.canHandle(content);
115
+ }
87
116
  /**
88
117
  * Plays the audio content provided via the URL.
89
118
  * @param {MediaContent} content - The media content object containing the URL.
@@ -135,7 +164,30 @@ class HtmlAudioAdapter extends BaseMediaAdapter {
135
164
  }
136
165
  const currentTime = timeMs / 1000;
137
166
  this.#audioElement.currentTime = currentTime;
138
- this.emit('seek', currentTime);
167
+ }
168
+ /**
169
+ * Checks whether the player is currently muted.
170
+ * @returns {boolean} True if muted, false otherwise.
171
+ */
172
+ isMuted() {
173
+ checkDestroy(this.#destroyed);
174
+ return this.#audioElement.muted;
175
+ }
176
+ /**
177
+ * Mutes the current playback.
178
+ * @returns {Promise<void>}
179
+ */
180
+ async mute() {
181
+ checkDestroy(this.#destroyed);
182
+ this.#audioElement.muted = true;
183
+ }
184
+ /**
185
+ * Unmutes the current playback.
186
+ * @returns {Promise<void>}
187
+ */
188
+ async unMute() {
189
+ checkDestroy(this.#destroyed);
190
+ this.#audioElement.muted = false;
139
191
  }
140
192
  /**
141
193
  * Gets the current playback time.
@@ -210,6 +262,24 @@ class HtmlAudioAdapter extends BaseMediaAdapter {
210
262
  this.#audioElement.volume = value;
211
263
  this.emit('volumeChange', value);
212
264
  }
265
+ /**
266
+ * Retrieves the metadata of the currently loaded content, returning a structured
267
+ * object containing details such as the content ID, title, author, and duration.
268
+ * @returns {Promise<ContentData>}
269
+ */
270
+ async getContentData() {
271
+ return {
272
+ id: '',
273
+ createdAt: '',
274
+ artistId: '',
275
+ artistName: '',
276
+ description: '',
277
+ title: '',
278
+ duration: 0,
279
+ avatar: '',
280
+ url: '',
281
+ };
282
+ }
213
283
  /**
214
284
  * Cleans up the adapter resources and marks it as destroyed.
215
285
  * @returns {Promise<void>}
@@ -8,6 +8,7 @@ var index = require('./index.cjs');
8
8
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
9
9
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
10
10
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
11
+ * @typedef {import('./index.mjs').ContentData} ContentData
11
12
  */
12
13
 
13
14
 
@@ -68,6 +69,27 @@ class HtmlVideoAdapter extends index.BaseMediaAdapter {
68
69
  this.#videoElement.addEventListener('error', (error) => {
69
70
  this.emit('error', error);
70
71
  });
72
+ this.#videoElement.addEventListener('seeked', () => {
73
+ this.emit('seek', this.getCurrentTime());
74
+ });
75
+ }
76
+
77
+ /**
78
+ * Synchronously checks whether the media adapter is fully initialized and ready.
79
+ * @returns {boolean} True if the adapter is ready, false otherwise.
80
+ */
81
+ isReady() {
82
+ checkDestroy(this.#destroyed);
83
+ return true;
84
+ }
85
+
86
+ /**
87
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
88
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
89
+ */
90
+ async waitIsReady() {
91
+ checkDestroy(this.#destroyed);
92
+ return;
71
93
  }
72
94
 
73
95
  /**
@@ -88,8 +110,7 @@ class HtmlVideoAdapter extends index.BaseMediaAdapter {
88
110
  * @returns {boolean} True if the content is compatible, false otherwise.
89
111
  * @throws {TypeError} If content is not a valid object.
90
112
  */
91
- canHandle(content) {
92
- checkDestroy(this.#destroyed);
113
+ static canHandle(content) {
93
114
  if (!objChecker.isValidObj(content)) {
94
115
  throw new TypeError('Content must be a valid object.');
95
116
  }
@@ -100,6 +121,17 @@ class HtmlVideoAdapter extends index.BaseMediaAdapter {
100
121
  );
101
122
  }
102
123
 
124
+ /**
125
+ * Determines if the provided content is compatible with this adapter.
126
+ * @param {MediaContent} content - The media content object.
127
+ * @returns {boolean} True if the content is compatible, false otherwise.
128
+ * @throws {TypeError} If content is not a valid object.
129
+ */
130
+ canHandle(content) {
131
+ checkDestroy(this.#destroyed);
132
+ return HtmlVideoAdapter.canHandle(content);
133
+ }
134
+
103
135
  /**
104
136
  * Plays the video content provided via the URL.
105
137
  * @param {MediaContent} content - The media content object containing the URL.
@@ -155,7 +187,33 @@ class HtmlVideoAdapter extends index.BaseMediaAdapter {
155
187
  }
156
188
  const currentTime = timeMs / 1000;
157
189
  this.#videoElement.currentTime = currentTime;
158
- this.emit('seek', currentTime);
190
+ }
191
+
192
+ /**
193
+ * Checks whether the player is currently muted.
194
+ * @returns {boolean} True if muted, false otherwise.
195
+ */
196
+ isMuted() {
197
+ checkDestroy(this.#destroyed);
198
+ return this.#videoElement.muted;
199
+ }
200
+
201
+ /**
202
+ * Mutes the current playback.
203
+ * @returns {Promise<void>}
204
+ */
205
+ async mute() {
206
+ checkDestroy(this.#destroyed);
207
+ this.#videoElement.muted = true;
208
+ }
209
+
210
+ /**
211
+ * Unmutes the current playback.
212
+ * @returns {Promise<void>}
213
+ */
214
+ async unMute() {
215
+ checkDestroy(this.#destroyed);
216
+ this.#videoElement.muted = false;
159
217
  }
160
218
 
161
219
  /**
@@ -239,6 +297,25 @@ class HtmlVideoAdapter extends index.BaseMediaAdapter {
239
297
  this.emit('volumeChange', value);
240
298
  }
241
299
 
300
+ /**
301
+ * Retrieves the metadata of the currently loaded content, returning a structured
302
+ * object containing details such as the content ID, title, author, and duration.
303
+ * @returns {Promise<ContentData>}
304
+ */
305
+ async getContentData() {
306
+ return {
307
+ id: '',
308
+ createdAt: '',
309
+ artistId: '',
310
+ artistName: '',
311
+ description: '',
312
+ title: '',
313
+ duration: 0,
314
+ avatar: '',
315
+ url: '',
316
+ };
317
+ }
318
+
242
319
  /**
243
320
  * Cleans up the adapter resources and marks it as destroyed.
244
321
  * @returns {Promise<void>}
@@ -2,10 +2,12 @@
2
2
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
3
3
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
4
4
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
5
+ * @typedef {import('./index.mjs').ContentData} ContentData
5
6
  */
6
7
  export type PictureDataType = import('../../basics/mediaContent.mjs').PictureDataType;
7
8
  export type MediaContent = import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>;
8
9
  export type ContentTimeData = import('./index.mjs').ContentTimeData;
10
+ export type ContentData = import('./index.mjs').ContentData;
9
11
  import { BaseMediaAdapter } from './index.mjs';
10
12
  /**
11
13
  * Concrete implementation of the BaseMediaAdapter using HTML5 Video.
@@ -30,11 +32,28 @@ declare class HtmlVideoAdapter extends BaseMediaAdapter {
30
32
  * Initializes a new instance of the HtmlVideoAdapter.
31
33
  */
32
34
  constructor();
35
+ /**
36
+ * Synchronously checks whether the media adapter is fully initialized and ready.
37
+ * @returns {boolean} True if the adapter is ready, false otherwise.
38
+ */
39
+ isReady(): boolean;
40
+ /**
41
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
42
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
43
+ */
44
+ waitIsReady(): Promise<void>;
33
45
  /**
34
46
  * Retrieves a consolidated object containing all time-related metrics for the current media content.
35
47
  * @returns {ContentTimeData} An object containing total, current, remaining time, and playback percentage.
36
48
  */
37
49
  getTimeData(): ContentTimeData;
50
+ /**
51
+ * Determines if the provided content is compatible with this adapter.
52
+ * @param {MediaContent} content - The media content object.
53
+ * @returns {boolean} True if the content is compatible, false otherwise.
54
+ * @throws {TypeError} If content is not a valid object.
55
+ */
56
+ static canHandle(content: MediaContent): boolean;
38
57
  /**
39
58
  * Determines if the provided content is compatible with this adapter.
40
59
  * @param {MediaContent} content - The media content object.
@@ -66,6 +85,21 @@ declare class HtmlVideoAdapter extends BaseMediaAdapter {
66
85
  * @throws {TypeError} If timeMs is not a number.
67
86
  */
68
87
  seek(timeMs: number): Promise<void>;
88
+ /**
89
+ * Checks whether the player is currently muted.
90
+ * @returns {boolean} True if muted, false otherwise.
91
+ */
92
+ isMuted(): boolean;
93
+ /**
94
+ * Mutes the current playback.
95
+ * @returns {Promise<void>}
96
+ */
97
+ mute(): Promise<void>;
98
+ /**
99
+ * Unmutes the current playback.
100
+ * @returns {Promise<void>}
101
+ */
102
+ unMute(): Promise<void>;
69
103
  /**
70
104
  * Gets the current playback time.
71
105
  * @returns {number} The current time in milliseconds.
@@ -108,6 +142,12 @@ declare class HtmlVideoAdapter extends BaseMediaAdapter {
108
142
  * @throws {RangeError} If the volume is not between 0.0 and 1.0.
109
143
  */
110
144
  set volume(value: number);
145
+ /**
146
+ * Retrieves the metadata of the currently loaded content, returning a structured
147
+ * object containing details such as the content ID, title, author, and duration.
148
+ * @returns {Promise<ContentData>}
149
+ */
150
+ getContentData(): Promise<ContentData>;
111
151
  /**
112
152
  * Cleans up the adapter resources and marks it as destroyed.
113
153
  * @returns {Promise<void>}
@@ -2,6 +2,7 @@
2
2
  * @typedef {import('../../basics/mediaContent.mjs').PictureDataType} PictureDataType
3
3
  * @typedef {import('../../basics/mediaContent.mjs').MediaContent<PictureDataType>} MediaContent
4
4
  * @typedef {import('./index.mjs').ContentTimeData} ContentTimeData
5
+ * @typedef {import('./index.mjs').ContentData} ContentData
5
6
  */
6
7
  import { isValidObj } from '../../basics/objChecker.mjs';
7
8
  import { createCheckDestroyed } from '../utils.mjs';
@@ -54,6 +55,25 @@ class HtmlVideoAdapter extends BaseMediaAdapter {
54
55
  this.#videoElement.addEventListener('error', (error) => {
55
56
  this.emit('error', error);
56
57
  });
58
+ this.#videoElement.addEventListener('seeked', () => {
59
+ this.emit('seek', this.getCurrentTime());
60
+ });
61
+ }
62
+ /**
63
+ * Synchronously checks whether the media adapter is fully initialized and ready.
64
+ * @returns {boolean} True if the adapter is ready, false otherwise.
65
+ */
66
+ isReady() {
67
+ checkDestroy(this.#destroyed);
68
+ return true;
69
+ }
70
+ /**
71
+ * Asynchronously waits until the content media adapter is fully initialized and ready.
72
+ * @returns {Promise<void>} A promise that resolves once the adapter is ready.
73
+ */
74
+ async waitIsReady() {
75
+ checkDestroy(this.#destroyed);
76
+ return;
57
77
  }
58
78
  /**
59
79
  * Retrieves a consolidated object containing all time-related metrics for the current media content.
@@ -72,8 +92,7 @@ class HtmlVideoAdapter extends BaseMediaAdapter {
72
92
  * @returns {boolean} True if the content is compatible, false otherwise.
73
93
  * @throws {TypeError} If content is not a valid object.
74
94
  */
75
- canHandle(content) {
76
- checkDestroy(this.#destroyed);
95
+ static canHandle(content) {
77
96
  if (!isValidObj(content)) {
78
97
  throw new TypeError('Content must be a valid object.');
79
98
  }
@@ -81,6 +100,16 @@ class HtmlVideoAdapter extends BaseMediaAdapter {
81
100
  (content.url.startsWith('http') || content.url.startsWith('blob:')) &&
82
101
  (content.mediaType === undefined || content.mediaType === 'video'));
83
102
  }
103
+ /**
104
+ * Determines if the provided content is compatible with this adapter.
105
+ * @param {MediaContent} content - The media content object.
106
+ * @returns {boolean} True if the content is compatible, false otherwise.
107
+ * @throws {TypeError} If content is not a valid object.
108
+ */
109
+ canHandle(content) {
110
+ checkDestroy(this.#destroyed);
111
+ return HtmlVideoAdapter.canHandle(content);
112
+ }
84
113
  /**
85
114
  * Plays the video content provided via the URL.
86
115
  * @param {MediaContent} content - The media content object containing the URL.
@@ -132,7 +161,30 @@ class HtmlVideoAdapter extends BaseMediaAdapter {
132
161
  }
133
162
  const currentTime = timeMs / 1000;
134
163
  this.#videoElement.currentTime = currentTime;
135
- this.emit('seek', currentTime);
164
+ }
165
+ /**
166
+ * Checks whether the player is currently muted.
167
+ * @returns {boolean} True if muted, false otherwise.
168
+ */
169
+ isMuted() {
170
+ checkDestroy(this.#destroyed);
171
+ return this.#videoElement.muted;
172
+ }
173
+ /**
174
+ * Mutes the current playback.
175
+ * @returns {Promise<void>}
176
+ */
177
+ async mute() {
178
+ checkDestroy(this.#destroyed);
179
+ this.#videoElement.muted = true;
180
+ }
181
+ /**
182
+ * Unmutes the current playback.
183
+ * @returns {Promise<void>}
184
+ */
185
+ async unMute() {
186
+ checkDestroy(this.#destroyed);
187
+ this.#videoElement.muted = false;
136
188
  }
137
189
  /**
138
190
  * Gets the current playback time.
@@ -207,6 +259,24 @@ class HtmlVideoAdapter extends BaseMediaAdapter {
207
259
  this.#videoElement.volume = value;
208
260
  this.emit('volumeChange', value);
209
261
  }
262
+ /**
263
+ * Retrieves the metadata of the currently loaded content, returning a structured
264
+ * object containing details such as the content ID, title, author, and duration.
265
+ * @returns {Promise<ContentData>}
266
+ */
267
+ async getContentData() {
268
+ return {
269
+ id: '',
270
+ createdAt: '',
271
+ artistId: '',
272
+ artistName: '',
273
+ description: '',
274
+ title: '',
275
+ duration: 0,
276
+ avatar: '',
277
+ url: '',
278
+ };
279
+ }
210
280
  /**
211
281
  * Cleans up the adapter resources and marks it as destroyed.
212
282
  * @returns {Promise<void>}