tiny-essentials 1.29.0 → 1.29.2
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/29/1.md +11 -0
- package/changelog/1/29/2.md +82 -0
- package/dist/v1/TinyBasicsEs.min.js +1 -1
- package/dist/v1/TinyEssentials.min.js +1 -1
- package/dist/v1/TinyFetchLoader.min.js +1 -0
- package/dist/v1/TinyImageLoader.min.js +1 -0
- package/dist/v1/TinyMediaCache.min.js +1 -0
- package/dist/v1/TinyMediaLoader.min.js +1 -0
- package/dist/v1/basics/index.cjs +5 -0
- package/dist/v1/basics/index.d.mts +2 -1
- package/dist/v1/basics/index.d.mts.map +1 -1
- package/dist/v1/basics/index.mjs +2 -1
- package/dist/v1/basics/media/youtube.cjs +275 -0
- package/dist/v1/basics/media/youtube.d.mts +107 -0
- package/dist/v1/basics/media/youtube.d.mts.map +1 -0
- package/dist/v1/basics/media/youtube.mjs +214 -0
- package/dist/v1/index.cjs +13 -0
- package/dist/v1/index.d.mts +6 -1
- package/dist/v1/index.d.mts.map +1 -1
- package/dist/v1/index.mjs +7 -2
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.cjs +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.d.mts.map +1 -1
- package/dist/v1/libs/fs/plugins/OPFS/StorageBucket.mjs +0 -1
- package/dist/v1/libs/fs/plugins/OPFS/index.cjs +0 -8
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts +0 -8
- package/dist/v1/libs/fs/plugins/OPFS/index.d.mts.map +1 -1
- package/dist/v1/libs/fs/plugins/OPFS/index.mjs +0 -8
- package/dist/v1/libs/html/TinyHtml.cjs +1 -1
- package/dist/v1/libs/html/TinyHtml.d.mts +2 -2
- package/dist/v1/libs/html/TinyHtml.d.mts.map +1 -1
- package/dist/v1/libs/html/TinyHtml.mjs +1 -1
- package/dist/v1/libs/html/loader/TinyMediaLoader.cjs +1999 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts +999 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/TinyMediaLoader.mjs +1852 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.cjs +77 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts +103 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs +67 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.cjs +630 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts +138 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyContentLoader.mjs +576 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.cjs +70 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts +100 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/formats/TinyVideoLoader.mjs +60 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.cjs +946 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts +67 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/beta/probe/TinyMediaProbe.mjs +896 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.cjs +225 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts +149 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/formats/TinyFetchLoader.mjs +197 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.cjs +1454 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts +200 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/formats/TinyImageLoader.mjs +1317 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.cjs +668 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts +83 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/probe/TinyImageProbe.mjs +626 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.cjs +277 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts +118 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyBufferReader.mjs +247 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.cjs +128 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts +49 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyIsoBox.mjs +116 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.cjs +796 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts +354 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaCache.mjs +734 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.cjs +302 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts +256 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaMirror.mjs +280 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.cjs +194 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts +138 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.d.mts.map +1 -0
- package/dist/v1/libs/html/loader/utils/TinyMediaProgress.mjs +175 -0
- package/dist/v1/libs/tools/TinyPkgExportValidator.cjs +359 -55
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts +64 -6
- package/dist/v1/libs/tools/TinyPkgExportValidator.d.mts.map +1 -1
- package/dist/v1/libs/tools/TinyPkgExportValidator.mjs +320 -57
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.cjs +0 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts +0 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.d.mts.map +1 -1
- package/dist/v1/libs/worker/engine/TinyWebWorkerEngine.mjs +0 -1
- package/dist/v1/webTemplates/bootstrap/5.3/scss/background/_background-grid.scss +15 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-contrast.scss +208 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/buttons/_buttons-ghost.scss +89 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_cube-icon.scss +65 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/components/icon/_sphere-pulse.scss +39 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_badges.scss +90 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_bootstrap-overrides.scss +495 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_buttons.scss +390 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_colors.scss +213 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_effects.scss +153 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms-tones.scss +69 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_forms.scss +323 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_global.scss +31 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_links.scss +47 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tables.scss +25 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_theme.scss +21 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_tokens.scss +161 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_utilities.scss +81 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/_variables.scss +63 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_form-tone-mixins.scss +236 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_sizing.scss +68 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_tone-mixins.scss +392 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/_typography.scss +112 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/background/_tiny_gradient_1.scss +131 -0
- package/dist/v1/webTemplates/bootstrap/5.3/scss/themes/deepstrap/plugins/colors/_pink.scss +47 -0
- package/dist/v1/webTemplates/multiformats/14.0/IPFSHasher/index.cjs +2 -2
- package/docs/v1/Exports.md +33 -2
- package/docs/v1/README.md +9 -0
- package/docs/v1/basics/youtube.md +204 -0
- package/docs/v1/libs/html/loader/TinyFetchLoader.md +114 -0
- package/docs/v1/libs/html/loader/TinyImageLoader.md +141 -0
- package/docs/v1/libs/html/loader/TinyMediaCache.md +166 -0
- package/docs/v1/libs/html/loader/TinyMediaLoader.md +300 -0
- package/docs/v1/libs/tools/TinyPkgExportValidator.md +55 -0
- package/docs/v1/webTemplates/ag-psd/31.0/ProcessSolidFilters.md +0 -4
- package/docs/v1/webTemplates/bootstrap/5.3/DeepStrap.md +177 -0
- package/package.json +281 -17
- /package/dist/v1/webTemplates/bootstrap/5.3/scss/input/{Placeholder-Colors-Fix.scss → _placeholder-colors-fix.scss} +0 -0
- /package/dist/v1/webTemplates/bootstrap/5.3/scss/spacing/{Spacing-Plus.scss → _spacing-plus.scss} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var TinyContentLoader = require('./TinyContentLoader.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @fileoverview Concrete loader for audio. Mirrors the VideoLoader API so the
|
|
7
|
+
* two are interchangeable inside a factory. Audio has no intrinsic dimensions,
|
|
8
|
+
* so width and height are always 0.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Configuration options for {@link TinyAudioLoader}.
|
|
13
|
+
* @typedef {Object} AudioLoaderOptions
|
|
14
|
+
* @property {string} [src] - The audio source URL.
|
|
15
|
+
* @property {number} [timeout] - Maximum time in milliseconds before the load is aborted.
|
|
16
|
+
* @property {string|null} [crossOrigin] - The CORS mode applied to the audio.
|
|
17
|
+
* @property {boolean} [autoplay] - Whether the audio should autoplay.
|
|
18
|
+
* @property {boolean} [loop] - Whether the audio should loop.
|
|
19
|
+
* @property {boolean} [muted] - Whether the audio should be muted.
|
|
20
|
+
* @property {boolean} [controls] - Whether the audio should display controls (default true).
|
|
21
|
+
* @property {'none'|'metadata'|'auto'} [preload] - The preload strategy.
|
|
22
|
+
* @property {HTMLAudioElement|null} [element] - An existing DOM element to adopt.
|
|
23
|
+
* @property {boolean} [progressive] - Whether to render progressively during fetch (default true).
|
|
24
|
+
* @property {boolean} [autoReload] - Whether an external `src` change triggers a reload.
|
|
25
|
+
* @property {boolean} [stream] - Whether to download the audio through fetch for byte progress.
|
|
26
|
+
* @property {import('../../utils/TinyMediaCache.mjs').default|null} [cache] - An optional shared memory cache.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Loads a single audio track with full lifecycle control.
|
|
31
|
+
* @extends {TinyContentLoader<HTMLAudioElement, 'audio'>}
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
class TinyAudioLoader extends TinyContentLoader {
|
|
35
|
+
/**
|
|
36
|
+
* Retrieves the uppercase tag name of the element this loader creates.
|
|
37
|
+
* @returns {string} The literal string `'AUDIO'`.
|
|
38
|
+
*/
|
|
39
|
+
static get tagName() {
|
|
40
|
+
return 'AUDIO';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Creates a new audio loader and validates the provided options.
|
|
45
|
+
* @param {AudioLoaderOptions} [options] - The loader configuration.
|
|
46
|
+
* @throws {TypeError} If `crossOrigin` is not a string or null.
|
|
47
|
+
* @throws {TypeError} If `preload` is not a string.
|
|
48
|
+
*/
|
|
49
|
+
constructor(options = {}) {
|
|
50
|
+
if (
|
|
51
|
+
options.element !== null &&
|
|
52
|
+
options.element !== undefined &&
|
|
53
|
+
!(options.element instanceof HTMLAudioElement)
|
|
54
|
+
) {
|
|
55
|
+
throw new TypeError('The "element" option must be an HTMLAudioElement or null.');
|
|
56
|
+
}
|
|
57
|
+
/** @type {import('./TinyContentLoader.mjs').TypesToTry} */
|
|
58
|
+
const mimeType = {
|
|
59
|
+
mp4: ['audio/mp4; codecs="mp4a.40.2"'],
|
|
60
|
+
webm: ['audio/webm; codecs="opus"', 'audio/webm; codecs="vorbis"'],
|
|
61
|
+
mp3: ['audio/mpeg'],
|
|
62
|
+
};
|
|
63
|
+
mimeType.m4a = mimeType.mp4;
|
|
64
|
+
mimeType.mpeg = mimeType.mp3;
|
|
65
|
+
super('audio', mimeType, options);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The underlying `<audio>` element managed by the loader.
|
|
70
|
+
* @returns {HTMLAudioElement|null} The underlying `<audio>` element, or `null` before the load starts.
|
|
71
|
+
*/
|
|
72
|
+
get audio() {
|
|
73
|
+
return this.media;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
module.exports = TinyAudioLoader;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Concrete loader for audio. Mirrors the VideoLoader API so the
|
|
3
|
+
* two are interchangeable inside a factory. Audio has no intrinsic dimensions,
|
|
4
|
+
* so width and height are always 0.
|
|
5
|
+
*/
|
|
6
|
+
import TinyContentLoader from './TinyContentLoader.mjs';
|
|
7
|
+
export type AudioLoaderOptions = {
|
|
8
|
+
/**
|
|
9
|
+
* - The audio source URL.
|
|
10
|
+
*/
|
|
11
|
+
src?: string;
|
|
12
|
+
/**
|
|
13
|
+
* - Maximum time in milliseconds before the load is aborted.
|
|
14
|
+
*/
|
|
15
|
+
timeout?: number;
|
|
16
|
+
/**
|
|
17
|
+
* - The CORS mode applied to the audio.
|
|
18
|
+
*/
|
|
19
|
+
crossOrigin?: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* - Whether the audio should autoplay.
|
|
22
|
+
*/
|
|
23
|
+
autoplay?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* - Whether the audio should loop.
|
|
26
|
+
*/
|
|
27
|
+
loop?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* - Whether the audio should be muted.
|
|
30
|
+
*/
|
|
31
|
+
muted?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* - Whether the audio should display controls (default true).
|
|
34
|
+
*/
|
|
35
|
+
controls?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* - The preload strategy.
|
|
38
|
+
*/
|
|
39
|
+
preload?: 'none' | 'metadata' | 'auto';
|
|
40
|
+
/**
|
|
41
|
+
* - An existing DOM element to adopt.
|
|
42
|
+
*/
|
|
43
|
+
element?: HTMLAudioElement | null;
|
|
44
|
+
/**
|
|
45
|
+
* - Whether to render progressively during fetch (default true).
|
|
46
|
+
*/
|
|
47
|
+
progressive?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* - Whether an external `src` change triggers a reload.
|
|
50
|
+
*/
|
|
51
|
+
autoReload?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* - Whether to download the audio through fetch for byte progress.
|
|
54
|
+
*/
|
|
55
|
+
stream?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* - An optional shared memory cache.
|
|
58
|
+
*/
|
|
59
|
+
cache?: import('../../utils/TinyMediaCache.mjs').default | null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Configuration options for {@link TinyAudioLoader}.
|
|
63
|
+
* @typedef {Object} AudioLoaderOptions
|
|
64
|
+
* @property {string} [src] - The audio source URL.
|
|
65
|
+
* @property {number} [timeout] - Maximum time in milliseconds before the load is aborted.
|
|
66
|
+
* @property {string|null} [crossOrigin] - The CORS mode applied to the audio.
|
|
67
|
+
* @property {boolean} [autoplay] - Whether the audio should autoplay.
|
|
68
|
+
* @property {boolean} [loop] - Whether the audio should loop.
|
|
69
|
+
* @property {boolean} [muted] - Whether the audio should be muted.
|
|
70
|
+
* @property {boolean} [controls] - Whether the audio should display controls (default true).
|
|
71
|
+
* @property {'none'|'metadata'|'auto'} [preload] - The preload strategy.
|
|
72
|
+
* @property {HTMLAudioElement|null} [element] - An existing DOM element to adopt.
|
|
73
|
+
* @property {boolean} [progressive] - Whether to render progressively during fetch (default true).
|
|
74
|
+
* @property {boolean} [autoReload] - Whether an external `src` change triggers a reload.
|
|
75
|
+
* @property {boolean} [stream] - Whether to download the audio through fetch for byte progress.
|
|
76
|
+
* @property {import('../../utils/TinyMediaCache.mjs').default|null} [cache] - An optional shared memory cache.
|
|
77
|
+
*/
|
|
78
|
+
/**
|
|
79
|
+
* Loads a single audio track with full lifecycle control.
|
|
80
|
+
* @extends {TinyContentLoader<HTMLAudioElement, 'audio'>}
|
|
81
|
+
* @beta
|
|
82
|
+
*/
|
|
83
|
+
declare class TinyAudioLoader extends TinyContentLoader<HTMLAudioElement, 'audio'> {
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves the uppercase tag name of the element this loader creates.
|
|
86
|
+
* @returns {string} The literal string `'AUDIO'`.
|
|
87
|
+
*/
|
|
88
|
+
static get tagName(): string;
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new audio loader and validates the provided options.
|
|
91
|
+
* @param {AudioLoaderOptions} [options] - The loader configuration.
|
|
92
|
+
* @throws {TypeError} If `crossOrigin` is not a string or null.
|
|
93
|
+
* @throws {TypeError} If `preload` is not a string.
|
|
94
|
+
*/
|
|
95
|
+
constructor(options?: AudioLoaderOptions);
|
|
96
|
+
/**
|
|
97
|
+
* The underlying `<audio>` element managed by the loader.
|
|
98
|
+
* @returns {HTMLAudioElement|null} The underlying `<audio>` element, or `null` before the load starts.
|
|
99
|
+
*/
|
|
100
|
+
get audio(): HTMLAudioElement | null;
|
|
101
|
+
}
|
|
102
|
+
export default TinyAudioLoader;
|
|
103
|
+
//# sourceMappingURL=TinyAudioLoader.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TinyAudioLoader.d.mts","sourceRoot":"","sources":["../../../../../../../src/v1/libs/html/loader/beta/formats/TinyAudioLoader.mjs"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AAIrD,YAAkB,kBAAkB,GACpC;;;;IAAoB,GAAG,AAAvB,CACA,EADW,MAAM,CACjB;;;;IAAoB,OAAO,AAA3B,CACA,EADW,MAAM,CACjB;;;;IAAyB,WAAW,AAApC,CACA,EADW,MAAM,GAAC,IAAI,CACtB;;;;IAAqB,QAAQ,AAA7B,CACA,EADW,OAAO,CAClB;;;;IAAqB,IAAI,AAAzB,CACA,EADW,OAAO,CAClB;;;;IAAqB,KAAK,AAA1B,CACA,EADW,OAAO,CAClB;;;;IAAqB,QAAQ,AAA7B,CACA,EADW,OAAO,CAClB;;;;IAAsC,OAAO,AAA7C,CACA,EADW,MAAM,GAAC,UAAU,GAAC,MAAM,CACnC;;;;IAAmC,OAAO,AAA1C,CACA,EADW,gBAAgB,GAAC,IAAI,CAChC;;;;IAAqB,WAAW,AAAhC,CACA,EADW,OAAO,CAClB;;;;IAAqB,UAAU,AAA/B,CACA,EADW,OAAO,CAClB;;;;IAAqB,MAAM,AAA3B,CACA,EADW,OAAO,CAClB;;;;IAAmE,KAAK,AAAxE,CACF,EADa,OAAO,gCAAgC,EAAE,OAAO,GAAC,IAAI,CAClE;CAAA,CAAA;AAhBD;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;GAIG;AACH,cAAM,eAAgB,SAAQ,iBAAiB,CAHhB,gBAAgB,EAAE,OAAO,CAGT;IAC7C;;;OAGG;IACH,MAAM,KAAK,OAAO,IAFL,MAAM,CAIlB;IAED;;;;;OAKG;IACH,YAAY,OAAO,AAJhB,CACA,EADQ,kBAIa,EAiBvB;IAED;;;OAGG;IACH,IAAI,KAAK,IAFI,gBAAgB,GAAC,IAAI,CAIjC;CACF;eAEc,eAAe"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Concrete loader for audio. Mirrors the VideoLoader API so the
|
|
3
|
+
* two are interchangeable inside a factory. Audio has no intrinsic dimensions,
|
|
4
|
+
* so width and height are always 0.
|
|
5
|
+
*/
|
|
6
|
+
import TinyContentLoader from './TinyContentLoader.mjs';
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for {@link TinyAudioLoader}.
|
|
9
|
+
* @typedef {Object} AudioLoaderOptions
|
|
10
|
+
* @property {string} [src] - The audio source URL.
|
|
11
|
+
* @property {number} [timeout] - Maximum time in milliseconds before the load is aborted.
|
|
12
|
+
* @property {string|null} [crossOrigin] - The CORS mode applied to the audio.
|
|
13
|
+
* @property {boolean} [autoplay] - Whether the audio should autoplay.
|
|
14
|
+
* @property {boolean} [loop] - Whether the audio should loop.
|
|
15
|
+
* @property {boolean} [muted] - Whether the audio should be muted.
|
|
16
|
+
* @property {boolean} [controls] - Whether the audio should display controls (default true).
|
|
17
|
+
* @property {'none'|'metadata'|'auto'} [preload] - The preload strategy.
|
|
18
|
+
* @property {HTMLAudioElement|null} [element] - An existing DOM element to adopt.
|
|
19
|
+
* @property {boolean} [progressive] - Whether to render progressively during fetch (default true).
|
|
20
|
+
* @property {boolean} [autoReload] - Whether an external `src` change triggers a reload.
|
|
21
|
+
* @property {boolean} [stream] - Whether to download the audio through fetch for byte progress.
|
|
22
|
+
* @property {import('../../utils/TinyMediaCache.mjs').default|null} [cache] - An optional shared memory cache.
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Loads a single audio track with full lifecycle control.
|
|
26
|
+
* @extends {TinyContentLoader<HTMLAudioElement, 'audio'>}
|
|
27
|
+
* @beta
|
|
28
|
+
*/
|
|
29
|
+
class TinyAudioLoader extends TinyContentLoader {
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the uppercase tag name of the element this loader creates.
|
|
32
|
+
* @returns {string} The literal string `'AUDIO'`.
|
|
33
|
+
*/
|
|
34
|
+
static get tagName() {
|
|
35
|
+
return 'AUDIO';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new audio loader and validates the provided options.
|
|
39
|
+
* @param {AudioLoaderOptions} [options] - The loader configuration.
|
|
40
|
+
* @throws {TypeError} If `crossOrigin` is not a string or null.
|
|
41
|
+
* @throws {TypeError} If `preload` is not a string.
|
|
42
|
+
*/
|
|
43
|
+
constructor(options = {}) {
|
|
44
|
+
if (options.element !== null &&
|
|
45
|
+
options.element !== undefined &&
|
|
46
|
+
!(options.element instanceof HTMLAudioElement)) {
|
|
47
|
+
throw new TypeError('The "element" option must be an HTMLAudioElement or null.');
|
|
48
|
+
}
|
|
49
|
+
/** @type {import('./TinyContentLoader.mjs').TypesToTry} */
|
|
50
|
+
const mimeType = {
|
|
51
|
+
mp4: ['audio/mp4; codecs="mp4a.40.2"'],
|
|
52
|
+
webm: ['audio/webm; codecs="opus"', 'audio/webm; codecs="vorbis"'],
|
|
53
|
+
mp3: ['audio/mpeg'],
|
|
54
|
+
};
|
|
55
|
+
mimeType.m4a = mimeType.mp4;
|
|
56
|
+
mimeType.mpeg = mimeType.mp3;
|
|
57
|
+
super('audio', mimeType, options);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The underlying `<audio>` element managed by the loader.
|
|
61
|
+
* @returns {HTMLAudioElement|null} The underlying `<audio>` element, or `null` before the load starts.
|
|
62
|
+
*/
|
|
63
|
+
get audio() {
|
|
64
|
+
return this.media;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export default TinyAudioLoader;
|