s g
s g

Reputation: 1

In HTML it doesn't allow me to add videos from my computer(.mp4) however way I try

I am adding basic video .mp4 from my Windows 10 laptop in HTML but it doesn't pick up the video at all. I tried to open in any browser it doesn't open.

Upvotes: 0

Views: 71

Answers (1)

avia
avia

Reputation: 1568

I am reproducing the relevant parts of your code here for explanation purposes.

This is the correct HTML markup to include videos:

<video controls>
  <source src="/video/example.mp4" type="video/mp4"> // on your server, is your file 'example.mp4' located at /video/example.mp4 ?
  <source src="/video/example.webm" type="video/webm"> // on your server, is your file 'example.webm' located at /video/example.webm?
</video>

I suspect that you are possibly not using the correct filepath for your video files.

As a test, try replacing the content in the src attribute with a video from an online source.

So your code will look like this now

<video controls>
  <source src="https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4" type="video/mp4">
</video>

The example video should be displayed on your page now.

So double check the path to the video files and make sure it is correct, because other than that the code is OK. (added / to the beginning of the filepath to refer to your root directory.) If your video files are located in the root directory, then use src="example.mp4

You can find more info on the video tag here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video

Upvotes: 1

Related Questions