Created
April 27, 2014 03:33
-
-
Save s9tpepper/11337025 to your computer and use it in GitHub Desktop.
Check for HLS capability HTML5 Video
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isHLSCapable() { | |
var video = document.createElement("video"); | |
var mimeTypes = ["application/x-mpegURL", "application/mpegURL", "application/vnd.apple.mpegURL"]; | |
var capable = []; | |
mimeTypes.forEach(function (mimeType) { | |
capable.push(video.canPlayType(mimeType)); | |
}); | |
return capable.indexOf("maybe") > -1; | |
} | |
console.log("isHLSCapable():", isHLSCapable()); // Outputs true in HLS capable browsers (Safari, Safari Mobile for now) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment