Streaming a video to a Blazor web application from .Net 7 Minimal API service works beautifully except for seeking. It will only pause/play and continue from beginning to end no matter where I try and navigate to. One workaround is to download the video and open it in a video player, but is there another solution either on the API side or an attribute in HTML5 video control that will allow me to seek any position in the streaming video?
<video src=@Src autoplay muted controls type="video/mp4"></video>
app.MapGet("/video", (string filename) => {
string filePath = Path.Combine(settings.MoviesDirectory, filename) + ".mp4";
return Results.Stream(new FileStream(filePath, FileMode.Open));
});
I've just discovered that the problem only happens when the app is deployed to IIS. Running in Visual Studio, seek works. Another discovery, the problem only happens in Edge and Chrome. In Firefox, seek works, so at least I have a workaround, but perhaps there is a browser setting that will fix the issue in Edge and Chrome.