Skip to content

Instantly share code, notes, and snippets.

@4rn0
Created November 30, 2012 09:30
Show Gist options
  • Save 4rn0/4174742 to your computer and use it in GitHub Desktop.
Save 4rn0/4174742 to your computer and use it in GitHub Desktop.
Modernizr HTTP Live Streaming test
Modernizr.addTest('hls', function() {
var a = navigator.userAgent,
b = document.createElement('video');
if (a.match(/iPhone|iPod|iPad/)) {
return true
}
try {
return b && b.canPlayType && !! b.canPlayType('application/x-mpegURL; codecs="avc1.42E01E, mp4a.40.2"')
}
catch(c) {
return false
}
});
@allensarkisyan
Copy link

heres a pattern for matching iOS devices.

/ip(?:hone|[a|o]d)/gi.test(a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment