WWW FAQs: Why won't my audio and video files play properly?

2004-10-19: when you are linking to audio and video files and they do not play properly, or they do not play properly for all browsers, there are several possible explanations. The correct solution depends on the type of problem your visitors are having.

Mime Type Problems

First, if the audio or video file opens as "text" (gibberish in the browser window), your web server is almost certainly not recognizing it as audio or video at all. Your web server is responsible for telling the web browser what type of information a file contains. A file extension, such as .wmv, is not something that your web browser should try to interpret; it is the responsibility of the web server to make such decisions and send the correct mime type name to the web browser.

For instance, if the filename is mymovie.wmv, the web server is responsible for recognizing this and sending a Content-type: video/x-ms-wmv header to the web browser as part of its response to the browser's HTTP request. If the server does not do so, the browser is entirely correct to display it as plain text. This is necessary because file extensions do not necessarily have the same meaning on all systems, and some URLs do not have a file extension at all.

To correct such problems, see How do I add a MIME content type to my web server?

Missing Player Software

Of course, when you choose to use audio and video files, there will always be users who simply do not have the required player software. MP3 is an open standard, although not a royalty-free one, and players are available for all systems. RealMedia files, as well as MP3 files, are playable on nearly all systems with RealPlayer. Macintosh users will already have Apple's QuickTime Player, which can be used to play .mp3 files. Linux users will want to install MPlayer in addition to RealPlayer.

Share |

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!


Follow us on Twitter | Contact Us

Copyright 1994-2014 Boutell.Com, Inc. All Rights Reserved.