showWxVideo(remoteUrl: string) {
const windowInfo = window["wx"].getWindowInfo();
const { windowWidth, windowHeight } = windowInfo;
if (this.idleVideo) {
this.idleVideo.stop();
this.idleVideo.offPlay(() => { })
this.idleVideo.offError(() => { })
this.idleVideo.offEnded(() => { })
this.idleVideo.offTimeUpdate(() => { })
this.idleVideo.destroy();
this.idleVideo = null;
}
this.idleVideo = window["wx"].createVideo({
x: 0,
y: 0,
src: remoteUrl,//视频的资源地址
width: windowWidth, //视频的宽度
height: windowHeight,//视频的高度
loop: false,//视频是否循环播放
muted: false,
controls: false,//视频是否显示控件
showProgress: false,//是否显示视频底部进度条
showProgressInControlMode: false,//是否显示控制栏的进度条
autoplay: true,//视频是否自动播放
showCenterPlayBtn: false,//是否显示视频中央的播放按钮
underGameView: true,//视频是否显示在游戏画布之下(配合 Canvas.getContext('webgl', {alpha: true}) 使主屏canvas实现透明效果)
enableProgressGesture: false,//是否开启双击播放的手势
objectFit: "cover",
backgroundColor: "#00000000"
});
this.idleVideo.onError((err) => { });
this.idleVideo.onPlay(() => { });
this.idleVideo.onEnded(() => {});
this.idleVideo.onTimeUpdate((_data) => {
// console.log("视频播放进度:", _data);
// console.log("position:", _data.position);
// console.log("duration:", _data.duration);
});
this.idleVideo.play();
}