1
votes

Given a windows server backend, is there a way to implement a pure javascript/html5 client that would be able to play only a designated part of the video file (e.g. from 10th second to 15th on a 2 hour video)?

From what I know, standard html5 video tag will download an entire file which is not suitable for my situation.

Streaming solutions on the server would probably be an answer, but are there any that would work with pure javascript/html client? Thanks.

2

2 Answers

0
votes

To do this you should encode your video into one of the segmented/fragmented format like MPEG-DASH or Apple HLS. The result will be a playlist file and 1 or more media files containing 2 to 10 second fragments of your (long) video file. For DASH you will normally have 1 fragmented MP4 file containing 2 second fragments of video, the playlist file will tell your player which parts of the file to download corresponding to the time you wish to play. For this to work your web server needs to support HTTP RANGE headers (which most do).

For HLS you will normally end up with multiple 10 second files. The playlist file will tell the player which file to download for the time to play.

Here's how to build a HTML5 player to play DASH streams: http://blogs.msdn.com/b/interoperability/archive/2014/01/03/mpeg-dash-tutorial-embedding-an-adaptive-streaming-video-within-your-html5-application.aspx http://www-itec.uni-klu.ac.at/dash/?page_id=746

0
votes

Besides complex methods like HLS or MPEG-DASH you can consider using pseudo-streaming, or progressive download. Its seeking capability supported by a number of media servers will allow you to watch the MP4 video from any moment. Using Javascript you should be able to actually setup play and stop when you need (but that's up you to deal with different browsers handling playback in HTML5 video container).