admin-vben5/apps/web-antd/src/utils/video.ts

22 lines
607 B
TypeScript
Raw Normal View History

/**
* h265
*/
export function checkHEVCSupport() {
const video = document.createElement('video');
const h265Support = {
hevc: false,
hvc1: false,
};
// 测试不同的HEVC MIME类型
if (video.canPlayType) {
h265Support.hevc =
video.canPlayType('video/mp4; codecs="hev1.1.6.L93.B0"') !== '';
h265Support.hvc1 =
video.canPlayType('video/mp4; codecs="hvc1.1.6.L93.B0"') !== '';
}
const result = h265Support.hevc || h265Support.hvc1;
console.log('当前浏览器是否支持h265:' + result);
return result;
}