I am trying to get the fron camera to work, but I am not sure exactly how I am supposed to use the "getCamera" method...I used a slightly modified version of Raff's code that he posted, some of the project specific code was removed... Also, I am creating a tabbed program, however whenever I switch tabs it attemps to relogin and the streem is interrupted.
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:collaboration="com.adobe.rtc.collaboration.*"
xmlns:authentication="com.adobe.rtc.authentication.*"
xmlns:rtc="http://ns.adobe.com/rtc"
xmlns:s="library://ns.adobe.com/flex/spark" title="test2" viewActivate="init()">
<fx:Declarations>
<collaboration:WebcamPublisher id="webcamPub" connectSession="{sess}"/>
<collaboration:WebcamSubscriber id="webcamSub" connectSession="{sess}" webcamPublisher="{webcamPub}"/>
<collaboration:AudioPublisher id="audioPub" connectSession="{sess}"/>
<collaboration:AudioSubscriber id="audioSub" connectSession="{sess}"/>
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.adobe.rtc.authentication.AdobeHSAuthenticator;
import com.adobe.rtc.clientManagers.MicrophoneManager;
import com.adobe.rtc.events.AuthenticationEvent;
import com.adobe.rtc.events.CollectionNodeEvent;
import com.adobe.rtc.events.ConnectSessionEvent;
import com.adobe.rtc.events.SessionEvent;
import com.adobe.rtc.events.SharedPropertyEvent;
import com.adobe.rtc.events.StreamEvent;
import com.adobe.rtc.messaging.UserRoles;
import com.adobe.rtc.session.ConnectSession;
import com.adobe.rtc.sharedManagers.descriptors.StreamDescriptor;
import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;
import com.adobe.rtc.sharedModel.SharedProperty;
import mx.core.IFlexDisplayObject;
[Bindable]
protected var sess:ConnectSession;
[Bindable]
private var auth:AdobeHSAuthenticator;
private function init():void
{
if(sess==null){
auth = new AdobeHSAuthenticator();
sess = new ConnectSession();
sess.authenticator = auth;
auth.userName="";
auth.password="";
auth.protocol = "rtmfp";
sess.roomURL="https://connectnow.acrobat.com/foobar/footest";
sess.authenticator=auth;
sess.addEventListener(SessionEvent.ERROR, onEventNotification);
sess.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onEventNotification);
auth.addEventListener(AuthenticationEvent.AUTHENTICATION_FAILURE, onEventNotification);
auth.addEventListener(AuthenticationEvent.AUTHENTICATION_SUCCESS, onEventNotification);
Camera.getCamera("1");
}
if(!sess.isSynchronized) {
sess.login();
}
}
/**
* Process Events
*/
private function onEventNotification(p_event:Event):void
{
if (p_event.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
if (sess.isSynchronized) {
webcamSub.subscribe();
webcamPub.publish();
audioSub.subscribe();
audioPub.publish();
camera.addChild(webcamSub);
webcamSub.width = camera.width;
webcamSub.height = camera.height;
if ( sess.userManager.myUserRole == UserRoles.OWNER ) {
sess.roomManager.autoPromote = true ;
}
}
}
}
]]>
</fx:Script>
<s:Group width="100%" height="100%" id="group">
<s:SpriteVisualElement id="camera" x="0" y="0" width="100%" height="50%"/>
</s:Group>
</s:View>
Solved! Go to Solution.
Camera.names returns the list of Camera names. If you have a front facing camera one of those names will be something like "Front Facing" (dont' remember the exact name).
So, in order to pick a camera, you scane the list of names for the name you want and remember the ID, then you call Camera.getCamera with STRING value for the id ("0" for 0 and "1" for 1). Very weird, but this is how it works today (I think all this is to allow you to call Camera.getCamera() and get the default camera (id=null).
For LCCS you need to set the camera name index in WebCamPublisher:
var webCamPub:WebCamPublisher;
...
webCamPub.cameraNameIndex = "1"; // or whatever index you need, as STRING
Regarding the stream getting interrupted, I think the problem is that yo ucreate the ConnectSession in the view, and probably something "bad" happen when you switch view. I am also following a recent thread in the "Flex & Flash Builder Forums" (look for "RE: Persistant netConnection Between views?" that I am wondering if it may be related.
I would start moving the management of the connect session outside the view, into either the main application code or a shared ActionScript module.
If you application has a single view, FlashBuilder 4.5.1 now allow to build an application no views. I have tested this and it works fine.
If you still have a problem, then it could be related to the view activation code breaking something but I suspect you'll need to bring it up with the FlashPlayer or Flex runtime team.
Views
Replies
Total Likes
Camera.names returns the list of Camera names. If you have a front facing camera one of those names will be something like "Front Facing" (dont' remember the exact name).
So, in order to pick a camera, you scane the list of names for the name you want and remember the ID, then you call Camera.getCamera with STRING value for the id ("0" for 0 and "1" for 1). Very weird, but this is how it works today (I think all this is to allow you to call Camera.getCamera() and get the default camera (id=null).
For LCCS you need to set the camera name index in WebCamPublisher:
var webCamPub:WebCamPublisher;
...
webCamPub.cameraNameIndex = "1"; // or whatever index you need, as STRING
Regarding the stream getting interrupted, I think the problem is that yo ucreate the ConnectSession in the view, and probably something "bad" happen when you switch view. I am also following a recent thread in the "Flex & Flash Builder Forums" (look for "RE: Persistant netConnection Between views?" that I am wondering if it may be related.
I would start moving the management of the connect session outside the view, into either the main application code or a shared ActionScript module.
If you application has a single view, FlashBuilder 4.5.1 now allow to build an application no views. I have tested this and it works fine.
If you still have a problem, then it could be related to the view activation code breaking something but I suspect you'll need to bring it up with the FlashPlayer or Flex runtime team.
Views
Replies
Total Likes
For iPhone, use:
webcamPub.cameraNameIndex="1"; // for front camera
webcamPub.cameraNameIndex="0"; // for back camera
Also, see my other post in the thread "Re: Video with 4.5.1 on iOS". I don't think the stream gets interrupted but when views get deactivated the webcam subscriber seems to unsubscribe.
Views
Replies
Total Likes
Thanks, I will put all the connection code into the main app and see what happens... thanks for the response, and I got the camera working without any problems... however I noticed that it was turned 90 degrees to left. I am not sure why that is? The Webpublisher view seems to only stay in landscape mode on the iPad 2.
Views
Replies
Total Likes
I'm seeing the issue with the camera publisher on Android too. We'll work on
fixing it as part of the Spark/mobile work.
Views
Replies
Total Likes
Regarding the camera orientation, it seems to be Flash player issue, as it was implemented camera default in landscape (why?). If you could post some code to "re-orient" (i.e. turn the video if iOS), that would be great, even before the Spark/mobile packages are available, as we've already tooled some LCCS components for mobile, but, are only having problems with rotating the video feeds on iOS.
Thanks,
David
Views
Replies
Total Likes
Yep, as soon as I have a chance to look into it, I'll see if I can come up
with a workaround.
On further investigation, it appears this is a runtime issue. I'll try to
chase down with that team what the plans to deal with it are. If necessary,
we'll let you know some workaround strategies and how we're planning on
dealing with it.
Views
Replies
Total Likes
Hello,
So has this issue is resolved in latest release or not?
Right now I am using AIR sdk 3.1
and running application on iPad as a portrait mode (<aspectRatio>portrait</aspectRatio>).
but still when I am attaching camera (i.e. Camera.getCamera());
still it opens at 90 degree left side tild !?
And I am not able to solve this after so many r&d even.
So pleae flash me some hint.
Views
Replies
Total Likes
You should bring this up with on the FlashPlayer / AIR forums. This is how they implemented support for front facing camera (don't ask me why) and I don't know if there are plan to change that.
Of course you can rotate the camera component, but you'll need to do that both on the transmitting side (webcam publisher) and the receiving side (webcam subscriber) and possibly have a shared property that tells all clients what orientation to use.
Ok thanks for the reply.
Views
Replies
Total Likes