Turn RAW CAMERA (not just video) in the air for Android

I am using the preliminary release of Flex Hero 4.5, and this is Flex Mobile app for Android.

I have a situation where an unprocessed camera is displayed on the screen and transmitted in a network stream. Apparently, right now in AIR for Android, if you just use a raw camera in a portrait, it doesn't actually shoot the camera in the portrait ... its 90 degrees in the wrong direction. So, heres a piece of code where I turned the video and it looks great on the phone. however, I need to attach the camera to the network stream and send it ... but it sends side video, and I really don't want to configure it at the far end. and I can’t attach the video to the network stream ... Does anyone have any ideas what I could do and not just wait for the AIR update to do this?

//i know i have width and height mixed up, its because im rotating it in a second and i dont want it to be stretched nearVideo = new Video(near_video.height,near_video.width); var m:Matrix = new Matrix(); //rotate here m.rotate(Math.PI/2); this.nearVideo.transform.matrix = m; //repositioning it so it looks like its fitting in the container correctly nearVideo.x=near_video.width; nearVideo.y=(near_video.height-near_video.height); if (Camera.isSupported) { nearCam = Camera.getCamera(); } nearCam.setMode(near_video.height,near_video.width,10); nearVideo.attachCamera(nearCam); near_video.addChild(nearVideo); //now its all great on screen...but when this comes up sendStream.attachCamera(nearCam); //i'm sending sideways video... 

edit: I know that I can tell the far end just to rotate the video object, using it to display the side camera. but for many reasons this is not the decision I want to make. Hopefully adobe just fix this soon. But until then, they’re just wondering, maybe someone knows how I can turn the camera and attach it to the network stream.

+8
flex actionscript-3 air camera
source share
2 answers

Well, for me, this seems like the only real solution, besides turning the video at the far end, is just to make adobe to fix the camera. So, if you found this page because you were upset that the Android camera couldn’t rotate correctly in the portrait, vote for the error here and give them the opportunity to fix it:

http://bugs.adobe.com/jira/browse/SDK-30317

+2
source share

Unfortunately, you cannot intercept the camera stream in order to change it before sending it to the server, this is a bug that I hope will be fixed in the next version of Air. If for this there is no ticket for him, you should open it.

However, not all is lost! What the camera class does with NetStream, in fact, simply sends the video bytes that you shoot from the camera, and, of course, an algorithm for changing the quality depending on the bandwidth. You can try to do the same on your own, however, the quality change algorithm will be a little more difficult to implement, but not impossible.

Essentially, since you are showing video from a camera somewhere (perhaps the Video class?), You can take bitmap data, convert it to ByteArray, and send it via NetStream using send . Of course, the server (or another client) must know what to do with it.

No guarantees if this would work the way I had never tried, but that is what I would do. Another way to do this is to “tell” the media server (I assume that you are using it) that you are currently in landscape mode (there is just a logical flag) and then the server can do the conversion for you and send it to another person .

In any case, it will not be easy. Good luck.

+1
source share

All Articles