你的浏览器禁用了JavaScript, 请开启后刷新浏览器获得更好的体验!
输入关键字进行搜索
搜索:
没有找到相关结果
Laya_XS
赞同来自:
var videoTexture = new Laya.VideoTexture(); var video = videoTexture.video; var m3u8url = "https://xxxx.m3u8"; var hlsxx; var HLS = window["Hls"]; if (HLS && HLS.isSupported()) { var hls = new HLS({ debug: false, }); hls.loadSource(m3u8url); hls.attachMedia(video); hls.on(HLS.Events.MEDIA_ATTACHED, () => { video.muted = true; this.playVideo(); }); hls.on(HLS.Events.ERROR, (event, data) => { console.log("HLS加载失败"); }); hlsxx = hls;//方便销毁用hlsxx.destroy(); }else if(videoTexture.canPlayType("m3u8")){ this.playVideo(); videoTexture.element.pause(); videoTexture.element.src = m3u8url; videoTexture.element.load(); videoTexture["_video"] = videoTexture.element; } function playVideo(){ //这里就做一些video的参数设置,比如静音、循环、播放等设置即可 //video.muted = this._muted; //video.loop = this._loop; //video.onended = this._onended; //video.onclose = this._onclose; //videoTexture.play(); }
要回复问题请先登录
1 个回复
Laya_XS
赞同来自: