tiny-essentials 1.26.3 → 1.27.0
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/.github/workflows/node.js.yml +1 -1
- package/README.md +0 -1
- package/changelog/1/26/4.md +10 -0
- package/changelog/1/27/0.md +24 -0
- package/dist/v1/ColorSafeStringify.min.js +1 -1
- package/dist/v1/TinyAdvancedRaffle.min.js +1 -1
- package/dist/v1/TinyAfterScrollWatcher.min.js +1 -1
- package/dist/v1/TinyAnalogClock.min.js +1 -1
- package/dist/v1/TinyArrayComparator.min.js +1 -1
- package/dist/v1/TinyArrayPaginator.min.js +1 -1
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyClassManager.min.js +1 -1
- package/dist/v1/TinyClipboard.min.js +1 -1
- package/dist/v1/TinyColorConverter.min.js +1 -1
- package/dist/v1/TinyColorValidator.min.js +1 -1
- package/dist/v1/TinyCookieConsent.min.js +1 -1
- package/dist/v1/TinyDayNightCycle.min.js +1 -1
- package/dist/v1/TinyDomReadyManager.min.js +1 -1
- package/dist/v1/TinyDragDropDetector.min.js +1 -1
- package/dist/v1/TinyDragger.min.js +1 -1
- package/dist/v1/TinyElementObserver.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyEvents.min.js +1 -1
- package/dist/v1/TinyGamepad.min.js +1 -1
- package/dist/v1/TinyHtml.min.js +1 -1
- package/dist/v1/TinyI18.min.js +1 -1
- package/dist/v1/TinyIframeEvents.min.js +1 -1
- package/dist/v1/TinyInventory.min.js +1 -1
- package/dist/v1/TinyInventoryTrader.min.js +1 -1
- package/dist/v1/TinyLevelUp.min.js +1 -1
- package/dist/v1/TinyLoadingScreen.min.js +1 -1
- package/dist/v1/TinyLocalStorage.min.js +1 -1
- package/dist/v1/TinyMaInSys.min.js +1 -1
- package/dist/v1/TinyMediaPlayer.min.js +1 -0
- package/dist/v1/TinyNeedBar.min.js +1 -1
- package/dist/v1/TinyNewWinEvents.min.js +1 -1
- package/dist/v1/TinyNotifications.min.js +1 -1
- package/dist/v1/TinyNotifyCenter.min.js +1 -1
- package/dist/v1/TinyPromiseQueue.min.js +1 -1
- package/dist/v1/TinyRadioFm.min.js +1 -0
- package/dist/v1/TinyRateLimiter.min.js +1 -1
- package/dist/v1/TinySimpleDice.min.js +1 -1
- package/dist/v1/TinySmartScroller.min.js +1 -1
- package/dist/v1/TinyTextDiffer.min.js +1 -1
- package/dist/v1/TinyTextRangeEditor.min.js +1 -1
- package/dist/v1/TinyTextarea.min.js +1 -1
- package/dist/v1/TinyTimeout.min.js +1 -1
- package/dist/v1/TinyToastNotify.min.js +1 -1
- package/dist/v1/TinyUploadClicker.min.js +1 -1
- package/dist/v1/UltraRandomMsgGen.min.js +1 -1
- package/dist/v1/basics/index.cjs +5 -0
- package/dist/v1/basics/index.d.mts +5 -1
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/mediaContent.cjs +644 -0
- package/dist/v1/basics/mediaContent.d.mts +296 -0
- package/dist/v1/basics/mediaContent.mjs +557 -0
- package/dist/v1/build/TinyMediaPlayer.cjs +7 -0
- package/dist/v1/build/TinyMediaPlayer.d.mts +3 -0
- package/dist/v1/build/TinyMediaPlayer.mjs +2 -0
- package/dist/v1/build/TinyRadioFm.cjs +7 -0
- package/dist/v1/build/TinyRadioFm.d.mts +3 -0
- package/dist/v1/build/TinyRadioFm.mjs +2 -0
- package/dist/v1/index.cjs +9 -0
- package/dist/v1/index.d.mts +7 -1
- package/dist/v1/index.mjs +5 -2
- package/dist/v1/libs/ColorSafeStringify.d.mts +1 -1
- package/dist/v1/libs/TinyAfterScrollWatcher.cjs +16 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.d.mts +7 -3
- package/dist/v1/libs/TinyAfterScrollWatcher.mjs +13 -3
- package/dist/v1/libs/TinyArrayComparator.cjs +14 -11
- package/dist/v1/libs/TinyArrayComparator.d.mts +22 -19
- package/dist/v1/libs/TinyArrayComparator.mjs +14 -11
- package/dist/v1/libs/TinyArrayPaginator.cjs +23 -16
- package/dist/v1/libs/TinyArrayPaginator.d.mts +57 -30
- package/dist/v1/libs/TinyArrayPaginator.mjs +22 -16
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.cjs +265 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.d.mts +92 -0
- package/dist/v1/libs/TinyClassManager/TinyPluginInliner.mjs +223 -0
- package/dist/v1/libs/TinyClassManager.cjs +124 -23
- package/dist/v1/libs/TinyClassManager.d.mts +33 -13
- package/dist/v1/libs/TinyClassManager.mjs +108 -23
- package/dist/v1/libs/TinyColorValidator.d.mts +16 -16
- package/dist/v1/libs/TinyDragDropDetector.cjs +9 -34
- package/dist/v1/libs/TinyDragDropDetector.d.mts +7 -21
- package/dist/v1/libs/TinyDragDropDetector.mjs +9 -24
- package/dist/v1/libs/TinyDragger.cjs +5 -5
- package/dist/v1/libs/TinyDragger.d.mts +4 -3
- package/dist/v1/libs/TinyDragger.mjs +5 -5
- package/dist/v1/libs/TinyElementObserver.cjs +6 -21
- package/dist/v1/libs/TinyElementObserver.d.mts +6 -15
- package/dist/v1/libs/TinyElementObserver.mjs +6 -20
- package/dist/v1/libs/TinyEvents.cjs +7 -0
- package/dist/v1/libs/TinyEvents.d.mts +4 -0
- package/dist/v1/libs/TinyEvents.mjs +6 -0
- package/dist/v1/libs/TinyGamepad.cjs +4 -6
- package/dist/v1/libs/TinyGamepad.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlIcon.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTemplate.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/TinyHtmlTextarea.d.mts +1 -1
- package/dist/v1/libs/TinyHtml/index.d.mts +1 -1
- package/dist/v1/libs/TinyHtml.cjs +72 -98
- package/dist/v1/libs/TinyHtml.d.mts +15 -32
- package/dist/v1/libs/TinyHtml.mjs +53 -77
- package/dist/v1/libs/TinyInventory.d.mts +1 -1
- package/dist/v1/libs/TinyMediaPlayer.cjs +844 -0
- package/dist/v1/libs/TinyMediaPlayer.d.mts +306 -0
- package/dist/v1/libs/TinyMediaPlayer.mjs +755 -0
- package/dist/v1/libs/TinyRadioFm.cjs +1378 -0
- package/dist/v1/libs/TinyRadioFm.d.mts +554 -0
- package/dist/v1/libs/TinyRadioFm.mjs +1137 -0
- package/dist/v1/libs/TinySmartScroller.cjs +39 -26
- package/dist/v1/libs/TinySmartScroller.d.mts +16 -62
- package/dist/v1/libs/TinySmartScroller.mjs +35 -26
- package/dist/v1/libs/UltraRandomMsgGen.d.mts +7 -7
- package/dist/v1/libs/examples/TinyClassManager.cjs +43 -41
- package/dist/v1/libs/examples/TinyClassManager.mjs +37 -37
- package/docs/v1/README.md +6 -0
- package/docs/v1/basics/mediaContent.md +131 -0
- package/docs/v1/libs/TinyClassManager/TinyPluginInliner.md +107 -0
- package/docs/v1/libs/TinyClassManager.md +69 -70
- package/docs/v1/libs/TinyDragDropDetector.md +5 -9
- package/docs/v1/libs/TinyElementObserver.md +3 -6
- package/docs/v1/libs/TinyEvents.md +1 -1
- package/docs/v1/libs/TinyHtml.md +0 -29
- package/docs/v1/libs/TinyMediaPlayer.md +100 -0
- package/docs/v1/libs/TinyRadioFm.md +141 -0
- package/docs/v1/libs/TinySmartScroller.md +3 -3
- package/package.json +40 -22
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
export default TinyMediaPlayer;
|
|
2
|
+
export type MediaContent = import("../basics/mediaContent.mjs").MediaContent;
|
|
3
|
+
export type MediaContentBase = import("../basics/mediaContent.mjs").MediaContentBase;
|
|
4
|
+
export type MediaContentMetadata = import("../basics/mediaContent.mjs").MediaContentMetadata;
|
|
5
|
+
export type ParseMediaContentMetadata = import("../basics/mediaContent.mjs").ParseMediaContentMetadata;
|
|
6
|
+
export type LoadingMediaProgress = import("../basics/mediaContent.mjs").LoadingMediaProgress;
|
|
7
|
+
export type MediaLoadingErrorData = import("../basics/mediaContent.mjs").MediaLoadingErrorData;
|
|
8
|
+
export type UnknownArtistGetter = import("../basics/mediaContent.mjs").UnknownArtistGetter;
|
|
9
|
+
export type LoopModeType = "NONE" | "TRACK" | "PLAYLIST";
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for initializing the UniversalMediaPlayer.
|
|
12
|
+
*/
|
|
13
|
+
export type TinyMediaPlayerOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* - Whether to automatically save the volume in localStorage.
|
|
16
|
+
*/
|
|
17
|
+
persistVolume?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* - The specific key name used for localStorage cache.
|
|
20
|
+
*/
|
|
21
|
+
volumeStorageKey?: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Represents a search match containing the media object and its exact playlist index.
|
|
25
|
+
*/
|
|
26
|
+
export type SearchResult = {
|
|
27
|
+
/**
|
|
28
|
+
* - The matched media content.
|
|
29
|
+
*/
|
|
30
|
+
track: MediaContent;
|
|
31
|
+
/**
|
|
32
|
+
* - The current index of the track in the playlist.
|
|
33
|
+
*/
|
|
34
|
+
index: number;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Represents a search match containing the media object and its exact playlist index.
|
|
38
|
+
* @typedef {Object} SearchResult
|
|
39
|
+
* @property {MediaContent} track - The matched media content.
|
|
40
|
+
* @property {number} index - The current index of the track in the playlist.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* A universal media player manager capable of orchestrating multiple API adapters.
|
|
44
|
+
*/
|
|
45
|
+
declare class TinyMediaPlayer extends TinyEvents {
|
|
46
|
+
static BaseMediaAdapter: typeof BaseMediaAdapter;
|
|
47
|
+
/**
|
|
48
|
+
* @type {UnknownArtistGetter}
|
|
49
|
+
* The default identifier or function used when an artist cannot be determined.
|
|
50
|
+
*/
|
|
51
|
+
static #unknownArtist: UnknownArtistGetter;
|
|
52
|
+
/**
|
|
53
|
+
* Sets the value used to represent unknown artists.
|
|
54
|
+
* @param {UnknownArtistGetter} value - A string or a function that returns a string.
|
|
55
|
+
* @throws {TypeError} If the value is neither a string nor a function.
|
|
56
|
+
*/
|
|
57
|
+
static set unknownArtist(value: UnknownArtistGetter);
|
|
58
|
+
/**
|
|
59
|
+
* Gets the current value used to represent unknown artists.
|
|
60
|
+
* @returns {UnknownArtistGetter}
|
|
61
|
+
*/
|
|
62
|
+
static get unknownArtist(): UnknownArtistGetter;
|
|
63
|
+
/**
|
|
64
|
+
* A Static Factory Method that prepares a MediaContent object by
|
|
65
|
+
* extracting metadata from an audio source.
|
|
66
|
+
*
|
|
67
|
+
* @param {string | HTMLMediaElement} source - A URL string or an existing Audio object.
|
|
68
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [defaultMetadata={}] - Optional default metadata that overrides automatic extraction.
|
|
69
|
+
* @param {Partial<MediaContentBase & MediaContentMetadata> & { id?: string; weight?: number }} [metadata={}] - Optional manual metadata that overrides automatic extraction.
|
|
70
|
+
* @param {ParseMediaContentMetadata} [parseFile] - Private helper to interface with parseFile.
|
|
71
|
+
* @param {Object} [callbacks={}] - Callbacks for monitoring the loading process.
|
|
72
|
+
* @param {(progress: LoadingMediaProgress) => void} [callbacks.onProgress] - Callback triggered on stage changes.
|
|
73
|
+
* @param {(error: MediaLoadingErrorData) => void} [callbacks.onError] - Callback triggered when a non-fatal or fatal error occurs.
|
|
74
|
+
* @returns {Promise<MediaContent>} A promise that resolves to a valid MediaContent object.
|
|
75
|
+
* @throws {MediaLoadingError} If the preparation process fails at any stage.
|
|
76
|
+
*/
|
|
77
|
+
static parseContent(source: string | HTMLMediaElement, defaultMetadata?: Partial<MediaContentBase & MediaContentMetadata> & {
|
|
78
|
+
id?: string;
|
|
79
|
+
weight?: number;
|
|
80
|
+
}, metadata?: Partial<MediaContentBase & MediaContentMetadata> & {
|
|
81
|
+
id?: string;
|
|
82
|
+
weight?: number;
|
|
83
|
+
}, parseFile?: ParseMediaContentMetadata, callbacks?: {
|
|
84
|
+
onProgress?: ((progress: LoadingMediaProgress) => void) | undefined;
|
|
85
|
+
onError?: ((error: MediaLoadingErrorData) => void) | undefined;
|
|
86
|
+
}): Promise<MediaContent>;
|
|
87
|
+
/**
|
|
88
|
+
* @param {TinyMediaPlayerOptions} [options={}] - Configuration parameters for the player.
|
|
89
|
+
*/
|
|
90
|
+
constructor(options?: TinyMediaPlayerOptions);
|
|
91
|
+
/**
|
|
92
|
+
* Calculates a random index based on the weighted probability of each track,
|
|
93
|
+
* strictly excluding the currently active track to prevent immediate repetition.
|
|
94
|
+
* @returns {number} The selected index.
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private _getWeightedRandomIndex;
|
|
98
|
+
/**
|
|
99
|
+
* @param {MediaContent[]} value - The new playlist array.
|
|
100
|
+
* @throws {TypeError} If the value is not an array.
|
|
101
|
+
*/
|
|
102
|
+
set playlist(value: MediaContent[]);
|
|
103
|
+
/** @returns {MediaContent[]} A shallow copy of the current playlist. */
|
|
104
|
+
get playlist(): MediaContent[];
|
|
105
|
+
/**
|
|
106
|
+
* @param {number} value - The index to set as current.
|
|
107
|
+
* @throws {TypeError} If the value is not a number.
|
|
108
|
+
* @throws {RangeError} If the index is out of the playlist bounds (unless -1 for empty).
|
|
109
|
+
*/
|
|
110
|
+
set currentIndex(value: number);
|
|
111
|
+
/** @returns {number} The current active index in the playlist. */
|
|
112
|
+
get currentIndex(): number;
|
|
113
|
+
/**
|
|
114
|
+
* @param {LoopModeType} value - The desired loop mode.
|
|
115
|
+
* @throws {TypeError} If the value is not a valid LoopModeType.
|
|
116
|
+
*/
|
|
117
|
+
set loopMode(value: LoopModeType);
|
|
118
|
+
/** @returns {LoopModeType} The current loop configuration. */
|
|
119
|
+
get loopMode(): LoopModeType;
|
|
120
|
+
/**
|
|
121
|
+
* @param {boolean} value - True to enable random playback, false otherwise.
|
|
122
|
+
* @throws {TypeError} If the value is not a boolean.
|
|
123
|
+
*/
|
|
124
|
+
set isRandom(value: boolean);
|
|
125
|
+
/** @returns {boolean} The current random mode status. */
|
|
126
|
+
get isRandom(): boolean;
|
|
127
|
+
/** @returns {boolean} True if media is actively playing. */
|
|
128
|
+
get isPlaying(): boolean;
|
|
129
|
+
/**
|
|
130
|
+
* @param {number} value - The volume level to set.
|
|
131
|
+
* @throws {TypeError} If the value is not a number.
|
|
132
|
+
* @throws {RangeError} If the value is outside the 0.0 to 1.0 range.
|
|
133
|
+
*/
|
|
134
|
+
set volume(value: number);
|
|
135
|
+
/** @returns {number} The current volume level (0.0 to 1.0). */
|
|
136
|
+
get volume(): number;
|
|
137
|
+
/**
|
|
138
|
+
* @param {boolean} value - True to save volume dynamically to localStorage.
|
|
139
|
+
* @throws {TypeError} If the value is not a boolean.
|
|
140
|
+
*/
|
|
141
|
+
set persistVolume(value: boolean);
|
|
142
|
+
/** @returns {boolean} Whether the volume cache is currently enabled. */
|
|
143
|
+
get persistVolume(): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* @param {string} value - The custom storage key string.
|
|
146
|
+
* @throws {TypeError} If the value is not a string or is empty.
|
|
147
|
+
*/
|
|
148
|
+
set volumeStorageKey(value: string);
|
|
149
|
+
/** @returns {string} The localStorage key used for volume caching. */
|
|
150
|
+
get volumeStorageKey(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Registers a new media API adapter.
|
|
153
|
+
* @param {string} id - Unique identifier for the platform (e.g., 'youtube', 'spotify').
|
|
154
|
+
* @param {BaseMediaAdapter} adapter - An instance extending BaseMediaAdapter.
|
|
155
|
+
* @throws {TypeError} If id is not a string or adapter is invalid.
|
|
156
|
+
*/
|
|
157
|
+
registerAdapter(id: string, adapter: BaseMediaAdapter): void;
|
|
158
|
+
/**
|
|
159
|
+
* Adds a new item to the end of the playlist.
|
|
160
|
+
* @param {MediaContent} content - The structured media content object.
|
|
161
|
+
* @returns {number} The new length of the playlist.
|
|
162
|
+
* @throws {TypeError} If content is invalid or missing required base properties.
|
|
163
|
+
*/
|
|
164
|
+
addTrack(content: MediaContent): number;
|
|
165
|
+
/**
|
|
166
|
+
* Checks if a track exists at the specified index.
|
|
167
|
+
* @param {number} index - The target index.
|
|
168
|
+
* @returns {boolean} True if the track exists, false otherwise.
|
|
169
|
+
* @throws {TypeError} If the index is not a number.
|
|
170
|
+
*/
|
|
171
|
+
existsTrack(index: number): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Retrieves the track at the specified index.
|
|
174
|
+
* @param {number} index - The target index.
|
|
175
|
+
* @returns {MediaContent} The media content object.
|
|
176
|
+
* @throws {TypeError} If the index is not a number.
|
|
177
|
+
* @throws {RangeError} If the index is out of bounds.
|
|
178
|
+
*/
|
|
179
|
+
getTrack(index: number): MediaContent;
|
|
180
|
+
/**
|
|
181
|
+
* Removes the track at the specified index and manages playback state accordingly.
|
|
182
|
+
* @param {number} index - The index of the track to remove.
|
|
183
|
+
* @returns {Promise<void>}
|
|
184
|
+
* @throws {TypeError} If the index is not a number.
|
|
185
|
+
* @throws {RangeError} If the index is out of bounds.
|
|
186
|
+
*/
|
|
187
|
+
removeTrack(index: number): Promise<void>;
|
|
188
|
+
/**
|
|
189
|
+
* Searches the playlist for tracks matching a string query or a custom evaluation function.
|
|
190
|
+
* @param {string | function(MediaContent): boolean} query - The search string (checked against title, artist, album) or a callback returning a boolean.
|
|
191
|
+
* @returns {SearchResult[]} An array containing the matched tracks and their corresponding indices.
|
|
192
|
+
* @throws {TypeError} If the query is neither a string nor a function.
|
|
193
|
+
*/
|
|
194
|
+
searchTrack(query: string | ((arg0: MediaContent) => boolean)): SearchResult[];
|
|
195
|
+
/**
|
|
196
|
+
* Clears the entire playlist and stops playback.
|
|
197
|
+
*/
|
|
198
|
+
clearPlaylist(): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Starts or resumes playback of the current track.
|
|
201
|
+
* @returns {Promise<void>}
|
|
202
|
+
*/
|
|
203
|
+
play(): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Pauses the current track.
|
|
206
|
+
* @returns {Promise<void>}
|
|
207
|
+
*/
|
|
208
|
+
pause(): Promise<void>;
|
|
209
|
+
/**
|
|
210
|
+
* Stops playback completely.
|
|
211
|
+
* @returns {Promise<void>}
|
|
212
|
+
*/
|
|
213
|
+
stop(): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Advances to the next track based on random and loop modes.
|
|
216
|
+
* @returns {Promise<void>}
|
|
217
|
+
*/
|
|
218
|
+
next(): Promise<void>;
|
|
219
|
+
/**
|
|
220
|
+
* Returns to the previous track.
|
|
221
|
+
* @returns {Promise<void>}
|
|
222
|
+
*/
|
|
223
|
+
prev(): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Jumps to a specific absolute time in the timeline.
|
|
226
|
+
* @param {number} timeMs - The target time in milliseconds.
|
|
227
|
+
* @throws {TypeError} If timeMs is not a number.
|
|
228
|
+
* @throws {RangeError} If timeMs is negative.
|
|
229
|
+
* @returns {Promise<void>}
|
|
230
|
+
*/
|
|
231
|
+
seek(timeMs: number): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Moves the timeline forwards or backwards by a specified step amount.
|
|
234
|
+
* @param {number} stepMs - The amount of milliseconds to step (positive for forward, negative for backward).
|
|
235
|
+
* @throws {TypeError} If stepMs is not a number.
|
|
236
|
+
* @returns {Promise<void>}
|
|
237
|
+
*/
|
|
238
|
+
step(stepMs: number): Promise<void>;
|
|
239
|
+
#private;
|
|
240
|
+
}
|
|
241
|
+
import TinyEvents from './TinyEvents.mjs';
|
|
242
|
+
/**
|
|
243
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContent} MediaContent
|
|
244
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContentBase} MediaContentBase
|
|
245
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaContentMetadata} MediaContentMetadata
|
|
246
|
+
* @typedef {import('../basics/mediaContent.mjs').ParseMediaContentMetadata} ParseMediaContentMetadata
|
|
247
|
+
* @typedef {import('../basics/mediaContent.mjs').LoadingMediaProgress} LoadingMediaProgress
|
|
248
|
+
* @typedef {import('../basics/mediaContent.mjs').MediaLoadingErrorData} MediaLoadingErrorData
|
|
249
|
+
* @typedef {import('../basics/mediaContent.mjs').UnknownArtistGetter} UnknownArtistGetter
|
|
250
|
+
*/
|
|
251
|
+
/**
|
|
252
|
+
* @typedef {'NONE' | 'TRACK' | 'PLAYLIST'} LoopModeType
|
|
253
|
+
*/
|
|
254
|
+
/**
|
|
255
|
+
* Configuration options for initializing the UniversalMediaPlayer.
|
|
256
|
+
* @typedef {Object} TinyMediaPlayerOptions
|
|
257
|
+
* @property {boolean} [persistVolume=false] - Whether to automatically save the volume in localStorage.
|
|
258
|
+
* @property {string} [volumeStorageKey='universal_media_player_volume'] - The specific key name used for localStorage cache.
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* Interface definition for a Media Provider Adapter.
|
|
262
|
+
* All specific API wrappers must extend and implement this class.
|
|
263
|
+
* @abstract
|
|
264
|
+
*/
|
|
265
|
+
declare class BaseMediaAdapter {
|
|
266
|
+
/**
|
|
267
|
+
* Determines if this adapter can play the provided content.
|
|
268
|
+
* @param {MediaContent} content - The media content to evaluate.
|
|
269
|
+
* @returns {boolean} True if the adapter can handle the content, false otherwise.
|
|
270
|
+
*/
|
|
271
|
+
canHandle(content: MediaContent): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Starts or resumes playback of the provided content.
|
|
274
|
+
* @param {MediaContent} content - The media content to play.
|
|
275
|
+
* @returns {Promise<void>}
|
|
276
|
+
*/
|
|
277
|
+
play(content: MediaContent): Promise<void>;
|
|
278
|
+
/**
|
|
279
|
+
* Pauses the current playback.
|
|
280
|
+
* @returns {Promise<void>}
|
|
281
|
+
*/
|
|
282
|
+
pause(): Promise<void>;
|
|
283
|
+
/**
|
|
284
|
+
* Stops the playback completely and resets the internal platform state.
|
|
285
|
+
* @returns {Promise<void>}
|
|
286
|
+
*/
|
|
287
|
+
stop(): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Seeks to a specific time in the media timeline.
|
|
290
|
+
* @param {number} timeMs - The target time in milliseconds.
|
|
291
|
+
* @returns {Promise<void>}
|
|
292
|
+
*/
|
|
293
|
+
seek(timeMs: number): Promise<void>;
|
|
294
|
+
/**
|
|
295
|
+
* Retrieves the current playback time from the underlying API.
|
|
296
|
+
* @returns {number} The current time in milliseconds.
|
|
297
|
+
*/
|
|
298
|
+
getCurrentTime(): number;
|
|
299
|
+
/**
|
|
300
|
+
* Sets the playback volume for the underlying API.
|
|
301
|
+
* @param {number} volume - The volume level from 0.0 to 1.0.
|
|
302
|
+
* @returns {void}
|
|
303
|
+
*/
|
|
304
|
+
setVolume(volume: number): void;
|
|
305
|
+
}
|
|
306
|
+
//# sourceMappingURL=TinyMediaPlayer.d.mts.map
|