mediabunny 1.25.7 → 1.25.8
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 +59 -3
- package/dist/bundles/mediabunny.min.cjs +7 -7
- package/dist/bundles/mediabunny.min.mjs +7 -7
- package/dist/bundles/mediabunny.mjs +59 -3
- package/dist/modules/src/codec-data.d.ts +1 -0
- package/dist/modules/src/codec-data.d.ts.map +1 -1
- package/dist/modules/src/codec-data.js +55 -2
- 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 +21 -2
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/codec-data.ts +65 -1
- package/src/misc.ts +31 -2
|
@@ -639,7 +639,7 @@ var Mediabunny = (() => {
|
|
|
639
639
|
if (isWebKitCache !== null) {
|
|
640
640
|
return isWebKitCache;
|
|
641
641
|
}
|
|
642
|
-
return isWebKitCache = !!(typeof navigator !== "undefined" && navigator.vendor?.match(/apple/i));
|
|
642
|
+
return isWebKitCache = !!(typeof navigator !== "undefined" && (navigator.vendor?.match(/apple/i) || /AppleWebKit/.test(navigator.userAgent) && !/Chrome/.test(navigator.userAgent) || /\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)));
|
|
643
643
|
};
|
|
644
644
|
var isFirefoxCache = null;
|
|
645
645
|
var isFirefox = () => {
|
|
@@ -653,7 +653,21 @@ var Mediabunny = (() => {
|
|
|
653
653
|
if (isChromiumCache !== null) {
|
|
654
654
|
return isChromiumCache;
|
|
655
655
|
}
|
|
656
|
-
return isChromiumCache = !!(typeof navigator !== "undefined" && navigator.vendor?.includes("Google Inc"));
|
|
656
|
+
return isChromiumCache = !!(typeof navigator !== "undefined" && (navigator.vendor?.includes("Google Inc") || /Chrome/.test(navigator.userAgent)));
|
|
657
|
+
};
|
|
658
|
+
var chromiumVersionCache = null;
|
|
659
|
+
var getChromiumVersion = () => {
|
|
660
|
+
if (chromiumVersionCache !== null) {
|
|
661
|
+
return chromiumVersionCache;
|
|
662
|
+
}
|
|
663
|
+
if (typeof navigator === "undefined") {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
const match = /\bChrome\/(\d+)/.exec(navigator.userAgent);
|
|
667
|
+
if (!match) {
|
|
668
|
+
return null;
|
|
669
|
+
}
|
|
670
|
+
return chromiumVersionCache = Number(match[1]);
|
|
657
671
|
};
|
|
658
672
|
var coalesceIndex = (a, b) => {
|
|
659
673
|
return a !== -1 ? a : b;
|
|
@@ -3011,7 +3025,49 @@ var Mediabunny = (() => {
|
|
|
3011
3025
|
case "avc":
|
|
3012
3026
|
{
|
|
3013
3027
|
const nalUnits = extractAvcNalUnits(packetData, decoderConfig);
|
|
3014
|
-
|
|
3028
|
+
let isKeyframe = nalUnits.some((x) => extractNalUnitTypeForAvc(x) === 5 /* IDR */);
|
|
3029
|
+
if (!isKeyframe && (!isChromium() || getChromiumVersion() >= 144)) {
|
|
3030
|
+
for (const nalUnit of nalUnits) {
|
|
3031
|
+
const type = extractNalUnitTypeForAvc(nalUnit);
|
|
3032
|
+
if (type !== 6 /* SEI */) {
|
|
3033
|
+
continue;
|
|
3034
|
+
}
|
|
3035
|
+
const bytes2 = removeEmulationPreventionBytes(nalUnit);
|
|
3036
|
+
let pos = 1;
|
|
3037
|
+
do {
|
|
3038
|
+
let payloadType = 0;
|
|
3039
|
+
while (true) {
|
|
3040
|
+
const nextByte = bytes2[pos++];
|
|
3041
|
+
if (nextByte === void 0) break;
|
|
3042
|
+
payloadType += nextByte;
|
|
3043
|
+
if (nextByte < 255) {
|
|
3044
|
+
break;
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3047
|
+
let payloadSize = 0;
|
|
3048
|
+
while (true) {
|
|
3049
|
+
const nextByte = bytes2[pos++];
|
|
3050
|
+
if (nextByte === void 0) break;
|
|
3051
|
+
payloadSize += nextByte;
|
|
3052
|
+
if (nextByte < 255) {
|
|
3053
|
+
break;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
const PAYLOAD_TYPE_RECOVERY_POINT = 6;
|
|
3057
|
+
if (payloadType === PAYLOAD_TYPE_RECOVERY_POINT) {
|
|
3058
|
+
const bitstream = new Bitstream(bytes2);
|
|
3059
|
+
bitstream.pos = 8 * pos;
|
|
3060
|
+
const recoveryFrameCount = readExpGolomb(bitstream);
|
|
3061
|
+
const exactMatchFlag = bitstream.readBits(1);
|
|
3062
|
+
if (recoveryFrameCount === 0 && exactMatchFlag === 1) {
|
|
3063
|
+
isKeyframe = true;
|
|
3064
|
+
break;
|
|
3065
|
+
}
|
|
3066
|
+
}
|
|
3067
|
+
pos += payloadSize;
|
|
3068
|
+
} while (pos < bytes2.length - 1);
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3015
3071
|
return isKeyframe ? "key" : "delta";
|
|
3016
3072
|
}
|
|
3017
3073
|
;
|