<\/script>')

Html 5 video tag file without extension

I have this sample code that works:

<video src="./ellen.ogv" width="320" height="240" type='video/ogg; codecs="theora, vorbis"' controls></video>

And this does not work:

<video src="./ellen" width="320" height="240" type='video/ogg; codecs="theora, vorbis"' controls></video>

The only change was in the file name. The first “indicates” its expansion, the second does not.
This is just an idea of ​​my problem when the file I want to transfer CANNOT have the extension, but is theora / vorbis (ogv) file.

How can I deal with this problem, i.e. make a video tag even if my file name does not have ".extension"?

+3
source share
1 answer

First, the attribute is typenot listed in the video tag. Put the attribute typein the tag source, for example:

<video width="320" height="240" controls>
  <source src="./ellen" type='video/ogg; codecs="theora, vorbis"'>
</video>

-, MIME -, type source. , - Content-Type: video/ogg, , .ogv .

+3

Source: https://habr.com/ru/post/1763729/


All Articles