avbridge 2.5.0 → 2.7.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/CHANGELOG.md +85 -0
- package/dist/{chunk-TBW26OPP.cjs → chunk-6SOFJV44.cjs} +59 -2
- package/dist/chunk-6SOFJV44.cjs.map +1 -0
- package/dist/{chunk-KY2GPCT7.js → chunk-OGYHFY6K.js} +59 -2
- package/dist/chunk-OGYHFY6K.js.map +1 -0
- package/dist/element-browser.js +87 -2
- package/dist/element-browser.js.map +1 -1
- package/dist/element.cjs +32 -4
- package/dist/element.cjs.map +1 -1
- package/dist/element.d.cts +13 -1
- package/dist/element.d.ts +13 -1
- package/dist/element.js +31 -3
- package/dist/element.js.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{player-B6WB74RD.d.cts → player-DGXeCNfD.d.cts} +41 -1
- package/dist/{player-B6WB74RD.d.ts → player-DGXeCNfD.d.ts} +41 -1
- package/dist/player.cjs +130 -2
- package/dist/player.cjs.map +1 -1
- package/dist/player.d.cts +191 -132
- package/dist/player.d.ts +191 -132
- package/dist/player.js +130 -2
- package/dist/player.js.map +1 -1
- package/package.json +7 -1
- package/src/element/avbridge-player.ts +84 -0
- package/src/element/avbridge-video.ts +86 -3
- package/src/element/player-styles.ts +12 -0
- package/src/strategies/fallback/index.ts +27 -0
- package/src/strategies/hybrid/index.ts +18 -0
- package/src/types.ts +32 -0
- package/src/util/time-ranges.ts +40 -0
- package/dist/chunk-KY2GPCT7.js.map +0 -1
- package/dist/chunk-TBW26OPP.cjs.map +0 -1
|
@@ -1988,6 +1988,35 @@ async function loadBridge() {
|
|
|
1988
1988
|
}
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
|
+
// src/util/time-ranges.ts
|
|
1992
|
+
function makeTimeRanges(ranges) {
|
|
1993
|
+
const frozen = ranges.slice();
|
|
1994
|
+
const impl = {
|
|
1995
|
+
get length() {
|
|
1996
|
+
return frozen.length;
|
|
1997
|
+
},
|
|
1998
|
+
start(index) {
|
|
1999
|
+
if (index < 0 || index >= frozen.length) {
|
|
2000
|
+
throw new DOMException(
|
|
2001
|
+
`TimeRanges.start: index ${index} out of range (length=${frozen.length})`,
|
|
2002
|
+
"IndexSizeError"
|
|
2003
|
+
);
|
|
2004
|
+
}
|
|
2005
|
+
return frozen[index][0];
|
|
2006
|
+
},
|
|
2007
|
+
end(index) {
|
|
2008
|
+
if (index < 0 || index >= frozen.length) {
|
|
2009
|
+
throw new DOMException(
|
|
2010
|
+
`TimeRanges.end: index ${index} out of range (length=${frozen.length})`,
|
|
2011
|
+
"IndexSizeError"
|
|
2012
|
+
);
|
|
2013
|
+
}
|
|
2014
|
+
return frozen[index][1];
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
return impl;
|
|
2018
|
+
}
|
|
2019
|
+
|
|
1991
2020
|
// src/strategies/hybrid/index.ts
|
|
1992
2021
|
var READY_AUDIO_BUFFER_SECONDS = 0.3;
|
|
1993
2022
|
var READY_TIMEOUT_SECONDS = 10;
|
|
@@ -2045,6 +2074,18 @@ async function createHybridSession(ctx, target, transport) {
|
|
|
2045
2074
|
get: () => ctx.duration ?? NaN
|
|
2046
2075
|
});
|
|
2047
2076
|
}
|
|
2077
|
+
Object.defineProperty(target, "readyState", {
|
|
2078
|
+
configurable: true,
|
|
2079
|
+
get: () => {
|
|
2080
|
+
if (!renderer.hasFrames()) return 0;
|
|
2081
|
+
if (!audio.isPlaying() && audio.bufferAhead() <= 0 && !audio.isNoAudio()) return 1;
|
|
2082
|
+
return 2;
|
|
2083
|
+
}
|
|
2084
|
+
});
|
|
2085
|
+
Object.defineProperty(target, "seekable", {
|
|
2086
|
+
configurable: true,
|
|
2087
|
+
get: () => makeTimeRanges(ctx.duration && Number.isFinite(ctx.duration) && ctx.duration > 0 ? [[0, ctx.duration]] : [])
|
|
2088
|
+
});
|
|
2048
2089
|
async function waitForBuffer() {
|
|
2049
2090
|
const start = performance.now();
|
|
2050
2091
|
while (true) {
|
|
@@ -2126,6 +2167,8 @@ async function createHybridSession(ctx, target, transport) {
|
|
|
2126
2167
|
delete target.paused;
|
|
2127
2168
|
delete target.volume;
|
|
2128
2169
|
delete target.muted;
|
|
2170
|
+
delete target.readyState;
|
|
2171
|
+
delete target.seekable;
|
|
2129
2172
|
} catch {
|
|
2130
2173
|
}
|
|
2131
2174
|
},
|
|
@@ -2646,6 +2689,18 @@ async function createFallbackSession(ctx, target, transport) {
|
|
|
2646
2689
|
get: () => ctx.duration ?? NaN
|
|
2647
2690
|
});
|
|
2648
2691
|
}
|
|
2692
|
+
Object.defineProperty(target, "readyState", {
|
|
2693
|
+
configurable: true,
|
|
2694
|
+
get: () => {
|
|
2695
|
+
if (!renderer.hasFrames()) return 0;
|
|
2696
|
+
if (!audio.isPlaying() && audio.bufferAhead() <= 0 && !audio.isNoAudio()) return 1;
|
|
2697
|
+
return 2;
|
|
2698
|
+
}
|
|
2699
|
+
});
|
|
2700
|
+
Object.defineProperty(target, "seekable", {
|
|
2701
|
+
configurable: true,
|
|
2702
|
+
get: () => makeTimeRanges(ctx.duration && Number.isFinite(ctx.duration) && ctx.duration > 0 ? [[0, ctx.duration]] : [])
|
|
2703
|
+
});
|
|
2649
2704
|
async function waitForBuffer() {
|
|
2650
2705
|
const start = performance.now();
|
|
2651
2706
|
let firstFrameAtMs = 0;
|
|
@@ -2748,6 +2803,8 @@ async function createFallbackSession(ctx, target, transport) {
|
|
|
2748
2803
|
delete target.paused;
|
|
2749
2804
|
delete target.volume;
|
|
2750
2805
|
delete target.muted;
|
|
2806
|
+
delete target.readyState;
|
|
2807
|
+
delete target.seekable;
|
|
2751
2808
|
} catch {
|
|
2752
2809
|
}
|
|
2753
2810
|
},
|
|
@@ -3301,5 +3358,5 @@ function defaultFallbackChain(strategy) {
|
|
|
3301
3358
|
}
|
|
3302
3359
|
|
|
3303
3360
|
export { FALLBACK_AUDIO_CODECS, FALLBACK_VIDEO_CODECS, NATIVE_AUDIO_CODECS, NATIVE_VIDEO_CODECS, UnifiedPlayer, classifyContext, createPlayer };
|
|
3304
|
-
//# sourceMappingURL=chunk-
|
|
3305
|
-
//# sourceMappingURL=chunk-
|
|
3361
|
+
//# sourceMappingURL=chunk-OGYHFY6K.js.map
|
|
3362
|
+
//# sourceMappingURL=chunk-OGYHFY6K.js.map
|