From 0e47a2274073c3261c5be8d216f9496fb93d0810 Mon Sep 17 00:00:00 2001 From: Venkatakrishnan Ganesh Date: Sat, 27 Sep 2014 23:17:03 +0530 Subject: [PATCH 1/2] * Fixes IE9 issue #77 --- detect/video.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/detect/video.js b/detect/video.js index 3b22c18..f6ffb2d 100644 --- a/detect/video.js +++ b/detect/video.js @@ -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"); @@ -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); From cad12962e16f87f53a0ee621dc10feee38f8d660 Mon Sep 17 00:00:00 2001 From: Venkatakrishnan Ganesh Date: Sun, 28 Sep 2014 00:56:37 +0530 Subject: [PATCH 2/2] * Added comments --- detect/video.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/detect/video.js b/detect/video.js index f6ffb2d..054a864 100644 --- a/detect/video.js +++ b/detect/video.js @@ -3,6 +3,9 @@ if(!has("dom")){ return; } var video = document.createElement("video"), + // IE9 is reported to throw errors if "Desktop Experience" is not installed + // have a look at this: + // https://github.com/Modernizr/Modernizr/issues/224 canPlayType = function( type ) { try { return video.canPlayType( type );