johndyer/mediaelement — Issue #277: getTypeFromFile errors in Firefox
Author: gmac
Created: 2011-10-14 16:03:18+00:00
State: open

The getTypeFromFile method sporadically returns a type of 'audio/mp4' for mp4 video in Firefox. As a result, many mp4 videos fail to configure. I've revised the method as follows to clear up the issue:

getTypeFromFile: function(url) {
var ext = url.substring(url.lastIndexOf('.') + 1);
//return (this.videoRegExp.test(ext) ? 'video' : 'audio') + '/' + ext; // << BREAKS IN FIREFOX.
return (/(mp4|m4v|ogg|ogv|webm|flv|wmv|mpeg)/gi.test(ext) ? 'video' : 'audio') + '/' + ext;
},