/* USER DATA */
const videoLink = 'https://threejs.org/examples/textures/sintel.mp4';
const videoVolume = 1;
/* END OF USER DATA */
/* Scene Logic */
let video, videoPromise, videoTexture, videoMaterial;
function init(
json,
init_callbacks
) {
videoPromise = init_callbacks
.loadVideo(videoLink,{
autoplay: true,
loop: true,
})
.then((v) => {
video = v;
video.volume = videoVolume;
videoTexture = new THREE.VideoTexture(video.target);
videoMaterial = new THREE.MeshBasicMaterial({map: videoTexture});
this.material = videoMaterial;
})
;
}
function mywebar_fill_init_promises(init_promises) {
init_promises.push(videoPromise);
}
function mywebar_fill_medias(medias) {
medias.push(video);
}
/**
* Start/resume playing scene
*/
function start() {
video.play();
}
/**
* End/pause playing scene
*/
function stop() {
video.pause();
}
/**
* Unload event, free up memory
*/
function mywebar_destroy() {
video.destroy();
videoTexture.dispose();
}