UNPKG

threepipe

Version:

A modern 3D viewer framework built on top of three.js, written in TypeScript, designed to make creating high-quality, modular, and extensible 3D experiences on the web simple and enjoyable.

31 lines 1.24 kB
import { LinearFilter, Loader, RGBAFormat, SRGBColorSpace, VideoTexture } from 'three'; import { VideoLoader } from './VideoLoader'; export class VideoTextureLoader extends Loader { constructor(manager) { super(manager); } load(url, onLoad, onProgress, onError) { const loader = new VideoLoader(this.manager); loader.setCrossOrigin(this.crossOrigin); loader.setPath(this.path); let videoTexture; // noinspection JSVoidFunctionReturnValueUsed const vid = loader.load(url, function (video) { if (!videoTexture) videoTexture = new VideoTexture(video); videoTexture.format = RGBAFormat; videoTexture.minFilter = LinearFilter; videoTexture.magFilter = LinearFilter; videoTexture.colorSpace = SRGBColorSpace; // todo depends on the video videoTexture.needsUpdate = true; // video.play() if (onLoad !== undefined) { onLoad(videoTexture); } }, onProgress, onError); if (!videoTexture && vid) videoTexture = new VideoTexture(vid); return videoTexture; } } //# sourceMappingURL=VideoTextureLoader.js.map