Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WMV streaming file size limit

I have a windows media player embedded in my web page view:

 <div id="divCourseVideo" style="width:100%;margin:0 auto;" class="container">
        <OBJECT style="display:inline-block" ID="CoursePlayer" HEIGHT="400" WIDTH="400" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="video/x-ms-wmv">
            <param name='URL' value="@Url.Action("ShowMovie", "OLT", new { courseId = Model.ID })" />
            <param name='autoStart' value="true" />
            <param name='currentPosition' value="false" />
            <param name='showControls' value="true" />
        </OBJECT>


    </div>

The ShowMovie action extracts a video stream from the database and sends it to the view with this:

 public void ShowMovie(string courseId)
    {
        CourseVideo video = Repository.GetCourseVideoStream(courseId);
        var bytesinfile = new byte[video.VideoStream.Length];
        video.VideoStream.Read(bytesinfile, 0, (int)video.VideoStream.Length);
        ControllerContext.HttpContext.Response.BinaryWrite(bytesinfile);
    }

When I use a video with a size of about 10K or so will play fine. But if I use a file that is about 137K or so the file never plays. Is it too large?

When I use F12 to see the network activity I see the file is trying to come down as text/html. Why is that? I also see that on the GET function that it is aborting. Why is that? I've increased the executionTimeout value to no avail.

enter image description here

The information from napuza was good I was able to get the correct content type and it seems the entire file was streamed to the browser but it never plays.

enter image description here

like image 209
Dean.DePue Avatar asked Apr 24 '17 13:04

Dean.DePue


1 Answers

Specify the ContentType:

ControllerContext.HttpContext.Response.ContentType = "video/x-ms-wmv";
ControllerContext.HttpContext.Response.BinaryWrite(bytesinfile);
like image 96
napuzba Avatar answered Oct 21 '22 05:10

napuzba