@kenzuya/mediabunny 1.26.0 → 1.28.6
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/README.md +1 -1
- package/dist/bundles/{mediabunny.mjs → mediabunny.js} +21963 -21390
- package/dist/bundles/mediabunny.min.js +490 -0
- package/dist/modules/shared/mp3-misc.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-demuxer.d.ts +6 -6
- package/dist/modules/src/adts/adts-demuxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-muxer.d.ts +4 -4
- package/dist/modules/src/adts/adts-muxer.d.ts.map +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts +1 -1
- package/dist/modules/src/adts/adts-reader.d.ts.map +1 -1
- package/dist/modules/src/avi/avi-demuxer.d.ts +44 -0
- package/dist/modules/src/avi/avi-demuxer.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-misc.d.ts +88 -0
- package/dist/modules/src/avi/avi-misc.d.ts.map +1 -0
- package/dist/modules/src/avi/avi-muxer.d.ts +45 -0
- package/dist/modules/src/avi/avi-muxer.d.ts.map +1 -0
- package/dist/modules/src/avi/riff-writer.d.ts +26 -0
- package/dist/modules/src/avi/riff-writer.d.ts.map +1 -0
- package/dist/modules/src/codec-data.d.ts +8 -3
- package/dist/modules/src/codec-data.d.ts.map +1 -1
- package/dist/modules/src/codec.d.ts +10 -10
- package/dist/modules/src/codec.d.ts.map +1 -1
- package/dist/modules/src/conversion.d.ts +33 -16
- package/dist/modules/src/conversion.d.ts.map +1 -1
- package/dist/modules/src/custom-coder.d.ts +8 -8
- package/dist/modules/src/custom-coder.d.ts.map +1 -1
- package/dist/modules/src/demuxer.d.ts +3 -3
- package/dist/modules/src/demuxer.d.ts.map +1 -1
- package/dist/modules/src/encode.d.ts +8 -8
- package/dist/modules/src/encode.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-demuxer.d.ts +7 -7
- package/dist/modules/src/flac/flac-demuxer.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-misc.d.ts +3 -3
- package/dist/modules/src/flac/flac-misc.d.ts.map +1 -1
- package/dist/modules/src/flac/flac-muxer.d.ts +5 -5
- package/dist/modules/src/flac/flac-muxer.d.ts.map +1 -1
- package/dist/modules/src/id3.d.ts +3 -3
- package/dist/modules/src/id3.d.ts.map +1 -1
- package/dist/modules/src/index.d.ts +20 -20
- package/dist/modules/src/index.d.ts.map +1 -1
- package/dist/modules/src/input-format.d.ts +22 -0
- package/dist/modules/src/input-format.d.ts.map +1 -1
- package/dist/modules/src/input-track.d.ts +8 -8
- package/dist/modules/src/input-track.d.ts.map +1 -1
- package/dist/modules/src/input.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-boxes.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts +12 -12
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-misc.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts +11 -11
- package/dist/modules/src/isobmff/isobmff-muxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-reader.d.ts +2 -2
- package/dist/modules/src/isobmff/isobmff-reader.d.ts.map +1 -1
- package/dist/modules/src/matroska/ebml.d.ts +3 -3
- package/dist/modules/src/matroska/ebml.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-demuxer.d.ts +13 -13
- package/dist/modules/src/matroska/matroska-demuxer.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-input.d.ts +33 -0
- package/dist/modules/src/matroska/matroska-input.d.ts.map +1 -0
- package/dist/modules/src/matroska/matroska-misc.d.ts.map +1 -1
- package/dist/modules/src/matroska/matroska-muxer.d.ts +5 -5
- package/dist/modules/src/matroska/matroska-muxer.d.ts.map +1 -1
- package/dist/modules/src/media-sink.d.ts +5 -5
- package/dist/modules/src/media-sink.d.ts.map +1 -1
- package/dist/modules/src/media-source.d.ts +22 -4
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/metadata.d.ts +2 -2
- package/dist/modules/src/metadata.d.ts.map +1 -1
- package/dist/modules/src/misc.d.ts +5 -4
- package/dist/modules/src/misc.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-demuxer.d.ts +7 -7
- package/dist/modules/src/mp3/mp3-demuxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-muxer.d.ts +4 -4
- package/dist/modules/src/mp3/mp3-muxer.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-reader.d.ts +2 -2
- package/dist/modules/src/mp3/mp3-reader.d.ts.map +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts +1 -1
- package/dist/modules/src/mp3/mp3-writer.d.ts.map +1 -1
- package/dist/modules/src/muxer.d.ts +4 -4
- package/dist/modules/src/muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-demuxer.d.ts +7 -7
- package/dist/modules/src/ogg/ogg-demuxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-misc.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-muxer.d.ts +5 -5
- package/dist/modules/src/ogg/ogg-muxer.d.ts.map +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts +1 -1
- package/dist/modules/src/ogg/ogg-reader.d.ts.map +1 -1
- package/dist/modules/src/output-format.d.ts +51 -6
- package/dist/modules/src/output-format.d.ts.map +1 -1
- package/dist/modules/src/output.d.ts +13 -13
- package/dist/modules/src/output.d.ts.map +1 -1
- package/dist/modules/src/packet.d.ts +1 -1
- package/dist/modules/src/packet.d.ts.map +1 -1
- package/dist/modules/src/pcm.d.ts.map +1 -1
- package/dist/modules/src/reader.d.ts +2 -2
- package/dist/modules/src/reader.d.ts.map +1 -1
- package/dist/modules/src/sample.d.ts +57 -15
- package/dist/modules/src/sample.d.ts.map +1 -1
- package/dist/modules/src/source.d.ts +3 -3
- package/dist/modules/src/source.d.ts.map +1 -1
- package/dist/modules/src/subtitles.d.ts +1 -1
- package/dist/modules/src/subtitles.d.ts.map +1 -1
- package/dist/modules/src/target.d.ts +2 -2
- package/dist/modules/src/target.d.ts.map +1 -1
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts +1 -1
- package/dist/modules/src/wave/riff-writer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-demuxer.d.ts +6 -6
- package/dist/modules/src/wave/wave-demuxer.d.ts.map +1 -1
- package/dist/modules/src/wave/wave-muxer.d.ts +4 -4
- package/dist/modules/src/wave/wave-muxer.d.ts.map +1 -1
- package/dist/modules/src/writer.d.ts +1 -1
- package/dist/modules/src/writer.d.ts.map +1 -1
- package/dist/packages/eac3/eac3.wasm +0 -0
- package/dist/packages/eac3/mediabunny-eac3.js +1058 -0
- package/dist/packages/eac3/mediabunny-eac3.min.js +44 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.js +694 -0
- package/dist/packages/mp3-encoder/mediabunny-mp3-encoder.min.js +58 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.js +1198 -0
- package/dist/packages/mpeg4/mediabunny-mpeg4.min.js +44 -0
- package/dist/packages/mpeg4/xvid.wasm +0 -0
- package/package.json +18 -57
- package/dist/bundles/mediabunny.cjs +0 -26140
- package/dist/bundles/mediabunny.min.cjs +0 -147
- package/dist/bundles/mediabunny.min.mjs +0 -146
- package/dist/mediabunny.d.ts +0 -3319
- package/dist/modules/shared/mp3-misc.js +0 -147
- package/dist/modules/src/adts/adts-demuxer.js +0 -239
- package/dist/modules/src/adts/adts-muxer.js +0 -80
- package/dist/modules/src/adts/adts-reader.js +0 -63
- package/dist/modules/src/codec-data.js +0 -1730
- package/dist/modules/src/codec.js +0 -869
- package/dist/modules/src/conversion.js +0 -1459
- package/dist/modules/src/custom-coder.js +0 -117
- package/dist/modules/src/demuxer.js +0 -12
- package/dist/modules/src/encode.js +0 -442
- package/dist/modules/src/flac/flac-demuxer.js +0 -504
- package/dist/modules/src/flac/flac-misc.js +0 -135
- package/dist/modules/src/flac/flac-muxer.js +0 -222
- package/dist/modules/src/id3.js +0 -848
- package/dist/modules/src/index.js +0 -28
- package/dist/modules/src/input-format.js +0 -480
- package/dist/modules/src/input-track.js +0 -372
- package/dist/modules/src/input.js +0 -188
- package/dist/modules/src/isobmff/isobmff-boxes.js +0 -1480
- package/dist/modules/src/isobmff/isobmff-demuxer.js +0 -2618
- package/dist/modules/src/isobmff/isobmff-misc.js +0 -20
- package/dist/modules/src/isobmff/isobmff-muxer.js +0 -966
- package/dist/modules/src/isobmff/isobmff-reader.js +0 -72
- package/dist/modules/src/matroska/ebml.js +0 -653
- package/dist/modules/src/matroska/matroska-demuxer.js +0 -2133
- package/dist/modules/src/matroska/matroska-misc.js +0 -20
- package/dist/modules/src/matroska/matroska-muxer.js +0 -1017
- package/dist/modules/src/media-sink.js +0 -1736
- package/dist/modules/src/media-source.js +0 -1825
- package/dist/modules/src/metadata.js +0 -193
- package/dist/modules/src/misc.js +0 -623
- package/dist/modules/src/mp3/mp3-demuxer.js +0 -285
- package/dist/modules/src/mp3/mp3-muxer.js +0 -123
- package/dist/modules/src/mp3/mp3-reader.js +0 -26
- package/dist/modules/src/mp3/mp3-writer.js +0 -78
- package/dist/modules/src/muxer.js +0 -50
- package/dist/modules/src/node.d.ts +0 -9
- package/dist/modules/src/node.d.ts.map +0 -1
- package/dist/modules/src/node.js +0 -9
- package/dist/modules/src/ogg/ogg-demuxer.js +0 -763
- package/dist/modules/src/ogg/ogg-misc.js +0 -78
- package/dist/modules/src/ogg/ogg-muxer.js +0 -353
- package/dist/modules/src/ogg/ogg-reader.js +0 -65
- package/dist/modules/src/output-format.js +0 -527
- package/dist/modules/src/output.js +0 -300
- package/dist/modules/src/packet.js +0 -182
- package/dist/modules/src/pcm.js +0 -85
- package/dist/modules/src/reader.js +0 -236
- package/dist/modules/src/sample.js +0 -1056
- package/dist/modules/src/source.js +0 -1182
- package/dist/modules/src/subtitles.js +0 -575
- package/dist/modules/src/target.js +0 -140
- package/dist/modules/src/wave/riff-writer.js +0 -30
- package/dist/modules/src/wave/wave-demuxer.js +0 -447
- package/dist/modules/src/wave/wave-muxer.js +0 -318
- package/dist/modules/src/writer.js +0 -370
- package/src/adts/adts-demuxer.ts +0 -331
- package/src/adts/adts-muxer.ts +0 -111
- package/src/adts/adts-reader.ts +0 -85
- package/src/codec-data.ts +0 -2078
- package/src/codec.ts +0 -1092
- package/src/conversion.ts +0 -2112
- package/src/custom-coder.ts +0 -197
- package/src/demuxer.ts +0 -24
- package/src/encode.ts +0 -739
- package/src/flac/flac-demuxer.ts +0 -730
- package/src/flac/flac-misc.ts +0 -164
- package/src/flac/flac-muxer.ts +0 -320
- package/src/id3.ts +0 -925
- package/src/index.ts +0 -221
- package/src/input-format.ts +0 -541
- package/src/input-track.ts +0 -529
- package/src/input.ts +0 -235
- package/src/isobmff/isobmff-boxes.ts +0 -1719
- package/src/isobmff/isobmff-demuxer.ts +0 -3190
- package/src/isobmff/isobmff-misc.ts +0 -29
- package/src/isobmff/isobmff-muxer.ts +0 -1348
- package/src/isobmff/isobmff-reader.ts +0 -91
- package/src/matroska/ebml.ts +0 -730
- package/src/matroska/matroska-demuxer.ts +0 -2481
- package/src/matroska/matroska-misc.ts +0 -29
- package/src/matroska/matroska-muxer.ts +0 -1276
- package/src/media-sink.ts +0 -2179
- package/src/media-source.ts +0 -2243
- package/src/metadata.ts +0 -320
- package/src/misc.ts +0 -798
- package/src/mp3/mp3-demuxer.ts +0 -383
- package/src/mp3/mp3-muxer.ts +0 -166
- package/src/mp3/mp3-reader.ts +0 -34
- package/src/mp3/mp3-writer.ts +0 -120
- package/src/muxer.ts +0 -88
- package/src/node.ts +0 -11
- package/src/ogg/ogg-demuxer.ts +0 -1053
- package/src/ogg/ogg-misc.ts +0 -116
- package/src/ogg/ogg-muxer.ts +0 -497
- package/src/ogg/ogg-reader.ts +0 -93
- package/src/output-format.ts +0 -945
- package/src/output.ts +0 -488
- package/src/packet.ts +0 -263
- package/src/pcm.ts +0 -112
- package/src/reader.ts +0 -323
- package/src/sample.ts +0 -1461
- package/src/source.ts +0 -1688
- package/src/subtitles.ts +0 -711
- package/src/target.ts +0 -204
- package/src/tsconfig.json +0 -16
- package/src/wave/riff-writer.ts +0 -36
- package/src/wave/wave-demuxer.ts +0 -529
- package/src/wave/wave-muxer.ts +0 -371
- package/src/writer.ts +0 -490
package/src/input.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2025-present, Vanilagy and contributors
|
|
3
|
-
*
|
|
4
|
-
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
-
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
6
|
-
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import { Demuxer } from './demuxer';
|
|
10
|
-
import { InputFormat } from './input-format';
|
|
11
|
-
import { assert, polyfillSymbolDispose } from './misc';
|
|
12
|
-
import { Reader } from './reader';
|
|
13
|
-
import { Source } from './source';
|
|
14
|
-
|
|
15
|
-
polyfillSymbolDispose();
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* The options for creating an Input object.
|
|
19
|
-
* @group Input files & tracks
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export type InputOptions<S extends Source = Source> = {
|
|
23
|
-
/** A list of supported formats. If the source file is not of one of these formats, then it cannot be read. */
|
|
24
|
-
formats: InputFormat[];
|
|
25
|
-
/** The source from which data will be read. */
|
|
26
|
-
source: S;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Represents an input media file. This is the root object from which all media read operations start.
|
|
31
|
-
* @group Input files & tracks
|
|
32
|
-
* @public
|
|
33
|
-
*/
|
|
34
|
-
export class Input<S extends Source = Source> implements Disposable {
|
|
35
|
-
/** @internal */
|
|
36
|
-
_source: S;
|
|
37
|
-
/** @internal */
|
|
38
|
-
_formats: InputFormat[];
|
|
39
|
-
/** @internal */
|
|
40
|
-
_demuxerPromise: Promise<Demuxer> | null = null;
|
|
41
|
-
/** @internal */
|
|
42
|
-
_format: InputFormat | null = null;
|
|
43
|
-
/** @internal */
|
|
44
|
-
_reader: Reader;
|
|
45
|
-
/** @internal */
|
|
46
|
-
_disposed = false;
|
|
47
|
-
|
|
48
|
-
/** True if the input has been disposed. */
|
|
49
|
-
get disposed() {
|
|
50
|
-
return this._disposed;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Creates a new input file from the specified options. No reading operations will be performed until methods are
|
|
55
|
-
* called on this instance.
|
|
56
|
-
*/
|
|
57
|
-
constructor(options: InputOptions<S>) {
|
|
58
|
-
if (!options || typeof options !== 'object') {
|
|
59
|
-
throw new TypeError('options must be an object.');
|
|
60
|
-
}
|
|
61
|
-
if (!Array.isArray(options.formats) || options.formats.some(x => !(x instanceof InputFormat))) {
|
|
62
|
-
throw new TypeError('options.formats must be an array of InputFormat.');
|
|
63
|
-
}
|
|
64
|
-
if (!(options.source instanceof Source)) {
|
|
65
|
-
throw new TypeError('options.source must be a Source.');
|
|
66
|
-
}
|
|
67
|
-
if (options.source._disposed) {
|
|
68
|
-
throw new Error('options.source must not be disposed.');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
this._formats = options.formats;
|
|
72
|
-
this._source = options.source;
|
|
73
|
-
this._reader = new Reader(options.source);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/** @internal */
|
|
77
|
-
_getDemuxer() {
|
|
78
|
-
return this._demuxerPromise ??= (async () => {
|
|
79
|
-
this._reader.fileSize = await this._source.getSizeOrNull();
|
|
80
|
-
|
|
81
|
-
for (const format of this._formats) {
|
|
82
|
-
const canRead = await format._canReadInput(this);
|
|
83
|
-
if (canRead) {
|
|
84
|
-
this._format = format;
|
|
85
|
-
return format._createDemuxer(this);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
throw new Error('Input has an unsupported or unrecognizable format.');
|
|
90
|
-
})();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns the source from which this input file reads its data. This is the same source that was passed to the
|
|
95
|
-
* constructor.
|
|
96
|
-
*/
|
|
97
|
-
get source() {
|
|
98
|
-
return this._source;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Returns the format of the input file. You can compare this result directly to the {@link InputFormat} singletons
|
|
103
|
-
* or use `instanceof` checks for subset-aware logic (for example, `format instanceof MatroskaInputFormat` is true
|
|
104
|
-
* for both MKV and WebM).
|
|
105
|
-
*/
|
|
106
|
-
async getFormat() {
|
|
107
|
-
await this._getDemuxer();
|
|
108
|
-
assert(this._format!);
|
|
109
|
-
return this._format;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Computes the duration of the input file, in seconds. More precisely, returns the largest end timestamp among
|
|
114
|
-
* all tracks.
|
|
115
|
-
*/
|
|
116
|
-
async computeDuration() {
|
|
117
|
-
const demuxer = await this._getDemuxer();
|
|
118
|
-
return demuxer.computeDuration();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/** Returns the list of all tracks of this input file. */
|
|
122
|
-
async getTracks() {
|
|
123
|
-
const demuxer = await this._getDemuxer();
|
|
124
|
-
return demuxer.getTracks();
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Returns the list of all video tracks of this input file. */
|
|
128
|
-
async getVideoTracks() {
|
|
129
|
-
const tracks = await this.getTracks();
|
|
130
|
-
return tracks.filter(x => x.isVideoTrack());
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** Returns the list of all audio tracks of this input file. */
|
|
134
|
-
async getAudioTracks() {
|
|
135
|
-
const tracks = await this.getTracks();
|
|
136
|
-
return tracks.filter(x => x.isAudioTrack());
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/** Returns the list of all subtitle tracks of this input file. */
|
|
140
|
-
async getSubtitleTracks() {
|
|
141
|
-
const tracks = await this.getTracks();
|
|
142
|
-
return tracks.filter(x => x.isSubtitleTrack());
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Returns the primary video track of this input file, or null if there are no video tracks. */
|
|
146
|
-
async getPrimaryVideoTrack() {
|
|
147
|
-
const tracks = await this.getTracks();
|
|
148
|
-
return tracks.find(x => x.isVideoTrack()) ?? null;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** Returns the primary audio track of this input file, or null if there are no audio tracks. */
|
|
152
|
-
async getPrimaryAudioTrack() {
|
|
153
|
-
const tracks = await this.getTracks();
|
|
154
|
-
return tracks.find(x => x.isAudioTrack()) ?? null;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Returns the list of all subtitle tracks of this input file. This is a convenience property that calls
|
|
159
|
-
* {@link Input.getSubtitleTracks} and caches the result. Note that this property is a promise!
|
|
160
|
-
*/
|
|
161
|
-
get subtitleTracks() {
|
|
162
|
-
return this.getSubtitleTracks();
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Returns the list of all video tracks of this input file. This is a convenience property that calls
|
|
167
|
-
* {@link Input.getVideoTracks} and caches the result. Note that this property is a promise!
|
|
168
|
-
*/
|
|
169
|
-
get videoTracks() {
|
|
170
|
-
return this.getVideoTracks();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Returns the list of all audio tracks of this input file. This is a convenience property that calls
|
|
175
|
-
* {@link Input.getAudioTracks} and caches the result. Note that this property is a promise!
|
|
176
|
-
*/
|
|
177
|
-
get audioTracks() {
|
|
178
|
-
return this.getAudioTracks();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** Returns the full MIME type of this input file, including track codecs. */
|
|
182
|
-
async getMimeType() {
|
|
183
|
-
const demuxer = await this._getDemuxer();
|
|
184
|
-
return demuxer.getMimeType();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Returns descriptive metadata tags about the media file, such as title, author, date, cover art, or other
|
|
189
|
-
* attached files.
|
|
190
|
-
*/
|
|
191
|
-
async getMetadataTags() {
|
|
192
|
-
const demuxer = await this._getDemuxer();
|
|
193
|
-
return demuxer.getMetadataTags();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Disposes this input and frees connected resources. When an input is disposed, ongoing read operations will be
|
|
198
|
-
* canceled, all future read operations will fail, any open decoders will be closed, and all ongoing media sink
|
|
199
|
-
* operations will be canceled. Disallowed and canceled operations will throw an {@link InputDisposedError}.
|
|
200
|
-
*
|
|
201
|
-
* You are expected not to use an input after disposing it. While some operations may still work, it is not
|
|
202
|
-
* specified and may change in any future update.
|
|
203
|
-
*/
|
|
204
|
-
dispose() {
|
|
205
|
-
if (this._disposed) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
this._disposed = true;
|
|
210
|
-
|
|
211
|
-
this._source._disposed = true;
|
|
212
|
-
this._source._dispose();
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Calls `.dispose()` on the input, implementing the `Disposable` interface for use with
|
|
217
|
-
* JavaScript Explicit Resource Management features.
|
|
218
|
-
*/
|
|
219
|
-
[Symbol.dispose]() {
|
|
220
|
-
this.dispose();
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Thrown when an operation was prevented because the corresponding {@link Input} has been disposed.
|
|
226
|
-
* @group Input files & tracks
|
|
227
|
-
* @public
|
|
228
|
-
*/
|
|
229
|
-
export class InputDisposedError extends Error {
|
|
230
|
-
/** Creates a new {@link InputDisposedError}. */
|
|
231
|
-
constructor(message = 'Input has been disposed.') {
|
|
232
|
-
super(message);
|
|
233
|
-
this.name = 'InputDisposedError';
|
|
234
|
-
}
|
|
235
|
-
}
|