Only serve the requested content range

Using Node.js I am trying to create a video server that only serves a small portion of a larger media file.

After this gist I was able to create a video server and pipe it to the html5 video player using:

<video controls width="500">
   <source src="http://127.0.0.1:1337/" type='video/mp4'>
</video>

      

However, the range request starts at 0 and potentially buffers beyond the POI (if, say, I wanted to watch less than 25 seconds of video).

Ideally, I could play from some arbitrary point for a known duration and serve only that content. I know one solution is to find a specific point on the video client side and stop playing after a known duration; but is it possible to use ONLY video content?

Is the only reliable way to achieve this is to use a tool like FFMpeg to trim a larger clip into smaller chunks?

Thanks in advance,

GW

+3


source to share


1 answer


Digging deeper into the w3c specs I found Media Frags .

    <video id="video1" controls width="270">
        <source src="http://127.0.0.1:1337/#t=9.000001,11" type='video/mp4'>
    </video>

      



It seems strange that this is hard for me to find, but it solves my problem.

+1


source







All Articles