Video progress bar does not work properly

Asked

Viewed 69 times

0

I need to show a video in the view using c#. The video up runs, but the progress bar does not work properly. Currently if I move and forward the video or delay the video by progress bar; nothing happens.

So is my view <video id="video" width="100%" preload="none" type="video/mp4" controls></video> and so is javascript video.src = "@Url.Content("~/")Noticia/[email protected]";

So is my controller

 [HttpGet]
        public ActionResult VisualizarVideo(int id)
        {
            byte[] fileData = new byte[0];
           
               var noticia = db.NOTICIAS.Where(e => e.ID == id).FirstOrDefault();
         
            var memoryStream = new MemoryStream(noticia.VIDEO == null ? fileData : noticia.VIDEO);
           return new FileStreamResult(memoryStream, new MediaTypeHeaderValue(noticia.VIDEO_CONTENT_TYPE).MediaType);
            
        }```
  • 1

    Face your question has nothing to do with Asp, mvc or c#... is purely html and javascript, present a [mcve]

1 answer

0


Thank you all! But the answer is that the on the server was missing accept HTTP range requests. So that’s what my controller looked like:

Source: https://stackoverflow.com/questions/59593310/streaming-videos-with-asp-net-core-3

 [HttpGet]
        public ActionResult VisualizarVideo(int id)
        {
            byte[] fileData = new byte[0];
           
               var noticia = db.NOTICIAS.Where(e => e.ID == id).FirstOrDefault();
         
            var memoryStream = new MemoryStream(noticia.VIDEO == null ? fileData : noticia.VIDEO);

            Response.Headers.Add("Accept-Ranges", "bytes");


            return new FileStreamResult(memoryStream, new MediaTypeHeaderValue(noticia.VIDEO_CONTENT_TYPE).MediaType);
            
        }




Browser other questions tagged

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