Roman
Roman

Reputation: 131178

How to show a video on a web page using Python?

To show an image on a web page I need to use <img> tag in the HTML code and in this tag to "point" to an image file location on my web-server. Can display video in a similar way? I just use a tag (for example <video>) and within this tag I point to avi or mp4 file located on my web-server.

I suppose that it cannot be done in the above described simple way. So, if it is the case, how can it be done?

I need to notice that I do not want to use videos provided by youtube or other web-services. I want to have a site where user can submit videos (for example as mp4 or avi files) and the site should be able to show these videos to other users.

Does it mean that I need to be able to convert avi and mp4 files into a flash-format? Can Python do it? Should I use HTML5 functionality instead of flash?

Upvotes: 1

Views: 7547

Answers (1)

Patrick Childers
Patrick Childers

Reputation: 26

Here is w3school's info on HTML5 video. Fortunately it's shockingly easy, and if you know how to add a picture with python, doing what you want with html5 video is not at all a great next step.

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

Upvotes: 1

Related Questions