stackgl / gl-texture2d

WebGL texture wrapper
http://stack.gl/gl-texture2d/
MIT License
59 stars 10 forks source link

HTML5 video #17

Open galipmedia opened 4 years ago

galipmedia commented 4 years ago

Is it possible to have a texture that is a playing video? I am trying to use this as part of gl-transitions and i can render 2 videos via a texture but it only grabs the first frame of each. I am waiting for the on play event etc. What am i missing?

mohsenheydari commented 9 months ago

I know its an old thread but this might be helpful to someone. I recently encountered the same issue. Here is what I did: update the textures in your render loop.

const loop = (t) => {
    requestAnimationFrame(loop);

    from.setPixels(videoFrom);
    to.setPixels(videoTo);

    transition.draw((t/3000)%1, from, to, canvas.width, canvas.height, { persp: 1.5, unzoom: 0.6 });
}
requestAnimationFrame(loop);