[]仿照laya官方demo做了一个视频播放的UI,为啥在微信里不能用?

仿照官方demo  https://layaair.ldc.layabox.com/demo/?category=2d&group=DOM&name=Video 写一个视频播放的页面。在chrome和模拟器里测试正常,但在微信开发者工具里不行,不知道啥原因,哪位高人知识咋回事?代码如下:
 
/**Created by the LayaAirIDE*/
module view {
export class Guide extends ui.GuideUI {

constructor() {
super();

// 创建Video元素
let videoElmt: any = Laya.Browser.createElement("video");
Laya.Browser.document.body.appendChild(videoElmt);

// 设置Video元素地样式和属性
videoElmt.style.zInddex = Laya.Render.canvas.style.zIndex + 1;
videoElmt.src = getResURI("video/guide.mp4");
videoElmt.controls = false;
videoElmt.autoplay = true;
videoElmt.loop = "loop";
// 阻止IOS视频全屏
videoElmt.setAttribute("webkit-playsinline", true);
videoElmt.setAttribute("playsinline", true);

// 设置画布上的对齐参照物
let reference: Laya.Sprite = new Laya.Sprite();
Laya.stage.addChild(reference);
reference.pos(0, 0);
reference.size(Laya.stage.width, Laya.stage.height);
reference.graphics.drawRect(0, 0, reference.width, reference.height, "#CCCCCC");


let tipElmt = Laya.Browser.createElement("img");
tipElmt.src = getResURI("ui/guide_tip.png");
tipElmt.style.zInddex = Laya.Render.canvas.style.zIndex + 2;
Laya.Browser.document.body.appendChild(tipElmt);


function fitDOM() {
Laya.Utils.fitDOMElementInArea(videoElmt, reference, 0, 0, reference.width, reference.height);
Laya.Utils.fitDOMElementInArea(tipElmt, reference, 0, 0, Laya.stage.width, Laya.stage.height);
}

fitDOM();

// 每次舞台尺寸变更时,都会调用Utils.fitDOMElementInArea设置Video的位置,对齐的位置和refence重合
Laya.stage.on(Laya.Event.RESIZE, this, fitDOM);

let viewIns = this;
function goGameWorld() {

videoElmt.pause();
Laya.stage.removeChild(reference);
Laya.Browser.removeElement(videoElmt);
// Laya.Browser.document.body.removeChild(videoElmt);
Laya.Browser.removeElement(tipElmt);
// Laya.Browser.document.body.removeChild(tipElmt);

viewIns.removeSelf();
Laya.stage.addChild(new GameWorld());
}


videoElmt.onclick = goGameWorld;
tipElmt.onclick = goGameWorld;
}
}
}
已邀请:

Aar0n

赞同来自:

微信小游戏不是浏览器,不支持这些的。

该问题目前已经被锁定, 无法添加新回复

商务合作
商务合作