Mercurial > hg > env-test-daniele
comparison johndyer-mediaelement-13fa20a/src/js/me-featuredetection.js @ 0:032bc65ebafc
added core components
author | George Fazekas <gyorgy.fazekas@eecs.qmul.ac.uk> |
---|---|
date | Wed, 06 Mar 2013 15:45:48 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:032bc65ebafc |
---|---|
1 // necessary detection (fixes for <IE9) | |
2 mejs.MediaFeatures = { | |
3 init: function() { | |
4 var | |
5 nav = mejs.PluginDetector.nav, | |
6 ua = mejs.PluginDetector.ua.toLowerCase(), | |
7 i, | |
8 v, | |
9 html5Elements = ['source','track','audio','video']; | |
10 | |
11 // detect browsers (only the ones that have some kind of quirk we need to work around) | |
12 this.isiPad = (ua.match(/ipad/i) !== null); | |
13 this.isiPhone = (ua.match(/iphone/i) !== null); | |
14 this.isAndroid = (ua.match(/android/i) !== null); | |
15 this.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null); | |
16 this.isIE = (nav.appName.toLowerCase().indexOf("microsoft") != -1); | |
17 this.isChrome = (ua.match(/chrome/gi) !== null); | |
18 this.isFirefox = (ua.match(/firefox/gi) !== null); | |
19 | |
20 // create HTML5 media elements for IE before 9, get a <video> element for fullscreen detection | |
21 for (i=0; i<html5Elements.length; i++) { | |
22 v = document.createElement(html5Elements[i]); | |
23 } | |
24 | |
25 this.supportsMediaTag = (typeof v.canPlayType !== 'undefined' || this.isBustedAndroid); | |
26 | |
27 // detect native JavaScript fullscreen (Safari only, Chrome fails) | |
28 this.hasNativeFullScreen = (typeof v.webkitRequestFullScreen !== 'undefined'); | |
29 if (this.isChrome) { | |
30 this.hasNativeFullScreen = false; | |
31 } | |
32 // OS X 10.5 can't do this even if it says it can :( | |
33 if (this.hasNativeFullScreen && ua.match(/mac os x 10_5/i)) { | |
34 this.hasNativeFullScreen = false; | |
35 } | |
36 } | |
37 }; | |
38 mejs.MediaFeatures.init(); |