Video streaming over seekableStream doesn't work in VLC and ffplay
See original GitHub issueI have some video files that are stored in database, that is why I cannot use staticFiles. I found that there is context.seekableStream method where I can just provide the stream and it will send it to the client honoring the RANGE header, that is why the seeking in video player should work.
Example to reproduce with local file:
public static void main(String[] args {
System.out.println("Test video");
Javalin app = Javalin.create().start(9090);
app.get("/video", ctx -> {
File videoFile = new File("./myVideoFile.mp4");
ctx.result(new FileInputStream(videoFile));
});
}
If I open the link http://localhost/video in Google Chrome or Firefox, it is working, even the seeking back and forward works without any issue, but in developer console I see huge number of small requests(but I can live with them) I expect that it will work in other players.
Actual behavior (the bug) If I open the link in other player (VLC player, or ffplay http://localhost/video) the players could not properly play the file fully(ffprobe can play several seconds of video and then stops).
ffplay stops with the following error Stream ends prematurely at 128048, should be 7949807
Streaming the same file served with config.addStaticFiles(staticFiles -> { works without any issues in any player I tried
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I am not experienced in kotlin, but I will try to fix it and make PR
I’ll just go ahead and close this, feel free to reopen if you want to work on it.