mediabunny 1.55.0 → 1.55.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/dist/bundles/mediabunny.cjs +35 -11
- package/dist/bundles/mediabunny.min.cjs +9 -9
- package/dist/bundles/mediabunny.min.mjs +9 -9
- package/dist/bundles/mediabunny.mjs +35 -11
- package/dist/bundles/mediabunny.node.cjs +35 -11
- package/dist/modules/src/isobmff/isobmff-demuxer.d.ts.map +1 -1
- package/dist/modules/src/isobmff/isobmff-demuxer.js +20 -2
- package/dist/modules/src/media-sink.d.ts.map +1 -1
- package/dist/modules/src/media-sink.js +9 -3
- package/dist/modules/src/media-source.d.ts.map +1 -1
- package/dist/modules/src/media-source.js +8 -7
- package/dist/modules/src/misc.d.ts +1 -0
- package/dist/modules/src/misc.d.ts.map +1 -1
- package/dist/modules/src/misc.js +8 -0
- package/dist/modules/src/packet.js +3 -3
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/isobmff/isobmff-demuxer.ts +21 -1
- package/src/media-sink.ts +11 -2
- package/src/media-source.ts +8 -6
- package/src/misc.ts +10 -0
- package/src/packet.ts +3 -3
|
@@ -740,6 +740,12 @@ var Mediabunny = (() => {
|
|
|
740
740
|
}
|
|
741
741
|
return chromiumVersionCache = Number(match[1]);
|
|
742
742
|
};
|
|
743
|
+
var missingWebCodecsClassMessage = (className) => {
|
|
744
|
+
if (typeof globalThis.isSecureContext !== "undefined" && !globalThis.isSecureContext) {
|
|
745
|
+
return `${className} is not available in this environment; this may be because this page is running in an insecure context. Try serving your page over HTTPS or use localhost.`;
|
|
746
|
+
}
|
|
747
|
+
return `${className} is not available in this environment.`;
|
|
748
|
+
};
|
|
743
749
|
var coalesceIndex = (a, b) => {
|
|
744
750
|
return a !== -1 ? a : b;
|
|
745
751
|
};
|
|
@@ -5533,7 +5539,7 @@ var Mediabunny = (() => {
|
|
|
5533
5539
|
throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");
|
|
5534
5540
|
}
|
|
5535
5541
|
if (typeof EncodedVideoChunk === "undefined") {
|
|
5536
|
-
throw new Error("
|
|
5542
|
+
throw new Error("EncodedVideoChunk is not available in this environment.");
|
|
5537
5543
|
}
|
|
5538
5544
|
return new EncodedVideoChunk({
|
|
5539
5545
|
data: this.data,
|
|
@@ -5555,7 +5561,7 @@ var Mediabunny = (() => {
|
|
|
5555
5561
|
throw new TypeError("Metadata-only packets cannot be converted to a video chunk.");
|
|
5556
5562
|
}
|
|
5557
5563
|
if (typeof EncodedVideoChunk === "undefined") {
|
|
5558
|
-
throw new Error("
|
|
5564
|
+
throw new Error("EncodedVideoChunk is not available in this environment.");
|
|
5559
5565
|
}
|
|
5560
5566
|
return new EncodedVideoChunk({
|
|
5561
5567
|
data: this.sideData.alpha,
|
|
@@ -5572,7 +5578,7 @@ var Mediabunny = (() => {
|
|
|
5572
5578
|
throw new TypeError("Metadata-only packets cannot be converted to an audio chunk.");
|
|
5573
5579
|
}
|
|
5574
5580
|
if (typeof EncodedAudioChunk === "undefined") {
|
|
5575
|
-
throw new Error("
|
|
5581
|
+
throw new Error("EncodedAudioChunk is not available in this environment.");
|
|
5576
5582
|
}
|
|
5577
5583
|
return new EncodedAudioChunk({
|
|
5578
5584
|
data: this.data,
|
|
@@ -6826,6 +6832,9 @@ var Mediabunny = (() => {
|
|
|
6826
6832
|
break;
|
|
6827
6833
|
}
|
|
6828
6834
|
assert(track.info);
|
|
6835
|
+
if (boxInfo.contentSize === 0) {
|
|
6836
|
+
break;
|
|
6837
|
+
}
|
|
6829
6838
|
track.info.codecDescription = readBytes(slice, boxInfo.contentSize);
|
|
6830
6839
|
}
|
|
6831
6840
|
;
|
|
@@ -6837,6 +6846,9 @@ var Mediabunny = (() => {
|
|
|
6837
6846
|
break;
|
|
6838
6847
|
}
|
|
6839
6848
|
assert(track.info);
|
|
6849
|
+
if (boxInfo.contentSize === 0) {
|
|
6850
|
+
break;
|
|
6851
|
+
}
|
|
6840
6852
|
track.info.codecDescription = readBytes(slice, boxInfo.contentSize);
|
|
6841
6853
|
}
|
|
6842
6854
|
;
|
|
@@ -8575,7 +8587,13 @@ var Mediabunny = (() => {
|
|
|
8575
8587
|
return null;
|
|
8576
8588
|
}
|
|
8577
8589
|
return this.decoderConfigPromise ??= (async () => {
|
|
8578
|
-
if (this.internalTrack.info.codec === "
|
|
8590
|
+
if (this.internalTrack.info.codec === "avc" && !this.internalTrack.info.codecDescription) {
|
|
8591
|
+
const firstPacket = await this.getFirstPacket({});
|
|
8592
|
+
this.internalTrack.info.avcCodecInfo = firstPacket && extractAvcDecoderConfigurationRecord(firstPacket.data);
|
|
8593
|
+
} else if (this.internalTrack.info.codec === "hevc" && !this.internalTrack.info.codecDescription) {
|
|
8594
|
+
const firstPacket = await this.getFirstPacket({});
|
|
8595
|
+
this.internalTrack.info.hevcCodecInfo = firstPacket && extractHevcDecoderConfigurationRecord(firstPacket.data);
|
|
8596
|
+
} else if (this.internalTrack.info.codec === "vp9" && !this.internalTrack.info.vp9CodecInfo) {
|
|
8579
8597
|
const firstPacket = await this.getFirstPacket({});
|
|
8580
8598
|
this.internalTrack.info.vp9CodecInfo = firstPacket && extractVp9CodecInfoFromPacket(firstPacket.data);
|
|
8581
8599
|
} else if (this.internalTrack.info.codec === "av1" && !this.internalTrack.info.av1CodecInfo) {
|
|
@@ -24129,8 +24147,11 @@ var Mediabunny = (() => {
|
|
|
24129
24147
|
/** @internal */
|
|
24130
24148
|
async _createDecoder(onSample, onError) {
|
|
24131
24149
|
if (!await this._track.canDecode()) {
|
|
24150
|
+
if (typeof VideoDecoder === "undefined") {
|
|
24151
|
+
throw new Error(missingWebCodecsClassMessage("VideoDecoder"));
|
|
24152
|
+
}
|
|
24132
24153
|
throw new Error(
|
|
24133
|
-
"This video track cannot be decoded
|
|
24154
|
+
"This video track cannot be decoded in this environment. Make sure to check decodability before using a track."
|
|
24134
24155
|
);
|
|
24135
24156
|
}
|
|
24136
24157
|
const codec = await this._track.getCodec();
|
|
@@ -24662,8 +24683,11 @@ var Mediabunny = (() => {
|
|
|
24662
24683
|
/** @internal */
|
|
24663
24684
|
async _createDecoder(onSample, onError) {
|
|
24664
24685
|
if (!await this._track.canDecode()) {
|
|
24686
|
+
if (typeof AudioDecoder === "undefined") {
|
|
24687
|
+
throw new Error(missingWebCodecsClassMessage("AudioDecoder"));
|
|
24688
|
+
}
|
|
24665
24689
|
throw new Error(
|
|
24666
|
-
"This audio track cannot be decoded
|
|
24690
|
+
"This audio track cannot be decoded in this environment. Make sure to check decodability before using a track."
|
|
24667
24691
|
);
|
|
24668
24692
|
}
|
|
24669
24693
|
const codec = await this._track.getCodec();
|
|
@@ -34539,14 +34563,14 @@ ${cue.notes ?? ""}`;
|
|
|
34539
34563
|
}
|
|
34540
34564
|
if (!selected) {
|
|
34541
34565
|
if (typeof VideoEncoder === "undefined") {
|
|
34542
|
-
throw new Error("VideoEncoder
|
|
34566
|
+
throw new Error(missingWebCodecsClassMessage("VideoEncoder"));
|
|
34543
34567
|
}
|
|
34544
34568
|
const firstConfig = candidates[0].config;
|
|
34545
34569
|
const rateControls = candidates.map(
|
|
34546
34570
|
({ config, quantizer }) => quantizer !== null ? `quantizer ${quantizer}` : `${config.bitrate} bps`
|
|
34547
34571
|
);
|
|
34548
34572
|
throw new Error(
|
|
34549
|
-
`This specific encoder configuration (${firstConfig.codec}, ${rateControls.join(" / ")}, ${firstConfig.width}x${firstConfig.height}, hardware acceleration: ${firstConfig.hardwareAcceleration ?? "no-preference"}) is not supported
|
|
34573
|
+
`This specific encoder configuration (${firstConfig.codec}, ${rateControls.join(" / ")}, ${firstConfig.width}x${firstConfig.height}, hardware acceleration: ${firstConfig.hardwareAcceleration ?? "no-preference"}) is not supported in this environment. Consider using another codec or changing your video parameters.`
|
|
34550
34574
|
);
|
|
34551
34575
|
}
|
|
34552
34576
|
const encoderConfig = selected.config;
|
|
@@ -35207,7 +35231,7 @@ ${cue.notes ?? ""}`;
|
|
|
35207
35231
|
});
|
|
35208
35232
|
} else {
|
|
35209
35233
|
throw new Error(
|
|
35210
|
-
"When no explicit frame rate is set, MediaStreamTrackProcessor is required; but it's not
|
|
35234
|
+
"When no explicit frame rate is set, MediaStreamTrackProcessor is required; but it's not available in this environment."
|
|
35211
35235
|
);
|
|
35212
35236
|
}
|
|
35213
35237
|
}
|
|
@@ -35588,7 +35612,7 @@ ${cue.notes ?? ""}`;
|
|
|
35588
35612
|
this.initPcmEncoder();
|
|
35589
35613
|
} else {
|
|
35590
35614
|
if (typeof AudioEncoder === "undefined") {
|
|
35591
|
-
throw new Error("AudioEncoder
|
|
35615
|
+
throw new Error(missingWebCodecsClassMessage("AudioEncoder"));
|
|
35592
35616
|
}
|
|
35593
35617
|
let supported;
|
|
35594
35618
|
try {
|
|
@@ -35599,7 +35623,7 @@ ${cue.notes ?? ""}`;
|
|
|
35599
35623
|
}
|
|
35600
35624
|
if (!supported) {
|
|
35601
35625
|
throw new Error(
|
|
35602
|
-
`This specific encoder configuration (${encoderConfig.codec}, ${encoderConfig.bitrate} bps, ${encoderConfig.numberOfChannels} channels, ${encoderConfig.sampleRate} Hz) is not supported
|
|
35626
|
+
`This specific encoder configuration (${encoderConfig.codec}, ${encoderConfig.bitrate} bps, ${encoderConfig.numberOfChannels} channels, ${encoderConfig.sampleRate} Hz) is not supported in this environment. Consider using another codec or changing your audio parameters.`
|
|
35603
35627
|
);
|
|
35604
35628
|
}
|
|
35605
35629
|
const stack = new Error("Encoding error").stack;
|