UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

21 lines (20 loc) 717 B
"use strict"; import { Texture, VideoTexture, CanvasTexture } from "three"; import { isHTMLVideoElementLoaded, isHTMLVideoPaused } from "../DomUtils"; export function computerVisionValidSource(texture) { if (texture instanceof VideoTexture) { if (texture.image instanceof HTMLVideoElement) { if (isHTMLVideoElementLoaded(texture.image) && !isHTMLVideoPaused(texture.image)) { return texture.image; } } } else if (texture instanceof CanvasTexture) { if (texture.source.data instanceof HTMLCanvasElement) { return texture.source.data; } } else if (texture instanceof Texture) { if (texture.image instanceof HTMLImageElement) { return texture.image; } } }