1 2 3 Previous Next 92 Replies Latest reply on Mar 17, 2015 2:52 PM by itlancer Branched to a new discussion.

    Using StageVideo and Stage3D in AIR - BETA

    chris.campbell Adobe Employee

      We're planning on introducing a new ActionScript feature that will allow hardware accelerated video to be used as a source texture in a Stage3D environment.  Currently, using video with Stage3D requires the use of the Video object, which is not accelerated, and manipulation of the bitmap representations of the video frames.  The planned feature, called VideoTexture, will allow direct access to a texture object that is sourced from a Netstream or Camera object.

       

      The following sample code demonstrates the use of the VideoTexture object.

       

      1) Create a VideoTexture object and attach a NetStream (or Camera) object to the VideoTexture object:

       

      var ns:NetStream;
      var context3D:Context3D;
      var texture:VideoTexture;
      texture = context3D.createVideoTexture();
      texture.attachNetstream(ns);
      ns.play("video.3gp");
      texture.addEventListener(VideoTexture.RENDER_STATE, renderFrame);
      

       

      2) A texture representation of the current video frame can be retrieved from the callback function for the VideoTexture.RENDER_STATES event.

       

      function renderFrame(e:Event):void
      {
          // Render on stage3D with VideoTexture
      }
      

       

      Please note that this will be an "extended beta" feature.  The initial implementation, available  in our AIR 15 beta, will be for Windows/AIR only.  We are committed to expanding this feature to AIR mobile and Mac in a following release.  We'll also consider an implementation in Flash Player if there is sufficient demand.

       

      Getting your feedback will be critical to making sure we're providing a solution that you can use.  Please let us know what you think and keep an eye out for updated beta release notes in the next couple of weeks.

        1 2 3 Previous Next