Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

PhysicalFile not returning response for range requests

$
0
0

Hey,

I have a problem delivering videos in .NET Core. I'm getting a video file by an absolute path and returning it to be used as a source in a<video> element. However, I'm enabling HTTP Range requests by passing enableRangeProcessing: true to the method, and after fast seeking through the video (once it's loaded) the action stops providing responses. The response contains exactly 16.1kb of data and does not contain any response preview or response content at all. Reloading the page after that does not help, the only thing that fixes it is rebuild and rerun again, or sometimes if you wait a while (2-3 minutes) the video loads normally on reload. Does anyone know what might be causing this?

The action in question

public IActionResult GetVideo(string path) {
    path = Uri.UnescapeDataString(path);
    return PhysicalFile(path, "application/octet-stream", enableRangeProcessing: true);
}

And here's the front-end side

<video src="@Url.Action("GetVideo", "Home", new { path = ViewBag.Id })" controls></video>

The path variable is an URI-escaped string of the absolute path in my system (for debugging purposes, it will be through IDs in the future.


Viewing all articles
Browse latest Browse all 9386

Trending Articles