标签:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>用JavaScript检测视频格式支持</title>
<script type="text/javascript">
function checkVideo() {
var myVideo = document.createElement(‘video‘);
if (myVideo.canPlayType) {
if ("" != myVideo.canPlayType(‘video/mp4;codecs="avc1.64001E"‘)) {
document.write("您的浏览器支持h264编码。<br>");
}
if ("" != myVideo.canPlayType(‘video/ogg; codecs="vp8"‘)) {
document.write("您的浏览器支持vp8编码。<br>");
}
if ("" != myVideo.canPlayType(‘video/ogg; codecs="theora"‘)) {
document.write("您的浏览器支持theora编码。");
}
}
else {
document.write("您的浏览器不支持要检测的视频格式。");
}
}
window.onload = function () {
checkVideo();
}
</script>
</head>
<body>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/zhourourou/p/5210740.html