2

I am workin in mini project with Asp.net

I am trying to display a video in a website but it give me this error

enter image description here

here is the code

<video width="320" height="240" controls="controls">
      <source src="~/Hotel.mp4" type="video/mp4" />

    </video>

How can I fix this ?

4 Answers 4

1

Using HTML5 technology you may use the code below,

<video width="320" height="240" controls>
  <source src="movie.mp4" type="video/mp4">
  <source src="movie.ogg" type="video/ogg">
  <source src="movie.webm" type="video/WebM">
Your browser does not support the video tag.
</video> <br>

Keep in mind that Currently, there are 3 supported video formats for the element: MP4, WebM,Ogg

Hope it helps

0

I'm sure this site will help you: http://www.asp.net/web-pages/overview/ui,-layouts,-and-themes/10-working-with-video

0

Thanks all but this is how I solve the problem

I set the web page as defult page and I include the video as a URL like this

<video autoplay loop controls="controls" style="height: 273px; width: 490px; position: relative; top: 138px; left: 0px; ">
      <source src="http://localhost:49363/Hotel2.mp4" type="video/mp4" /></video>

and it works :) !

0

For me, the mime type was missing in Web.Config:

Adding in Web.config under <configuration> the following code fixed it:

 <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
    </staticContent>
  </system.webServer>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.