How to implement w3c bandwidth requests?

Asked

Viewed 47 times

0

The video plays right. However I can’t skip the video time.

Example: Skip time from 05:00 to 10:00.

It just keeps spinning, and I can’t skip time.

I searched on the internet and they say you have to do stream or range or buffer. I do not understand very well with this. Link: https://tools.ietf.org/html/rfc7233

Some say to implement byte range requests w3c. I just don’t know where to start.

Follows code:

Controller:

[HttpGet]
public EmptyResult StreamUploadedVideo(int num)
{
    byte[] teste = null;
    using (var ctx = new Entities())
    {
        var result = ctx.Table.Where(x => x.Campo == 1).FirstOrDefault();

        teste =  result.Movie;

        HttpContext.Response.AddHeader("Content-Disposition", "attachment; filename=nome.mp4");  //add header to httpcontext > response.
        HttpContext.Response.BinaryWrite(teste);  //write bytes to httpcontext response
        return new EmptyResult();
    }
}

View:

<video width="400" controls>
    <source src="@Url.Action("StreamUploadedVideo","Controller" })" type="video/mp4">
    <p>This browser does not support the video element.</p>
</video>

Can someone help me ?

  • I’ve already implemented this stuff there, helps lower the load!

1 answer

1


There are two basic ways to stream video via the web:

  • Pseudo Streaming: It takes this name because, in fact, it does not stream, it downloads all the binary of the video, progressively, and plays according to what the download happens. In some players you could give pause in the video and I await all your download to happen, then watch all the video without buffering. Benefits: It is easier to host and play the videos. Harm: It is more expensive to transmit, because you always deliver all the content, even if the entire video is not watched.

  • Adaptive Streaming: This method, instead of lowering all the binary, it lowers only Chunks - pieces - of the video, according to what the video playback is happening. This is the technique most used today by Youtube, Netflix, etc. Benefits: Cheaper to stream, one can add various qualities - bitrates - of the video, made them assistable in any bandwidth. Harms: Harder to host because it requires a specific server for the purpose.

Using Adaptive Streaming, by downloading only pieces, you can request to start downloading from a certain period, rather than always playing from the beginning.

If you want to make things simpler, you can use Azure Media Services for that. Here I did a training on how to host your videos in Azure. Maybe you can expedite your life.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.