postelrich
postelrich

Reputation: 3486

How to play/serve/stream videos to local html site? vlc/ffmpeg?

I want to be able to play videos in my website. From what I understand there are only like 4 formats supported in HTML5 amongst the browsers. I can't seem to find any straightforward tutorial on how to play a wider array of formats. How can I play, let's say an mkv file?

I believe from what I've read so far, there's a way to setup vlc or ffmpeg to serve and simultaneously convert the file to a usable format. Is this right? How can this be done?

My current solution is to run a node http-server in the video directory and play it via:

<video autoplay controls class="player">
  <source src="http://127.0.0.1:8080/movie.mkv" type="video/webm" /> 
</video>  

This gets me picture but no sound. Volume control is disabled.

Upvotes: 0

Views: 700

Answers (1)

musikele
musikele

Reputation: 363

html5 has a <video> tag and you are using it correctly. This tag, and its attributes, is standardized so every browser should follow this spec, in theory. In practice not every browser follows the spec and supports every aspect of html5 video capability. Think of other OSes, or handeld devices that must be capable of stream a video too.

Here you can find a compatibilty table and you can explore wich file types are supported by each browser:

http://caniuse.com/#search=video

As I see, mkv is not included in this spec so the browsers that can play this video are already doing something that is not required by the spec.

Last but not least, I would not suggest you to use plugins because they're not cross-OS compatible, nor cross-browser (including mobile) compatible.

Upvotes: 1

Related Questions