BreakHead
BreakHead

Reputation: 10672

Unable to play video in HTML5

I just started learning HTML5, I started with normal text file and changed its extension to .html and added the below code.

<!DOCTYPE HTML>
 <html>
 <body>

  <video width="320" height="240" controls="controls">
    <source src="D:\Movies\Troy (2004).avi" type="video/avi" /> 
    Your browser does not support the video tag.
  </video>

 </body>
 </html> 

I am using FireFox 4.0.

Upvotes: 4

Views: 12566

Answers (5)

Vihaan Verma
Vihaan Verma

Reputation: 13143

Firefox and Chrome do not support avi format , but the strange thing is if you just drop a avi file into the browser it plays just fine ! . I wonder when these browser have the capability of playing these files why are they not put in the html5 tag :\

Upvotes: 0

Dan
Dan

Reputation: 3890

It looks like you're missing a few things to make this work cross-browser, and as stated above, firefox doesn't play well with the AVI container format.

Read this: http://diveintohtml5.ep.io/video.html Or you could check out a javascript solution like this that helps make things a bit easier: http://videojs.com/

Upvotes: 2

Thomas Andre&#232; Wang
Thomas Andre&#232; Wang

Reputation: 3429

Convert your movie with Miro Video Converter or similar software

Miro - http://www.mirovideoconverter.com/

and you might want to make the player more compatible with multiple browsers.

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

example from http://www.w3schools.com/html5/html5_video.asp

Upvotes: 2

Rob
Rob

Reputation: 6871

Firefox doesn't support the avi format. Only ogg and webm are supported as also stated in this topic.

Edit: Peter Paul Koch has an more detailed overview of supported codecs in the different browsers available nowadays. See the article here.

Upvotes: 2

Related Questions