pstream is dead; long live pstream taciturnaxolotl.github.io/pstream-ng/
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update base.ts

Pas 215cf9e3 93b5971f

+10 -26
+10 -26
src/components/player/display/base.ts
··· 170 170 hls.currentLevel = -1; 171 171 hls.loadLevel = -1; 172 172 } 173 - // Only emit quality when we have a valid level index (>= 0) 174 - // When automaticQuality is true, currentLevel is -1, so we wait for LEVEL_SWITCHED event 175 - if (hls.currentLevel >= 0) { 176 - const quality = hlsLevelToQuality(hls.levels[hls.currentLevel]); 177 - emit("changedquality", quality); 178 - } 173 + // For manual quality selection, wait for LEVEL_SWITCHED to emit quality 174 + // to avoid showing intermediate states when HLS switches away from unplayable levels 175 + // For automatic quality, currentLevel is -1, so we wait for LEVEL_SWITCHED event 179 176 } 180 177 181 178 function setupSource(vid: HTMLVideoElement, src: LoadableSource) { ··· 313 310 // Don't process level switched events during debounced quality changes 314 311 if (qualityChangeTimeout) return; 315 312 313 + const currentLevel = hls.levels[hls.currentLevel]; 314 + const currentQuality = hlsLevelToQuality(currentLevel); 315 + 316 316 if (automaticQuality) { 317 317 // Only emit quality changes when automatic quality is enabled 318 - const quality = hlsLevelToQuality(hls.levels[hls.currentLevel]); 319 - emit("changedquality", quality); 318 + emit("changedquality", currentQuality); 320 319 } else { 321 - // When automatic quality is disabled, check if current level matches preferred quality 322 - const currentQuality = hlsLevelToQuality( 323 - hls.levels[hls.currentLevel], 324 - ); 325 - const preferredQualityLevel = getPreferredQuality( 326 - hlsLevelsToQualities(hls.levels), 327 - { 328 - lastChosenQuality: preferenceQuality, 329 - automaticQuality: false, 330 - }, 331 - ); 332 - // Only re-lock if the current level doesn't match our preferred quality 333 - if (currentQuality !== preferredQualityLevel) { 334 - setupQualityForHls(); 335 - } else { 336 - // Emit the quality change since we're now at the correct level 337 - emit("changedquality", currentQuality); 338 - } 320 + // For manual quality selection, emit the user's preferred quality 321 + // This ensures the UI shows the selected quality, not the actual playing quality 322 + emit("changedquality", preferenceQuality); 339 323 } 340 324 }); 341 325 hls.on(Hls.Events.SUBTITLE_TRACK_LOADED, () => {