I'm creating a local video library but I can't workout how I can improve the performance of video seeking/scrubbing. When I view a video file which is stored locally it takes 10-15 seconds before it starts playing, and jumping around with the seek bar can take up to 45 seconds.
Opening the video with VLC and this is all instant. Is there just a straight up limitation using the HTML5 player, or is my backend code where the issue is?
To serve the video I'm using Springboot with the following method in the controller
@GetMapping(value = "/videos/p/{id}", produces = "video/mp4")
public FileSystemResource videoSource(@PathVariable String id) {
Optional<Video> optionalVideo = videoRepository.findById(id);
return optionalVideo
.map(video -> new FileSystemResource(new File(video.getAbsolutePath())))
.orElse(null);
}
I'm calling this in the frontend with a simple
<video width="100%" controls>
<source src="http://localhost:8080/videos/p/{{video.id}}" type="video/mp4">
</video>
Is there a obvious way to increase the performance here?