I have a video file which I play in an Android air app. I'm trying to capture a frame using bitmapData.Draw(video)
, but it works only for .flv video.
The videos are played locally - no internet or server.
Once I change the video to an .mp4, it plays it on stage, but has a blank bitmapData after the draw function is called. I doesn't say any error.
How can I capture a frame from the played .mp4 video?
Note -
It's a Video component, not a StageVideo
, since I know it's impossible with StageVideo
.
The net stream initialization. I also added the checkPolicyFile = true
- it didn't help.
my_nc.connect(null);
my_nc.client = this;
_ns = new NetStream(my_nc);
_ns.client = this;
_ns.useHardwareDecoder = true;
_ns.checkPolicyFile = true;
UPD: It seems there isn't way to draw h.264 video in bitmap on android devices by ActionScript. I tested this demo(sources) with this h.264 encoded video file (It's origin) in mp4 container in mobile FlashPlayer 11.1 and in AIR 3.5 application with the same code and both of them have failed. I've got the black rectangle in all render modes (direct, cpu and gpu).
The possible workaround can be to write the native extension making screenshot (I found this one, but it's reported can crash you app, but sources can be helpful) and crop the video by known rectangle. It's not a beautiful solution, but I don't see the other variants for now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With