Skip to content
This repository has been archived by the owner on Jan 8, 2021. It is now read-only.

Commit

Permalink
Enable HLS support on Android 4.x.x
Browse files Browse the repository at this point in the history
  • Loading branch information
phuongdh committed Feb 27, 2014
1 parent 49a0b0c commit 999f8e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/js/me-featuredetection.js
Expand Up @@ -15,6 +15,7 @@ mejs.MediaFeatures = {
t.isiPhone = (ua.match(/iphone/i) !== null);
t.isiOS = t.isiPhone || t.isiPad;
t.isAndroid = (ua.match(/android/i) !== null);
t.isAndroid4 = (ua.match(/android 4/i) !== null);
t.isBustedAndroid = (ua.match(/android 2\.[12]/) !== null);
t.isBustedNativeHTTPS = (location.protocol === 'https:' && (ua.match(/android [12]\./) !== null || ua.match(/macintosh.* version.* safari/) !== null));
t.isIE = (nav.appName.toLowerCase().match(/trident/gi) !== null) | (nav.appName.toLowerCase().indexOf("microsoft") != -1);
Expand Down
4 changes: 3 additions & 1 deletion src/js/me-shim.js
Expand Up @@ -285,7 +285,9 @@ mejs.HtmlMediaElementShim = {
// normal check
if (htmlMediaElement.canPlayType(mediaFiles[i].type).replace(/no/, '') !== ''
// special case for Mac/Safari 5.0.3 which answers '' to canPlayType('audio/mp3') but 'maybe' to canPlayType('audio/mpeg')
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== '') {
|| htmlMediaElement.canPlayType(mediaFiles[i].type.replace(/mp3/,'mpeg')).replace(/no/, '') !== ''
// special case for Android 4.x.x, whose canPlayType HLS usually return ''
|| (mejs.MediaFeatures.isAndroid4 && mediaFiles[i].type.indexOf("vnd.apple.mpegURL")) != -1) {
result.method = 'native';
result.url = mediaFiles[i].url;
break;
Expand Down

0 comments on commit 999f8e3

Please sign in to comment.