Last active
August 3, 2017 09:54
-
-
Save xxzefgh/c700ed16863c201ced1a2cb34933211f to your computer and use it in GitHub Desktop.
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
const vp9CodecType = 'video/webm; codecs="vp9"' | |
function checkMediaSourceWay() { | |
return 'MediaSource' in window && MediaSource.isTypeSupported(vp9CodecType) | |
} | |
function checkHTMLMediaElementWay() { | |
return document.createElement('video').canPlayType(vp9CodecType) === 'probably' | |
} | |
export function canPlayVP9() { | |
return checkMediaSourceWay() || checkHTMLMediaElementWay() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment