Skip to main content
chris.campbell
Community Manager
Community Manager
August 6, 2014
Question

Using StageVideo and Stage3D in AIR - BETA

  • August 6, 2014
  • 35 replies
  • 25756 views

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.

This topic has been closed for replies.

35 replies

itlancer
Inspiring
March 17, 2015

Here is the feature request: Feature#3954805 - [New_Feature_Requirement] VideoTexture FLV videos with alpha channel support

VideoTexture feature is great! But I'd like to ask to think about FLV videos with alpha channel support by VideoTexture.

Now if you try to playback FLV video with alpha channel you will see black opaque video background. With alpha channel support developers can create awesome effects. Please consider this feature to implementation.

I'd like to ask everyone who interested in it to take a minute and vote for implementing this feature.

Thanks.

Inspiring
February 5, 2015

with Air 17 beta, VideoTexture work.

chris.campbell
Community Manager
Community Manager
February 5, 2015

Yes, this should be working again in yesterday's v17 beta.  Give it a try and let us know if you run into problems!

itlancer
Inspiring
February 6, 2015

Hi, Chris.

This bug was closed as "Fixed": Bug#3824231 - [Windows] Closing NetStream attached to VideoTexture causes crash

But it still exists and application crashes with AIR 16.0.0.272 and AIR 17.0.0.96 beta.

Inspiring
January 7, 2015

Any update on the availability of the VideoTexture for iOS ? :-)

Known Participant
December 9, 2014

Hi Chris, I've been following this thread and I'm slowly getting hopeful the feature will actually appear to Android and iOS! Unfortunately we're not using Stage3D, but GPU renderMode and Bitmap objects. The performance is just fine, so there's no point in rewriting everything for Stage3D. If we had to do that, we'd probably just switch to Unity3D instead.

You must be doing some fundamental groundwork at Adobe to make this feature possible? Does that groundwork also make it possible to use h.264 with plain old Video objects, that would be accelerated in similar way than Bitmaps are? Please consider it. I think the power of Flash/AIR relies not on Stage3D, but with mixing timeline animations and pure AS3 into more-than-well-enough functioning result.

Chandra Prakash
Participant
December 9, 2014

Video and camera support for Stage3D won't be able to meet your requirement.

Participating Frequently
December 1, 2014

Chris, great job, it is indeed one of the most needed features that the Air scene needs right now.

Any updates on expanding it to mobile too?.

chris.campbell
Community Manager
Community Manager
December 1, 2014

Hi Lea,

Look for an iOS beta hopefully a little later this month!

Chris

Leafcutter
Inspiring
January 14, 2015

Chris - any update on an ETA for iOS?

Leafcutter
Inspiring
November 25, 2014

I realise I'm a bit late on this but being able to mix video and stage3d (starling) on iOS (which is what I understand this might ultimately provide) would be great.  I have a lot of stage video based apps where I have struggled to create a smooth enough UI experience using standard AIR graphics.  Being able to mix a video stream with a starling UI would be perfect.

Can you just get it released for iOS now please?

natural_criticB837
Legend
November 26, 2014

Not a lot of video experience here, but should you not be able to use StageVideo in the back with Starling UI on top? Or is StageVideo not yet supported for mobile?

Leafcutter
Inspiring
November 26, 2014

I did get a small starling window working on top of a stagevideo on mobile.  The problem (apart from it taking a very long time for me to work through which settings were needed and which callbacks had to be implemented) was that the starling content couldn't surround the video.  The starling layer fully obscures any stagevideo it overlaps.

So if the starling is full screen then the video is hidden.  If the starling is a clipped rectangle then it can sit on top of the video, but you couldn't have a starling title bar above, list next to and content to the right of the video window.  You could effectively only have a starling view in a rectangle sitting on top of the video, when in fact I needed a stageVideo rectangle sitting on top of the starling (if that makes sense).  I wanted to produce something like the following screenshot but with a starling UI.

screen480x480.jpeg

If we can paint video onto a texture and then sit that in the starling display list that will be perfect.

Participant
November 6, 2014

Hi

I build demo with VideoTexture, its looks very perspectively.
But what about support alpha channel?
When I use FLV with alpha channel - all alpha "pixels" has black color

In this document says about YUV->RGB conversion.
Have any more infomation about VideoTexture and alpha channel?

itlancer
Inspiring
November 6, 2014

Hi.

After configuring Context3D buffer write this line:

context3D.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ONE);

Participant
November 6, 2014

I added code with setBlendFactors, but nothing happened.

private function contextCreatedHandler(event : Event) : void {

    Starling.context.setBlendFactors(Context3DBlendFactor.ONE, Context3DBlendFactor.ONE);

}

I use Starling, maybe problem in code which used Starling classes ConcreteTexture or Image

var context : Context3D = Starling.context;

var vTexture : VideoTexture = context.createVideoTexture();

vTexture.attachNetStream(vbController.netStream);

var cTexture : ConcreteTexture = new ConcreteTexture(vTexture, Context3DTextureFormat.BGRA, 1600, 878, false, true, true);

var image : Image = new Image(cTexture);

addChild(image);

Using Windows and AIR SDK beta 15.0.0.349

Thanks!

Participant
October 15, 2014

context3D.createVideoTexture() always return null, and Context3D.supportsVideoTexture is always false.. On Win AIR release 15.0.0.302 (and in the beta)..

Many people with the same problem... why?

Participant
October 17, 2014

Yes! The update today with now AIR 15.0.0.328 fixes this problem and it now works great

Thanks Chris and Dev Team

Participant
October 8, 2014

This looks good.  What are the limitations of the video texture?  Can I use it like a regular texture for objects?  Can AGAL shaders be used on VideoTextures?  This feature could open several possibilities if implemented correctly.

Participant
September 15, 2014

I've been trying to get support for this feature for many years now. Please integrate this into mac and mobile app.
Great News!

Best Regards,

Sascha Weißbach