Away3D VideoTexture or WebGL Video


#1

I have an application using Away3D and therefore have been outputting as webgl for html5.

Unfortunately we also need to incorporate some video, not good at the best of times under openfl.

I tried the normal html5 video process, including testing the openfl samples, but that only seems to work if output as canvas, when outputting to WebGL it errors…

Error: WebGL warning: texParameter: No texture is bound to this target

So I have now been trying a VideoTexture on a 3D Plane in Away3D, which does work, but the performance isn’t great…

    vt = new VideoTexture("assets/video/video.mp4", 1024, 1024, false, true);
    var tm:TextureMaterial = new TextureMaterial(vt);

    var planeGeom:PlaneGeometry = new PlaneGeometry(1280, 720, 1, 1, false);//same ratio as flv
    var planeMesh:Mesh = new Mesh(planeGeom, tm);
    scene.addChild(planeMesh);

    vt.autoUpdate = true;
    vt.player.play();

I have this placed in a View3D scene with a camera, is there a better way that might improve performance, maybe rendering the video as a background of the view?

At the moment I am performing a view render onEnterFrame, which maybe part of the issue between video frame rate and html5 60fps framerate…

stage3DProxy.clear();
view.render();
stage3DProxy.present();

However from what I can see the ability to dispatch an event on the next frame being ready via Event.TEXTURE_READY…

vt.addEventListener(Event.TEXTURE_READY, renderFrame);

Is a flash event that doesn’t seem to exist for html5, so feedback seems to be limited to the vt.player state, which are a bit limited.

Hopefully I’m missing something obvious, but any clue would be appreciated, or a better working WebGL video process would be even better.

Thanks


#2

We don’t implement TEXTURE_READY right now, we may not even be able to know in HTML5 whether the video texture has updated or not. I’d love to see improvements in this area if we can.

We should support transparent stages, for allowing content behind, I don’t know if that conflicts with Away3D’s renderer at all.

The next release of OpenFL will support present() properly for not flipping buffers as often, but currently in the current release, it occurs every requestAnimationFrame


#3

OK, sounds promising.

Is there any way that video on webgl html5 should be working now, I seem to remember seeing it referred to in older release notes for openfl, but I’m experiencing the issues indicated above?

Thanks