// 创建视频纹理
const videoTexture = new VideoTexture();
await videoTexture.load("https://cdn.orillusion.com/videos/bunny.mp4");
// 创建视频材质
const mat = new VideoMaterial();
mat.baseMap = videoTexture;
mat.debug();
// 创建2D平面
const planeObj = new Object3D();
const mr = planeObj.addComponent(MeshRenderer);
mr.geometry = new PlaneGeometry(20, 11, 20, 11, Vector3.Z_AXIS);
mr.material = mat;
mr.onBeforeUpdate(() => {
videoTexture.media.pause();
videoTexture.media.play();
})
scene.addChild(planeObj);
在做上面的改造后,video 会变的很丝滑