Video stream interruption #965
Replies: 1 comment 18 replies
-
@uniqueandriy It sounds like you are performing incorrect backpressure handling. With that said, If you wrote your code according to the video streaming example than this section of code may be problematic: https://github.com/uNetworking/uWebSockets.js/blob/ecd89ce24ae98fd3936e3387ccd315615d1eee37/examples/VideoStreamer.js#L41C7-L81 Essentially, this code consumes each chunk from the readStream with the As discussed in the issue above, I implemented a fix for this in hyper-express with proper backpressure handling recently, so feel free to put together a very quick demo to stream your large video file using hyper-express to see If that may resolve your issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Recently I ran into a bit of a puzzle while working on one of my projects. I've been working on adding a typical file streaming (with ranges support, cache control, etc.), and decided to test it out with a short 5-minute video. The initial playback was just fine, but I noticed Chrome was repeatedly reconnecting to get data ranges from the server.
After some debugging, I discovered that the connection was getting aborted, and it seemed like the browser wasn't the one causing it. Chrome kept thinking the connection was fine even when the server called the
.onAborted
callback, leading to thenet::ERR CONTENT LENGTH MISMATCH
error in the console. As a result, sometimes playback was interrupted altogether.To make sure I hadn't messed up something, I decided to compare with the video streaming example, to which I added corking and a Content-Length header. The interruptions persisted, here're the logs:
Got me wondering, why is this happening? Typically, when you serve such a video from something like
nginx
, a single connection stays active until the stream ends. Even if there are rare reconnections, the browser figures out right away the connection is closed.P.S.: uWebSockets.js v20.31.0, Node.js v18.12.1, Windows 10 Pro (Build 19041)
Beta Was this translation helpful? Give feedback.
All reactions