Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Problems with AudioPublisher/Subscriber

Avatar

Former Community Member

Hello,

I use very simple test application (Flex 4.1, Flash 10.1):

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:rtc="http://ns.adobe.com/rtc">

        <rtc:AdobeHSAuthenticator id="auth" userName="myName" password="myPassword" protocol="rtmfp" />

     
    <rtc:RoomSettings id="settings" autoPromote="true" />
       
    <rtc:ConnectSessionContainer id="session" authenticator="{auth}" roomURL="https://collaboration.adobelivecycle.com/myName/myRoom" initialRoomSettings="{settings}" autoLogin="true" left="0" right="0" top="0" bottom="0">
        <mx:VBox width="100%" height="100%" verticalGap="2" paddingBottom="5" paddingTop="5" verticalScrollPolicy="on">
        <rtc:WebCamera width="1200" height="600" />
        <rtc:SimpleChat  x="0" y="600" width="1200"/>
        <rtc:AudioPublisher id="audioPub" height="0" useEchoSuppression="true" gain="50" />
        <rtc:AudioSubscriber id="audioSub" height="0" />
        <mx:Button label="AudioButt" toggle="true" id="audioButt" color="#000000"
                   click="(audioButt.selected) ? audioPub.publish() : audioPub.stop()"/>
        </mx:VBox>
    </rtc:ConnectSessionContainer>
   
</mx:Application>

But unable to get Audio working... When video is started it asks for access to cam and mic, but audio doesn't work..

It seems the code is correct, what problems are possible?

Thank you in advance,

kisohin10

1 Reply

Avatar

Employee

Hi Kisohin10,

I tested your code with a few modifications. Audio Publisher seems to be working. I am not sure whats wrong at your end though. I used a similar configuration like your, FP 10.1 & Flex 4.1 SDK.

<?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:collab="com.adobe.rtc.collaboration.*" xmlns:pods="com.adobe.rtc.pods.*" xmlns:session="com.adobe.rtc.session.*" xmlns:authentication="com.adobe.rtc.authentication.*">

<fx:Declarations>

<!-- Place non-visual elements (e.g., services, value objects) here -->

<authentication:AdobeHSAuthenticator id="auth" userName="uName" password="passwd" protocol="rtmfp" />

<session:RoomSettings id="settings" autoPromote="true" />

</fx:Declarations>

<fx:Script>

<![CDATA[

import com.adobe.rtc.events.StreamEvent;

private var activityTimer:Timer = new Timer(30,1);

/****

When published stream is received, start polling the activity level of my microphone.

*/

private function onStreamReceive(p_evt:StreamEvent):void

{

if ( p_evt.streamDescriptor.finishPublishing && p_evt.streamDescriptor.streamPublisherID == session.userManager.myUserID) {

if ( audioPub.microphone != null ) {

activityTimer.addEventListener(TimerEvent.TIMER_COMPLETE,onTimerComplete);

activityTimer.start();

}

}

}

private function onTimerComplete(p_evt:TimerEvent):void

{

activityTimer.start();

if ( audioPub.isPublishing && !audioPub.isPaused ) {

activityProgress.setProgress(audioPub.microphone.activityLevel,100);

}

}

private function onCreationComplete():void

{

audioPub.addEventListener(StreamEvent.STREAM_RECEIVE,onStreamReceive);

audioPub.addEventListener(StreamEvent.STREAM_DELETE,onStreamDelete);

}

/****

When the stream is deleted, stop polling the

activity level of microphone and mark the activity progress bar to 0.

*/

private function onStreamDelete(p_evt:StreamEvent):void

{

if ( p_evt.streamDescriptor.streamPublisherID == session.userManager.myUserID) {

if ( audioPub.microphone != null ) {

activityTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,onTimerComplete);

activityTimer.stop();

}

activityProgress.setProgress(0,100);

}

}

]]>

</fx:Script>

<session:ConnectSessionContainer id="session" authenticator="" roomURL="https://collaboration.adobelivecycle.com/myName/myRoom" initialRoomSettings="" autoLogin="true" left="0" right="0" top="0" bottom="0" creationComplete="onCreationComplete()">

<mx:VBox width="100%" height="100%" verticalGap="2" paddingBottom="5" paddingTop="5" verticalScrollPolicy="on">

<pods:WebCamera width="1200" height="600" />

<pods:SimpleChat  x="0" y="600" width="1200"/>

<collab:AudioPublisher id="audioPub" height="0" useEchoSuppression="true" gain="50" />

<collab:AudioSubscriber id="audioSub" height="0" />

<mx:Button label="AudioButt" toggle="true" id="audioButt" color="#000000"

  click="(audioButt.selected) ? audioPub.publish() : audioPub.stop()"/>

<mx:ProgressBar id="activityProgress" minimum="0" maximum="100" mode="manual" label="" />

</mx:VBox>

</session:ConnectSessionContainer>

</s:Application>