Expand my Community achievements bar.

Can't set audioPub.microphoneManager.encodeQuality

Avatar

Level 4

This is driving me crazy today, I want to set the audioPub.microphoneManager.encodeQuality = 8; when I start a connection.   But I can't because the microphoneManager doesn't exist until sometime after I call audioPub.publish();  So I get a null exception.

I have the same issue where I want to set webPub.camera.setQuality(42000, 0); the camera doesn't exist until sometime after publish.

Ideally I want to set this before I start streaming packets.  I tried adding event listeners for isAudioPublishing, or streamPublishing like this:

            audioPub.addEventListener(StreamEvent.STREAM_PUBLISHING, onStreamPublishing);

but I get this error all the time: Access of possibly undefined property STREAM_PUBLISHING through a reference with static type Class.  And when I go look at the docs for those event classes I don't see isAudioPublishing, or streamPublishing defined anywhere.

Here's my audio creation code:

            audioPub = null;
            audioSub = null;
                       
            audioPub = new AudioPublisher();
            audioSub = new AudioSubscriber();
           
            audioPub.connectSession = lccsModel.session;
            audioPub.codec = SoundCodec.SPEEX;
       
            audioPub.subscribe();
            audioPub.addEventListener(AudioConfigurationEvent.GAIN_CHANGED, onGainUpdate);

           
            audioSub.connectSession = lccsModel.session;
            audioSub.subscribe();
            audioSub.setLocalVolume(1);
           
            audioPub.publish();
            audioPub.microphoneManager.encodeQuality = 8;//<-- this line will throw an exception               
           
           
            videoBox.addChild(audioSub);
            videoBox.addChild(audioPub);

4 Replies

Avatar

Level 4

bah never mind I'll do another way.


Avatar

Former Community Member

Hi ,

There is no event called STREAM_PUBLISHING. If you are listening to publisher, then you use StreamEvent.STREAM_RECEIVE as this is event associated with receiving stream.

Also you can use for audio,

audioPub.addEventListener("isAudioPublishing",handler) and for camera use cameraPub.addEventListener("isCameraPublishing",handler). These are just normal Event Strings.

For reference, you can look inside the onStreamReceive function in player 9. It is more or less similar for the 10 swc.

Hope this helps.

Thanks

Hironmay Basu

Avatar

Level 4

Ok so in my documentation for the Class AudioPublisher there is an event

listed in it's event table like this:

streamPublishing event

Event object type:

com.adobe.rtc.events.StreamEvent<file:////Users/eric/Documents/com.adobe.afcs/docs/asdocs/com/adobe/rtc/events/StreamEvent.html>

Dispatched when the current user is publishing or stops publishing.

Do I just have bad docs or something? My original intent was to know when

my audio stream had started publishing so I would know when the microphone

manager existed.

-Eric

Avatar

Level 2

I believe the microphoneManager only exists when the stream is publishing. In my app I am doing similar modifications to the microphoneManage of my audio stream. I just use the audioPub.publish() function as an indication of when to start making changes to microphoneManager.

It has worked well for me so far.

Cheers,

-David