samedi 4 janvier 2020

ASP.NET MVC application, HTML video does not work

I've encountered this problem: I've just started to learn ASP.NET, created a simple application, and I need to play a video on one of the pages, here is a code in cshtml:

@{
    ViewBag.Title = "Player";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
    <video width="1020" height="780" controls="controls">
        <source src="file:///E:/Video/ActCAM/test2.mp4" type="video/mp4"/>
    </video>
<h2>Player</h2>

And, unfortunately, I see just a black box with a few controls on it which don't work, instead of a video. (I found a similar question html5 video is not playing mp4 error "Invalid Source"? , but that didn't work for me) I've specified a file on the local PC just for testing, web-application is also running on a local machine. However, if I change "file:///E:/Video/ActCAM/test2.mp4" type="video/mp4" to something like this: http://techslides.com/demos/sample-videos/small.mp4 (it's just a sample free video found on the internet), it works fine. Also, if I create just a simple HTML file with the following code:

<video width="1020" height="780" controls="controls">
        <source src="file:///E:/Video/ActCAM/test2.mp4" type="video/mp4"/>
    </video>

it works fine. Please, help me!




Aucun commentaire:

Enregistrer un commentaire