tiny-essentials 1.28.10 → 1.28.11
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/changelog/1/28/11.md +20 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -1
- package/dist/v1/basics/mediaContent.cjs +8 -5
- package/dist/v1/basics/mediaContent.d.mts +5 -3
- package/dist/v1/basics/mediaContent.mjs +8 -6
- package/dist/v1/libs/TinyMediaPlayer.cjs +18 -2
- package/dist/v1/libs/TinyMediaPlayer.d.mts +2 -1
- package/dist/v1/libs/TinyMediaPlayer.mjs +6 -3
- package/dist/v1/libs/TinyRadioFm.cjs +10 -1
- package/dist/v1/libs/TinyRadioFm.d.mts +2 -1
- package/dist/v1/libs/TinyRadioFm.mjs +3 -2
- package/docs/v1/basics/mediaContent.md +2 -0
- package/docs/v1/libs/TinyMediaPlayer.md +2 -1
- package/docs/v1/libs/TinyRadioFm.md +2 -1
- package/package.json +1 -1
|
@@ -76,11 +76,12 @@ class TinyMediaPlayer extends TinyDebugger {
|
|
|
76
76
|
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
77
77
|
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
78
78
|
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
79
|
+
* @param {boolean} [convertBase64toBlob=true] - If the image content needs to be converted directly into a high-performance Blob URL, use this method.
|
|
79
80
|
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
80
81
|
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
81
82
|
*/
|
|
82
|
-
static async parseContent(source, defaultMetadata, metadata, parseFile, callbacks) {
|
|
83
|
-
return parseMediaMetadata(source, defaultMetadata, metadata, parseFile, callbacks, TinyMediaPlayer.#unknownArtist);
|
|
83
|
+
static async parseContent(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob) {
|
|
84
|
+
return parseMediaMetadata(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob, TinyMediaPlayer.#unknownArtist);
|
|
84
85
|
}
|
|
85
86
|
/** @type {boolean} */
|
|
86
87
|
#destroyed = false;
|
|
@@ -1073,8 +1074,10 @@ class TinyMediaPlayer extends TinyDebugger {
|
|
|
1073
1074
|
checkDestroy(this.#destroyed);
|
|
1074
1075
|
this.log('info', `Attempting to play track at index: ${this.#currentIndex}`);
|
|
1075
1076
|
const adapter = this.#getActiveAdapter();
|
|
1076
|
-
if (!adapter)
|
|
1077
|
+
if (!adapter) {
|
|
1078
|
+
this.log('error', 'Failed to play track:', `Active adapter not found for track at index ${this.#currentIndex}.`);
|
|
1077
1079
|
return;
|
|
1080
|
+
}
|
|
1078
1081
|
// Ensure the adapter aligns with the global volume before playing
|
|
1079
1082
|
if (this.#smoothPlayPauseVolume) {
|
|
1080
1083
|
await this.#fadeAdapterVolume(this.#volume);
|
|
@@ -150,16 +150,25 @@ class TinyRadioFm extends events.EventEmitter {
|
|
|
150
150
|
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
151
151
|
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
152
152
|
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
153
|
+
* @param {boolean} [convertBase64toBlob=true] - If the image content needs to be converted directly into a high-performance Blob URL, use this method.
|
|
153
154
|
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
154
155
|
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
155
156
|
*/
|
|
156
|
-
static async parseContent(
|
|
157
|
+
static async parseContent(
|
|
158
|
+
source,
|
|
159
|
+
defaultMetadata,
|
|
160
|
+
metadata,
|
|
161
|
+
parseFile,
|
|
162
|
+
callbacks,
|
|
163
|
+
convertBase64toBlob,
|
|
164
|
+
) {
|
|
157
165
|
return mediaContent.parseMediaMetadata(
|
|
158
166
|
source,
|
|
159
167
|
defaultMetadata,
|
|
160
168
|
metadata,
|
|
161
169
|
parseFile,
|
|
162
170
|
callbacks,
|
|
171
|
+
convertBase64toBlob,
|
|
163
172
|
TinyRadioFm.#unknownArtist,
|
|
164
173
|
);
|
|
165
174
|
}
|
|
@@ -341,6 +341,7 @@ declare class TinyRadioFm extends EventEmitter {
|
|
|
341
341
|
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
342
342
|
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
343
343
|
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
344
|
+
* @param {boolean} [convertBase64toBlob=true] - If the image content needs to be converted directly into a high-performance Blob URL, use this method.
|
|
344
345
|
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
345
346
|
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
346
347
|
*/
|
|
@@ -353,7 +354,7 @@ declare class TinyRadioFm extends EventEmitter {
|
|
|
353
354
|
}, parseFile?: ParseMediaContentMetadata, callbacks?: {
|
|
354
355
|
onProgress?: (progress: LoadingMediaProgress) => void;
|
|
355
356
|
onError?: (error: MediaLoadingErrorData) => void;
|
|
356
|
-
}): Promise<MediaContent>;
|
|
357
|
+
}, convertBase64toBlob?: boolean): Promise<MediaContent>;
|
|
357
358
|
/**
|
|
358
359
|
* Gets the current value used to represent unknown artists.
|
|
359
360
|
* @returns {UnknownArtistGetter}
|
|
@@ -128,11 +128,12 @@ class TinyRadioFm extends EventEmitter {
|
|
|
128
128
|
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
129
129
|
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
130
130
|
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
131
|
+
* @param {boolean} [convertBase64toBlob=true] - If the image content needs to be converted directly into a high-performance Blob URL, use this method.
|
|
131
132
|
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
132
133
|
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
133
134
|
*/
|
|
134
|
-
static async parseContent(source, defaultMetadata, metadata, parseFile, callbacks) {
|
|
135
|
-
return parseMediaMetadata(source, defaultMetadata, metadata, parseFile, callbacks, TinyRadioFm.#unknownArtist);
|
|
135
|
+
static async parseContent(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob) {
|
|
136
|
+
return parseMediaMetadata(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob, TinyRadioFm.#unknownArtist);
|
|
136
137
|
}
|
|
137
138
|
/**
|
|
138
139
|
* @type {UnknownArtistGetter}
|
|
@@ -77,6 +77,7 @@ Downloads an audio file and uses a provided parser to extract its internal metad
|
|
|
77
77
|
* **Parameters:**
|
|
78
78
|
* `url` (string): The full URL of the audio file.
|
|
79
79
|
* `parseFile` (Function): A callback that accepts a `Blob` and returns a promise with metadata.
|
|
80
|
+
* `convertBase64toBlob` (boolean): If true, the image content will be converted directly into a high-performance Blob URL, use this method.
|
|
80
81
|
* **Returns:** `Promise<MediaContentMetadata>`
|
|
81
82
|
* **Throws:** `TypeError` for invalid arguments or `Error` for network/parsing failures.
|
|
82
83
|
|
|
@@ -94,6 +95,7 @@ Downloads an audio file and uses a provided parser to extract its internal metad
|
|
|
94
95
|
| `metadata` | `Partial<MediaContent>` | Manual overrides for the metadata (highest priority). |
|
|
95
96
|
| `parseFile` | `ParseMediaContentMetadata` | The library function used to parse the file. |
|
|
96
97
|
| `callbacks` | `Object` | Contains `onProgress` and `onError` listeners. |
|
|
98
|
+
| `convertBase64toBlob` | `boolean` | If true, the image content will be converted directly into a high-performance Blob URL, use this method.
|
|
97
99
|
| `unknownArtist` | `UnknownArtistGetter` | Logic to determine the artist if none is found. |
|
|
98
100
|
|
|
99
101
|
#### 💡 Usage Examples
|
|
@@ -181,7 +181,7 @@ When initializing `new TinyMediaPlayer(options)`, you can pass the following `Ti
|
|
|
181
181
|
* **Getter/Setter**: Allows customization of the default event subscription list.
|
|
182
182
|
|
|
183
183
|
#### Methods
|
|
184
|
-
* **`parseContent(source, defaultMetadata, metadata, parseFile, callbacks)`**:
|
|
184
|
+
* **`parseContent(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob)`**:
|
|
185
185
|
* A static factory method to prepare a `MediaContent` object by extracting metadata from a URL or HTMLMediaElement.
|
|
186
186
|
* **Parameters**:
|
|
187
187
|
* `source`: `string | HTMLMediaElement`
|
|
@@ -189,6 +189,7 @@ When initializing `new TinyMediaPlayer(options)`, you can pass the following `Ti
|
|
|
189
189
|
* `metadata`: `Partial<MediaContentBase & MediaContentMetadata>`
|
|
190
190
|
* `parseFile`: `ParseMediaContentMetadata`
|
|
191
191
|
* `callbacks`: `Object` (containing `onProgress` and `onError`)
|
|
192
|
+
* `convertBase64toBlob`: `boolean`
|
|
192
193
|
* **Returns**: `Promise<MediaContent>`.
|
|
193
194
|
|
|
194
195
|
---
|
|
@@ -42,7 +42,7 @@ The behavior of the engine is controlled via the `RadioConfig` object.
|
|
|
42
42
|
|
|
43
43
|
### 🏗️ Static Methods
|
|
44
44
|
|
|
45
|
-
#### `static parseContent(source, defaultMetadata, metadata, parseFile, callbacks)`
|
|
45
|
+
#### `static parseContent(source, defaultMetadata, metadata, parseFile, callbacks, convertBase64toBlob)`
|
|
46
46
|
Prepares a `MediaContent` object by extracting metadata from an audio source.
|
|
47
47
|
* **Parameters:**
|
|
48
48
|
* `source`: A URL string or an existing `HTMLMediaElement`.
|
|
@@ -50,6 +50,7 @@ Prepares a `MediaContent` object by extracting metadata from an audio source.
|
|
|
50
50
|
* `metadata`: Optional manual overrides.
|
|
51
51
|
* `parseFile`: Internal helper for file parsing.
|
|
52
52
|
* `callbacks`: Object containing `onProgress` and `onError` handlers.
|
|
53
|
+
* `convertBase64toBlob`: If true, the image content will be converted directly into a high-performance Blob URL, use this method.
|
|
53
54
|
* **Returns:** `Promise<MediaContent>`
|
|
54
55
|
* **Throws:** `MediaLoadingError`
|
|
55
56
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-essentials",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.11",
|
|
4
4
|
"description": "Collection of small, essential scripts designed to be used across various projects. These simple utilities are crafted for speed, ease of use, and versatility.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tiny-essentials-fork": "./TinyFork.mjs"
|