Expand my Community achievements bar.

SOLVED

Webcam conflict with other apps

Avatar

Level 3

Is there any way for LCCS to check for a webcam conflict with other apps and to display a message to the user?

I see a problem with users quite often where they will only see the top bar of the webcam in their webcam pod. I believe this happens when they have been using another app (most likely skype) and this app has failed to release the webcam properly.

I can reproduce this 100% of the time with the Webcamera sample app if I open yahoo messenger and click on Messenger/My Webcam.

If I then start the WebCamera sample app I see the top bar of the webcam subscriber for my own camera (See Image).

Is there any way to:

a) Detect if the webcam is available before publishing? or

b) Force taking control of the camera from the other application that has not released it?

cam.jpg

Thanks,

Barry

1 Accepted Solution

Avatar

Correct answer by
Employee

hi Barry,

Although there is no fix, there is hack or workaround for this problem.

Test this code and check if it suits your needs. So I have set flag not to display userDisplay bar, and its displayed only when we recieve a stream. Also I instantiate a timer and see if the camera is busy. If its busy then the method detects it and you might have to handle it.

Also I am assuming multiplexing of a single webcamera ie sharing a webcamera across apps is not possible.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                  xmlns:rtc="http://ns.adobe.com/rtc"
                  >
     
     <fx:Script>
          <![CDATA[
               import com.adobe.rtc.events.StreamEvent;
               
               import mx.controls.Alert;
               private var video:Video;
               private var timer:Timer;
               
               protected function cam_clickHandler(event:MouseEvent):void
               {
                    // TODO Auto-generated method stub
                    //var camNames:Array = Camera.names;
                    
                    //for (var i:int = 0; i < camNames.length; i++)
                    //{
                    webCamPub.addEventListener(StreamEvent.STREAM_RECEIVE,onStreamRecieve);
                    webCamPub.publish();
                    //}
               }
               
               protected function onCamActive(p_evt:Event):void
               {
                    timer.stop();
                    timer.removeEventListener(TimerEvent.TIMER,onTimer);
                    webCamSub.displayUserBars = true;
                    trace(p_evt.toString());
               }
               
               protected function onTimer(p_evt:TimerEvent):void
               {
                    Alert.show("Camera is busy");
                    //Set a different camera here
                    //webCamPub.cameraNameIndex = index
               }
               
               protected function onStreamRecieve(p_evt:StreamEvent):void
               {
                    var cam:Camera = webCamPub.camera;
                    cam.addEventListener(ActivityEvent.ACTIVITY,onCamActive);
                    timer = new Timer(2000,1);
                    timer.addEventListener(TimerEvent.TIMER,onTimer);
                    timer.start();
               }
               
          ]]>
     </fx:Script>
     
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <rtc:ConnectSessionContainer roomURL="http://connectnow.acrobat.com/xxx000xxx/xxx000xxx" width="100%" height="100%">
          <rtc:authenticator>
               <rtc:AdobeHSAuthenticator userName="xxx000xxx.com"/>
          </rtc:authenticator>
          
          <mx:Panel id="panel" title="Chat Scroll Example"
                      width="80%" height="80%"
                      horizontalCenter="0" verticalCenter="0">
               <mx:VBox id="grp" width="100%" height="100%">
                    <rtc:WebcamPublisher width="1" height="1" id="webCamPub" />
                    <rtc:WebcamSubscriber width="300" height="300" id="webCamSub" webcamPublisher="{webCamPub}" displayUserBars="false"/>
                    <s:Button id="cam" label="startCam" click="cam_clickHandler(event)" />
               </mx:VBox>     
          </mx:Panel>
     </rtc:ConnectSessionContainer>
</s:Application>

Thanks

Arun

View solution in original post

6 Replies

Avatar

Level 3

Here is a link to a reported Skype bug that I believe is causing users to see this error even when Skype is not using the webcam. It would be nice if there was a way for LCCS to detect that the webcam is not released.

https://jira.skype.com/browse/SCM-721

Avatar

Correct answer by
Employee

hi Barry,

Although there is no fix, there is hack or workaround for this problem.

Test this code and check if it suits your needs. So I have set flag not to display userDisplay bar, and its displayed only when we recieve a stream. Also I instantiate a timer and see if the camera is busy. If its busy then the method detects it and you might have to handle it.

Also I am assuming multiplexing of a single webcamera ie sharing a webcamera across apps is not possible.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  xmlns:s="library://ns.adobe.com/flex/spark"
                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                  xmlns:rtc="http://ns.adobe.com/rtc"
                  >
     
     <fx:Script>
          <![CDATA[
               import com.adobe.rtc.events.StreamEvent;
               
               import mx.controls.Alert;
               private var video:Video;
               private var timer:Timer;
               
               protected function cam_clickHandler(event:MouseEvent):void
               {
                    // TODO Auto-generated method stub
                    //var camNames:Array = Camera.names;
                    
                    //for (var i:int = 0; i < camNames.length; i++)
                    //{
                    webCamPub.addEventListener(StreamEvent.STREAM_RECEIVE,onStreamRecieve);
                    webCamPub.publish();
                    //}
               }
               
               protected function onCamActive(p_evt:Event):void
               {
                    timer.stop();
                    timer.removeEventListener(TimerEvent.TIMER,onTimer);
                    webCamSub.displayUserBars = true;
                    trace(p_evt.toString());
               }
               
               protected function onTimer(p_evt:TimerEvent):void
               {
                    Alert.show("Camera is busy");
                    //Set a different camera here
                    //webCamPub.cameraNameIndex = index
               }
               
               protected function onStreamRecieve(p_evt:StreamEvent):void
               {
                    var cam:Camera = webCamPub.camera;
                    cam.addEventListener(ActivityEvent.ACTIVITY,onCamActive);
                    timer = new Timer(2000,1);
                    timer.addEventListener(TimerEvent.TIMER,onTimer);
                    timer.start();
               }
               
          ]]>
     </fx:Script>
     
     <fx:Declarations>
          <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <rtc:ConnectSessionContainer roomURL="http://connectnow.acrobat.com/xxx000xxx/xxx000xxx" width="100%" height="100%">
          <rtc:authenticator>
               <rtc:AdobeHSAuthenticator userName="xxx000xxx.com"/>
          </rtc:authenticator>
          
          <mx:Panel id="panel" title="Chat Scroll Example"
                      width="80%" height="80%"
                      horizontalCenter="0" verticalCenter="0">
               <mx:VBox id="grp" width="100%" height="100%">
                    <rtc:WebcamPublisher width="1" height="1" id="webCamPub" />
                    <rtc:WebcamSubscriber width="300" height="300" id="webCamSub" webcamPublisher="{webCamPub}" displayUserBars="false"/>
                    <s:Button id="cam" label="startCam" click="cam_clickHandler(event)" />
               </mx:VBox>     
          </mx:Panel>
     </rtc:ConnectSessionContainer>
</s:Application>

Thanks

Arun

Avatar

Level 3

Hi Arun,

Just wanted to check back with you and verify that this bug has been fixed with Skype update 5.0.0.7994. I just tested on the machine that was having the problem.

I'll probably use your fix for now and hopefully there will be something in the API that detects a busy webcam in a future release.

Thanks,

Barry

Avatar

Employee

Arum will be unavailable for a few days but we can have Julian check if the latest version of Skype fixes the problem.

Sent from my iPhone

Avatar

Level 3

Thanks Raff,

Sorry, my answer was a little unclear. I verified that that the latest version of Skype fixes it.

Barry

Avatar

Level 3

Hi Arun,

One other thing I wanted to let you know.

I tried using your but I found that there is a problem with the latest version of IE. After the Adobe dialog box appears and I click ok, the method 'onStreamRecieve' is called, but IE pops up an additional dialog box to confirm permissions. If I allow this dialog box to sit there for a few seconds the timeout is reached and even if the webcam appears I get the "Busy" dialog box.

Do you know of an event I can look for to trap that IE dialog box confirmation?

Attaching screenshot.

cam.png

Thanks,

Barry