Skip to content

Instantly share code, notes, and snippets.

@s9tpepper
Created April 27, 2014 03:33
Show Gist options
  • Save s9tpepper/11337025 to your computer and use it in GitHub Desktop.
Save s9tpepper/11337025 to your computer and use it in GitHub Desktop.
Check for HLS capability HTML5 Video
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