Fix video streaming Range handling, Windows paths and player wiring#66
Open
pranitdhanade-sys wants to merge 1 commit into
Open
Fix video streaming Range handling, Windows paths and player wiring#66pranitdhanade-sys wants to merge 1 commit into
pranitdhanade-sys wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Rangeheaders and inconsistent response headers/status codes.Description
parseRangeHeader(rangeHeader, fileSize)that supports open-ended and suffix byte ranges and returns validatedstart/endor{ invalid: true }for RFC-compliant handling.streamFromLocalFile(req, res, localFilePath, fallbackContentType)to asynchronouslystatand stream local files (Windows-safe path resolution viapath.resolve/path.normalize), with proper headers and206/200/416responses and cleanup on client disconnect.Accept-Ranges,Content-Length,Content-Type, and conditionalContent-Range, return206for partial responses and200for full-file responses, and ensuredownloadStream.destroy()is called when the request closes.LOCAL_VIDEOS_DIRwithpath.resolve(...), avoid blockingstatSynccalls by usingfs.promises.stat, and normalize absolute local paths.Frontend/videoplayer-live.htmlto fetch the playlist from/api/videosand set the<video>srctovideo.src(or fallback to/api/videos/:id/stream) instead of a hardcoded external demo file.Testing
node --check Backend/routes/videos.js, which succeeded.Rangeheaders) in staging to confirm end-to-end behavior.Codex Task