Skip to main content
chris.campbell
Legend
Aug 6, 2014 1:15 AM UTC
Question

Using StageVideo and Stage3D in AIR - BETA

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 is closed to new replies. Start a new post to keep the conversation going.

92 replies

itlancer
Inspiring
Mar 17, 2015 9:52 PM UTC

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.

Translate
Inspiring
Feb 5, 2015 10:53 PM UTC

with Air 17 beta, VideoTexture work.

Translate
chris.campbell
Legend
Feb 5, 2015 11:46 PM UTC

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

Translate
itlancer
Inspiring
Feb 6, 2015 6:57 AM UTC

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.

Translate
Inspiring
Jan 7, 2015 12:20 PM UTC

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

Translate
Known Participant
Dec 9, 2014 11:39 AM UTC

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.

Translate
Chandra Prakash
Participant
Dec 9, 2014 2:18 PM UTC

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

Translate
Participating Frequently
Dec 1, 2014 3:36 PM UTC

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?.

Translate
chris.campbell
Legend
Dec 1, 2014 6:25 PM UTC

Hi Lea,

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

Chris

Translate
Leafcutter
Inspiring
Jan 14, 2015 4:26 PM UTC

Chris - any update on an ETA for iOS?

Translate
Leafcutter
Inspiring
Nov 25, 2014 6:33 PM UTC

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?

Translate
natural_criticB837
Legend
Nov 26, 2014 11:11 AM UTC

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?

Translate
Leafcutter
Inspiring
Nov 26, 2014 12:31 PM UTC

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.

Translate
Participant
Nov 6, 2014 10:11 AM UTC

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?

Translate
itlancer
Inspiring
Nov 6, 2014 10:21 AM UTC

Hi.

After configuring Context3D buffer write this line:

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

Translate
Participant
Nov 6, 2014 1:55 PM UTC

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!

Translate
Participant
Oct 15, 2014 12:22 AM UTC

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?

Translate
Participant
Oct 17, 2014 11:42 PM UTC

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

Thanks Chris and Dev Team

Translate
Participant
Oct 8, 2014 8:28 AM UTC

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.

Translate
Participant
Sep 15, 2014 7:57 PM UTC

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

Translate