mirror of
https://github.com/p-stream/p-stream.git
synced 2026-01-11 20:10:32 +00:00
update auto level stuff
This commit is contained in:
parent
4143e97047
commit
f4f2f9196e
2 changed files with 8 additions and 4 deletions
|
|
@ -169,8 +169,12 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
hls.currentLevel = -1;
|
||||
hls.loadLevel = -1;
|
||||
}
|
||||
const quality = hlsLevelToQuality(hls.levels[hls.currentLevel]);
|
||||
emit("changedquality", quality);
|
||||
// Only emit quality when we have a valid level index (>= 0)
|
||||
// When automaticQuality is true, currentLevel is -1, so we wait for LEVEL_SWITCHED event
|
||||
if (hls.currentLevel >= 0) {
|
||||
const quality = hlsLevelToQuality(hls.levels[hls.currentLevel]);
|
||||
emit("changedquality", quality);
|
||||
}
|
||||
}
|
||||
|
||||
function setupSource(vid: HTMLVideoElement, src: LoadableSource) {
|
||||
|
|
@ -189,6 +193,7 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
autoStartLoad: true,
|
||||
maxBufferLength: 120, // 120 seconds
|
||||
maxMaxBufferLength: 240,
|
||||
abrEwmaDefaultEstimate: 5 * 1000 * 1000, // 5 Mbps default bandwidth estimate for better ABR decisions
|
||||
fragLoadPolicy: {
|
||||
default: {
|
||||
maxLoadTimeMs: 30 * 1000, // allow it load extra long, fragments are slow if requested for the first time on an origin
|
||||
|
|
|
|||
|
|
@ -253,12 +253,11 @@ export const createSourceSlice: MakeSlice<SourceSlice> = (set, get) => ({
|
|||
},
|
||||
redisplaySource(startAt: number) {
|
||||
const store = get();
|
||||
const quality = store.currentQuality;
|
||||
if (!store.source) return;
|
||||
const qualityPreferences = useQualityStore.getState();
|
||||
const loadableStream = selectQuality(store.source, {
|
||||
automaticQuality: qualityPreferences.quality.automaticQuality,
|
||||
lastChosenQuality: quality,
|
||||
lastChosenQuality: qualityPreferences.quality.lastChosenQuality,
|
||||
});
|
||||
set((s) => {
|
||||
s.interface.error = undefined;
|
||||
|
|
|
|||
Loading…
Reference in a new issue