mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-11 17:55:33 +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.currentLevel = -1;
|
||||||
hls.loadLevel = -1;
|
hls.loadLevel = -1;
|
||||||
}
|
}
|
||||||
const quality = hlsLevelToQuality(hls.levels[hls.currentLevel]);
|
// Only emit quality when we have a valid level index (>= 0)
|
||||||
emit("changedquality", quality);
|
// 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) {
|
function setupSource(vid: HTMLVideoElement, src: LoadableSource) {
|
||||||
|
|
@ -189,6 +193,7 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
||||||
autoStartLoad: true,
|
autoStartLoad: true,
|
||||||
maxBufferLength: 120, // 120 seconds
|
maxBufferLength: 120, // 120 seconds
|
||||||
maxMaxBufferLength: 240,
|
maxMaxBufferLength: 240,
|
||||||
|
abrEwmaDefaultEstimate: 5 * 1000 * 1000, // 5 Mbps default bandwidth estimate for better ABR decisions
|
||||||
fragLoadPolicy: {
|
fragLoadPolicy: {
|
||||||
default: {
|
default: {
|
||||||
maxLoadTimeMs: 30 * 1000, // allow it load extra long, fragments are slow if requested for the first time on an origin
|
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) {
|
redisplaySource(startAt: number) {
|
||||||
const store = get();
|
const store = get();
|
||||||
const quality = store.currentQuality;
|
|
||||||
if (!store.source) return;
|
if (!store.source) return;
|
||||||
const qualityPreferences = useQualityStore.getState();
|
const qualityPreferences = useQualityStore.getState();
|
||||||
const loadableStream = selectQuality(store.source, {
|
const loadableStream = selectQuality(store.source, {
|
||||||
automaticQuality: qualityPreferences.quality.automaticQuality,
|
automaticQuality: qualityPreferences.quality.automaticQuality,
|
||||||
lastChosenQuality: quality,
|
lastChosenQuality: qualityPreferences.quality.lastChosenQuality,
|
||||||
});
|
});
|
||||||
set((s) => {
|
set((s) => {
|
||||||
s.interface.error = undefined;
|
s.interface.error = undefined;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue