While implementing HTML5 video with WebM source files (or presumably Ogg Theora) on a new Drupal 7 site — the file totally fails. Looking at the page in Firefox, the video file simply doesn't load. The HTML5 video player sits there with a broken source file icon.
After many hours of debugging, I tracked down the problem — the server is not properly supporting the file type.
The fix is to add the following lines to the htaccess file:
#
# Serve webm files as WebM video and ogg files as Ogg video
#
AddType video/ogg .ogv
AddType video/webm .webm
This tells the server and browser and what these files are.
Searching Drupal.org, it seems a lot of people are having trouble with WebM throughout Drupalandia, and are filing support requests on various Drupal contrib module issue queues.
It would be great for Drupal core to support WebM and Ogg Theora out of the box, especially since this could help overall adoption of the open source video codecs. Too many times, I've seen development teams consider supporting WebM too much work, and instead only use h.264 (with flash for Firefox and Opera). This is quite an obscure bug that's easy to fix. Without this, Drupal doesn't really support HMTL5 video.
Comments
Comment #1
jensimmons CreditAttribution: jensimmons commentedHas to go into Drupal 8 first, and get back ported.
Comment #2
Crell CreditAttribution: Crell commentedI've no objection. My only question is whether this is really a Drupal issue, or a web server configuration bug that we're just hacking around. (I mean really, shouldn't Apache have those associations by default already?)
Comment #3
willvincent CreditAttribution: willvincent commentedThis seems like a reasonable request. It's only adding a couple lines to the htaccess file, so it's not like it would bloat the codebase.
+1
Comment #4
Dave ReidMy concern about .webm is that it can either be audio or video (see the mimetypes on http://en.wikipedia.org/wiki/WebM) - it's an ambiguous file format so I would worry about hard-coding this video assumption. I also wonder why Apache doesn't have the happings for ogv.
Comment #5
jensimmons CreditAttribution: jensimmons commentedI agree, it seems this isn't really a Drupal problem, but a Apache (or other type of) server problem. Yet altering the htaccess file seems like a good fix to me — even if it's an impure hack. IMO, the downside is minimal — a practical solution to a growning-pains problem in exchange for tolerating something that's a inconsistent with what usually goes into the Drupal .htaccess file.
Years from now presumably these two lines could be removed, once servers uniformly support .webm and .ogv files.
I see two decisions to be made:
I did not encounter this problem when posting .ogg audio files.
Comment #6
willvincent CreditAttribution: willvincent commentedwikipedia makes it look like it can be audio or video, but according to the webmproject site (http://www.webmproject.org/about/), it is a video format. So, I would think setting the mime type as such is perfectly acceptable.
Comment #7
Dave ReidNevermind, it looks like we're slowly moving towards using a .weba for audio/webm and .webm is used only for video.
http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
http://www.webcoder.de/2010/06/04/how-to-configure-your-webserver-for-we...
https://groups.google.com/a/webmproject.org/group/webm-discuss/browse_th...
Comment #8
Dave ReidI'm unsure on this too. Do we add support for any new file extension that apache adds in its mime.types in our own .htaccess? How do we balance which added file extensions are useful for end users? We'd also need to records in web.config for IIS.
FYI we also need to add the webm/weba file extensions in file_default_mimetype_mapping().
Comment #9
markdorisonThis may not technically be Drupal's problem, per se, but it seems like a small fix with a lot of upside.
Comment #10
jensimmons CreditAttribution: jensimmons commentedComment #11
Crell CreditAttribution: Crell commentedA little undirected googling suggests that "yeah, just add it to your config" is the common answer right now, so we may as well do the same until it becomes standard in Apache/IIS. Dave is right that we'd need to do so for both apache and IIS at this point, since we claim to support both equally. As not an expert in either one I cannot speak to what the "best" syntax is to do so.
We should probably include weba, too, while we're at it.
Comment #12
jensimmons CreditAttribution: jensimmons commentedThis is part of what motivated me to file a core bug: search for "WebM" on drupal.org, and you see struggle after struggle after struggle to solve this same problem. Sadly, very little else is being said about the leading open-source video codec.
http://drupal.org/search/apachesolr_multisitesearch/webm?filters=ss_meta...
I like things that make tricky, time-consuming problems Just Go Away™.
Comment #13
tim.plunkettfixing tags
Comment #13.0
tim.plunkett.
Comment #20
kim.pepperClosing as outdated. Please re-open if this is still relevant.