Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Whilst we wait for the iOS and Android solutions for Stage3D video you could look at using a video ANE. Distriqt have a dual platform solution which is very stable.
Media Player @ distriqt // air native extensions
Copy link to clipboard
Copied
Yes I had seen that and was thinking about using it - trouble is I'm starting to feel like having too many dependencies in a project is a bad thing - it is just one more thing that can break / get out of date / requires an update when Apple make a change.
Copy link to clipboard
Copied
Distriqt are very active and if you have a problem with one of their ANEs they will hear you 🙂
For your problems with the black screen, I don't know if it's linked but there's a huge bug in Air when you want to decode H.264 videos while using the Stage3D (either for 2D elements like Starling or for 3D like Away3D). Here's the bug report : https://bugbase.adobe.com/index.cfm?event=bug&id=3626740
That's very frustrating that Adobe decided to skip it and that's why I hope so much that VideoTexture will be a convenient replacement, and not too late 🙂
Copy link to clipboard
Copied
It's strange, VideoTexture is not supported on a Levovo Yoga Pro 2 windows 8.1, Adobe Air 16 ?
Context3D.supportsVideoTexture return false
Copy link to clipboard
Copied
I am having the same issues as well.
I have yet to see a Context3D.supportsVideoTexture return true.
Copy link to clipboard
Copied
Added a bug here with more details:
Copy link to clipboard
Copied
Hi C D,
The bug#3935044 is not reproducible at our end.
I am sharing you the sample flash builder project. Dropbox - SupportVideoTexture.zip
Please try with latest AIR Beta 17.0.0.96.
Please let me know if you still face any issue.
Thanks
Copy link to clipboard
Copied
‌Confirmed. Bug 3935044 is fixed in 17 beta.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Video and camera support for Stage3D won't be able to meet your requirement.
Copy link to clipboard
Copied
Any update on the availability of the VideoTexture for iOS ? 🙂
Copy link to clipboard
Copied
with Air 17 beta, VideoTexture work.
Copy link to clipboard
Copied
Yes, this should be working again in yesterday's v17 beta. Give it a try and let us know if you run into problems!
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi Alex,
The bug#3824231 is not reproducible with AIR 17.0.0.96 Beta. I followed the below step.
1) Launch the App.
2) Click on Stage.
The application is not getting crash.
Please let me know if i am missing something here.
Thanks
Copy link to clipboard
Copied
I'm sorry, you are right. This bug was fixed. No more crashes.
I modify application and encounter this bug: Bug#3779843 - StageVideo + NetStream + Starling = R6025 Error
But it's not about VideoTexture. VideoTexture works fine!
Thanks.
Copy link to clipboard
Copied
I have found one more problem with VideoTexture: Bug#3936107 - [Windows] Hardware accelerated video displaying by VideoTexture don't render after see...
VideoTexture don't render after seeking video if video hardware accelerated.
It works fine with earlier beta versions (AIR 15.0.0.258 beta). Also it works fine for FLV videos (because it's not hardware accelerated). You can handle VideoTextureEvent.RENDER_STATE event to check render state (accelerated or software).
Workaround:
Disable hardware video decoding:
netStream.useHardwareDecoder = false;
Earlier issues still exists:
Bug#3824236 - [Windows] VideoTexture green color blink before playback
Bug#3824242 - [Windows] VideoTexture black color blink after playback
You can workaround it by also disabling hardware video decoding or by updating scene only at Event.TEXTURE_READY event.
Also AIR 17.0.0.96 beta applications usually crashes after application closing. But it noticed at beta release notes so I think you fix it ASAP.
Thanks.
Copy link to clipboard
Copied
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.