Expand my Community achievements bar.

How i add audio publisher/audio subscriber in my chat applcation

Avatar

Former Community Member

hello,

I try add audio publisher/audio subscriber  in chat applcation im using flash bulider 4 however i watch the example in smp applcations

that have in sdk but what i need i include inside chat applcation button to start and stop audio in chat applcation i treid many times

to do it but always give me error so what is the way to add audio publisher/audio subscriber  with button for user hit button run audio hit again stop audio, also need to add other button "logout" to user can logout from applaction when finish but after i add button is dosent work too.

Need help

Thanks

13 Replies

Avatar

Former Community Member

Hi,

So, you're not going to tell us what error you're hitting?

Would it be faster for me to write your application for you?

nigel

Avatar

Former Community Member

Oh nigel sorry i really forget say what is th error however i gonna paste the code to see where is the error buttons "logout" and "start my audio" dosent work

I dont know why here is the code,

thanks nigel

<?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="500" minHeight="500" xmlns:rtc="http://ns.adobe.com/rtc" width="590" height="590" backgroundColor="#3D3B3B" preloaderChromeColor="#999393">
    <fx:Style source="client.css"/>
    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
           
            protected function txtUsername_enterHandler(event:FlexEvent):void
            {
                // TODO Auto-generated method stub
                connectRoom.login();
                labelUsername.visible = false;
                txtUsername.visible = false;
            }
           
            protected function btnZoomScreen_clickHandler(event:MouseEvent):void
            {
                // move screenShare
                if(btnZoomScreen.label == "zoom in"){
                    moveEffect.targets = [scrShare,labelScreen];
                    moveEffect.xTo = 10;
                    moveEffect.yTo = 10;
                    moveEffect.play();
                   
                    resizeEffect.target = scrShare;
                    resizeEffect.widthTo = 520;
                    resizeEffect.heightTo = 479;
                    resizeEffect.play();
                   
                    btnZoomScreen.label = "zoom out";
                   
                    btnZoomScreen.y = 5;
                }else{
                    moveEffect.targets = [scrShare,labelScreen];
                    moveEffect.xTo = 294;
                    moveEffect.yTo = 296;
                    moveEffect.play();
                   
                    resizeEffect.target = scrShare;
                    resizeEffect.widthTo = 250;
                    resizeEffect.heightTo = 293;
                    resizeEffect.play();
                   
                    btnZoomScreen.label = "zoom in";
                   
                    btnZoomScreen.y = 296;
                }
               
            }

        ]]>
    </fx:Script>
    <fx:Declarations>
        <s:Move duration="500" id="moveEffect"/>
        <s:Resize duration="500" id="resizeEffect"/>
    </fx:Declarations>
   
    <rtc:ConnectSessionContainer horizontalScrollPolicy="off" verticalScrollPolicy="off" id="connectRoom" autoLogin="false"
                                 roomURL="http://connectnow.acrobat.com/jannaali/mymeeting"
                                 x="0" y="55" width="590" height="535" backgroundColor="#323131" contentBackgroundColor="#FFFFFF">
        <rtc:authenticator>
            <rtc:AdobeHSAuthenticator userName="{txtUsername.text}"/>
        </rtc:authenticator>
        <rtc:SimpleChat  x="10" y="10"  width="274" height="479" chromeColor="#CCCCCC"/>
        <rtc:WebcamSubscriber x="292" y="23" displayUserBars="true"  width="250" height="250"/>
        <rtc:AudioPublisher id="audioPub" height="0" />
        <rtc:AudioSubscriber id="audioSub" height="0" />
        <s:Label x="292" y="10" text="Ahmed's webcam" fontFamily="Verdana" fontSize="9" color="#040404" chromeColor="#CCCCCC"/>
        <rtc:ScreenShareSubscriber id="scrShare" width="250" height="193" x="294" y="296"/>       
        <s:Label id="labelScreen" x="295" y="285" text="Ahmed's screen" fontFamily="Verdana" fontSize="9" color="#060606"/>
        <mx:LinkButton x="474" y="296" label="zoom in" fontFamily="Verdana" color="#0712A9" id="btnZoomScreen" click="btnZoomScreen_clickHandler(event)"/>
        <s:Button x="19" y="497" label="start my audio" height="28" width="106"/>
        <s:Button x="133" y="497" label="logout" width="106" height="28"/>

    </rtc:ConnectSessionContainer>
   
    <s:Label id="labelUsername" x="165" y="191" text="Enter a username and press Enter:" color="#4A0606" fontSize="13" fontWeight="bold" fontStyle="italic"/>
    <s:TextInput x="165" y="205" width="221" textAlign="center" id="txtUsername" enter="txtUsername_enterHandler(event)"/>
</s:Application>

Avatar

Employee

Hi Janna Ahmed,

The logout and start audio buttons are not working because, there are no click event handlers for those buttons. Adding the event handlers, and the logic for logging out of your room & start/stopping your audio should help you.

Thanks

Arun

Avatar

Former Community Member

Hello,

but could you explain how i add this events be couse i add but dosent work yet if im right will be like it

<s:Button x="19" y="497" label="start my audio" height="28" width="106" click="start my audio_clickHandler(event)"/>

<s:Button x="133" y="497" label="logout" width="106" height="28" click="logout_clickHandler(event)"/>

but dosent work could you check if wrong or right.

Thanks

Avatar

Former Community Member

hello,

I test audio in the applcation and is work fine in applcation but still have one problem is logout button is dosent work i try look about event handler but will be nice if have any example about event handler for help  me to understand how i add this funcation in applcation to run logout button.

i search on intenrnet  find some example

so i typing event handler like it.

public function logout():void {
            afcsSession.logout();
        }

but have error:"1114: The public attribute can only be used inside a package."

any ideas

thanks

Avatar

Former Community Member

I'll give you a hint : See the docs for ConnectSessionContainer.logout();

nigel

Avatar

Former Community Member

Hi nigel,

i do and read,search about ConnectSessionContainer.logout(); and i find an example explain about it however i do the same example explain

but flash bulider say have 3 error is "1120 Access of undefined probely cSession" and here the code i add

protected function button1_clickHandler(event:MouseEvent):void
            {
               
                cSession.logout();
               
                cSession.roomURL = "http://connectnow.acrobat.com/jannaali/mymeeting" + event.item.data;
               
                cSession.login();
               
            }

thanks,

Avatar

Level 3

Hi,

I think you have a typo.  From the code above, it looks like you named your ConnectSessionContainer "connectRoom", not "cSession":

<rtc:ConnectSessionContainer horizontalScrollPolicy="off" verticalScrollPolicy="off" id="connectRoom"

-Jamie

Avatar

Former Community Member

Also flash bulider give me error, jamie im try to add logout button my problem is event handler always give error in flash bulider so button logout dosent work

i need really an example explain about event handler or any help to typing the event handler im using flash bulider 4.

your code is give error in flash bulider i believe your code looks like not have realtionship with button logout im not sure.

thanks, jamie

Avatar

Employee

I don't want to seem rude, but you should probably take some Flex programming classes. We can help you with LCCS questions but we can't really help you with basic programming question.

Avatar

Former Community Member

Hi Jannaahmed,

We are really trying to help you (you've got half of the LCCS team answering your questions) but you have to help yourself too.

As Raffaele said, you might want to do some additional learning on Flex & Actionscript, first, before jumping into LCCS.

The internet is full of great resources - try googling for "flex event handlers" and you will find a lot of good articles/tutorials.

For example:

http://www.adobe.com/devnet/actionscript/articles/event_handling_as3.html

The Flex documention is also a great place to spend some time at:

http://www.adobe.com/devnet/flex/documentation.html

The LCCS Forums are meant to help developers as they build their applications and work with the platform, but there is a limit to how much we can help (we can't do all/most of the coding for you ...).

Good luck!

Julien

LCCS Quality Engineering

Avatar

Former Community Member

I believe im using flex and applcation is already created and is work fine connect with my room very well also the audio in applcation work fine too after explain from nigel about audio  i understand how is work and i test in applcation is work fine only one thing i got problem is add button to when user finish conversation and he wish go out applcation he click in button logout so leave applcation only this i need really help.

thanks

Avatar

Former Community Member

thanks julian i understand and team of adob do a great work to help  all users.

Thanks to all team