html5 h265播放器,PC端播放H265

本文介绍了在PC端(特别是Chrome浏览器)播放H265视频的解决方案,包括使用video.js、hls.js和EasyWasmPlayer库。video.js和hls.js仅支持H264,而EasyWasmPlayer支持H265。文章提供了详细的代码示例和配置教程,特别指出在Tomcat和Nginx环境下部署时的注意事项及问题解决方法。
摘要由CSDN通过智能技术生成

说明

需要在PC端浏览器(Chrome)中播放直播视频,视频格式有H264/H265。有不少三方库可以实现。

通过video.js(支持H264,不支持H265)

videojs-contrib-hls embed

Video.js Example Embed

data-setup='{}'>

参考地址:

通过hls.js(支持H264,不支持H265)

pc play m3u8(hlsjs)

video {

width: 600px;

height: auto;

}

pc play m3u8(hlsjs)

var video = document.getElementById('video');

var videoSrc = 'http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8';

if (Hls.isSupported()) {

var hls = new Hls();

hls.loadSource(videoSrc);

hls.attachMedia(video);

hls.on(Hls.Events.MANIFEST_PARSED, function () {

video.play();

});

}

// hls.js is not supported on platforms that do not have Media Source

// Extensions (MSE) enabled.

//

// When the browser has built-in HLS support (check using `canPlayType`),

// we can provide an HLS manifest (i.e. .m3u8 URL) directly to the video

// element through the `src` property. This is using the built-in support

// of the plain video element, without using hls.js.

//

// Note: it would be more normal to wait on the 'canplay' event below however

// on Safari (where you are most likely to find built-in HLS support) the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值