Comments (3)
If you want to wait for the combined buffer to reach a certain length before allowing playback to advance, set playbackRate to 0 when seeking. Set it back to 1 once it has reached the desired minimum.
Can you show me how to do it?
The console logs and "seeked" event listener are for demonstration and debugging purposes only. Adjust the minimum buffer length to a value that works with the environment you are experiencing stalls on:
var MIN_BUFFER_LENGTH = 4;
video.onseeking = () => {
console.log('Seeking to: ' + video.currentTime);
const bufferLength = hls.mainForwardBufferInfo?.len;
if (bufferLength < MIN_BUFFER_LENGTH && video.playbackRate === 1) {
console.log('Halting playback due to low buffer: ' + bufferLength);
video.playbackRate = 0;
}
};
video.onseeked = () => {
console.log('Seeked to: ' + video.currentTime);
};
hls.on(Hls.Events.FRAG_BUFFERED, () => {
const bufferLength = hls.mainForwardBufferInfo?.len;
if (bufferLength >= Math.min(MIN_BUFFER_LENGTH, video.duration - video.currentTime - 1) && video.playbackRate === 0) {
console.log('Resuming playback with buffer: ' + bufferLength);
video.playbackRate = 1;
}
});
from hls.js.
HLS.js leaves playback to the browser. If you want to wait for the combined buffer to reach a certain length before allowing playback to advance, set playbackRate to 0 when seeking. Set it back to 1 once it has reached the desired minimum.
from hls.js.
Can you show me how to do it? @robwalch
from hls.js.
Related Issues (20)
- feat: av1 support HOT 2
- Support delayed create of SourceBuffer HOT 4
- BaseStreamController always honor config.startPosition when attaching(recovering) HOT 1
- When I switched back and forth between the two Hls, the video stuck HOT 6
- Subtitles are displayed before it says in .vtt file timestamps HOT 5
- Samsung TV Tizen OS browser FLAC HOT 2
- Hello,How to customize a fLoader? HOT 2
- Some manifest files crash player when using `hls.light.min.js` with `undefined` (hasAutoSelect) error HOT 6
- ts file with audio opus codec - the audio is disabled HOT 4
- After a few plays on EDGE, the video crashed HOT 2
- hls.js not retrying when manifest request returns 404 HOT 1
- Seeking to the end of a fragment while paused stalls HOT 3
- Unsupported HEVC in M2TS found HOT 1
- audio SourceBuffer error. MediaSource readyState: ended HOT 10
- initial segments are missing audio causes video playback stuck HOT 2
- Low Latency playback - recovering after stalls HOT 4
- AV1 change level freeze image until next segment HOT 8
- HLS.js playlist could not be loaded and the video doesn't work on my web site HOT 1
- Documentation error on "stream-controller.ts" in "design.md" under "docs" folder
- Stop Loading Video Stream HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hls.js.