Skip to content

Commit

Permalink
* Fixes IE9 issue phiggins42#77
Browse files Browse the repository at this point in the history
  • Loading branch information
gvenkat committed Sep 27, 2014
1 parent c6d6214 commit 0e47a22
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions detect/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

if(!has("dom")){ return; }

var video = document.createElement("video");
var video = document.createElement("video"),
canPlayType = function( type ) {
try {
return video.canPlayType( type );
} catch( e ) { }
return false;
};

addtest("video", function(){
return has.isHostType(video, "canPlayType");
Expand All @@ -14,15 +20,15 @@
// workaround required for ie9, who doesn't report video support without audio codec specified.
// bug 599718 @ msft connect
var h264 = 'video/mp4; codecs="avc1.42E01E';
return has("video") && (video.canPlayType(h264 + '"') || video.canPlayType(h264 + ', mp4a.40.2"'));
return has("video") && ( canPlayType(h264 + '"') || canPlayType(h264 + ', mp4a.40.2"'));
});

addtest("video-ogg-theora", function(){
return has("video") && video.canPlayType('video/ogg; codecs="theora, vorbis"');
return has("video") && canPlayType('video/ogg; codecs="theora, vorbis"');
});

addtest("video-webm", function(){
return has("video") && video.canPlayType('video/webm; codecs="vp8, vorbis"');
return has("video") && canPlayType('video/webm; codecs="vp8, vorbis"');
});

})(has, has.add, has.cssprop);

0 comments on commit 0e47a22

Please sign in to comment.