Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Changing microphone causes error 1009

Avatar

Level 2

I would like to give users the ability to change their microphone *after* joining a room, but the following code throws the following error.  Is there anyway to accomplish this?  Thanks!

Microphone.getMicrophone( micComboBox.selectedIndex );  /* called anytime after audioPub.publish() */

TypeError: Error #1009: Cannot access a property or method of a null object reference.

    at com.adobe.rtc.collaboration::AudioPublisher/onStreamDelete()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\collaboration\AudioPublisher.as:976]

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at com.adobe.rtc.sharedManagers::StreamManager/onItemRetract()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\sharedManagers\StreamManager.as:2105]

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\sharedModel\CollectionNode.as:790]

    at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\messaging\manager\MessageManager.as:755]

    at com.adobe.rtc.session.managers::SessionManagerBase/receiveItemRetraction()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\session\managers\SessionManagerBase.as:401]

10 Replies

Avatar

Employee

I am not familiar with this code and our “resident expert” is in vacation this week, but I’ll try a suggestion.

Can you explain how you are changing the microphone exactly ? For one thing, if you are publishing already the published streams is “connected” to a specific microphone, so if you change it after you start publishing the stream will still be connected to the old microphone.

So, the correct sequence should be:

1) Stop publishing

2) Change the microphone

3) Publish again

If this is what you are doing we may have a bug where we are trying to do too much ☺

This is the offending code:

if (_mic) {

if ( _mic.codec.toLowerCase() == SoundCodec.NELLYMOSER.toLowerCase() ) { /* line 976 */

MicrophoneManager.getInstance().selectedMic.setSilenceLevel(10) ;

_mic.removeEventListener(ActivityEvent.ACTIVITY, onActivity);

}else if ( _mic.codec.toLowerCase() == SoundCodec.SPEEX.toLowerCase()) {

activityTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,onActivityTimerComplete);

activityTimer.stop();

}

_mic = null;

}

It could be a _mic.codec is null already and we should check that BEFORE doing the toLowerCase();

We’ll try to reproduce this but it would be good if you could verify if that is the problem (if you can run your application in FlashBuilder you could put a breakpoint at line 976 as in your stack trace.

Avatar

Level 2

Hi Raff,

1) The application currently does not stop publishing before changing the mic.

2) The error only occurs if two users have joined a room, AND neither user has changed their mic before joining the room.  If one user joins a room and then changes their mic, and then a second user joins and changes their mic the error does not occur.

3) I am testing on a Mac w/o a built-in microphone, so the mic index MUST be changed to send any audio.

Mike

Avatar

Level 2

Hi Raff,

I changed:

Microphone.getMicrophone( micCombo.selectedIndex );

to:

audioPub.stop();

Microphone.getMicrophone( micCombo.selectedIndex );

audioPub.publish();

and I get a new error (with just a single user in a room):

Error: Stream cannot be published as it doesnot exists

    at com.adobe.rtc.sharedManagers::StreamManager/publishStream()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\sharedManagers\StreamManager.as:950]

    at com.adobe.rtc.collaboration::AudioPublisher/publish()[E:\flashfarm\branches\connect\1108\SDKApp\payload\libs\player10.3\src\com\adobe\rtc\collaboration\AudioPublisher.as:814]

    at v2/changeMicrophone()[/Users/administrator/Documents/Adobe Flash Builder 4.5/v2/src/v2.mxml:91]

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]

    at spark.components::List/commitSelection()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1205]

    at spark.components.supportClasses::DropDownListBase/commitSelection()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\DropDownListBase.as:565]

    at spark.components.supportClasses::ListBase/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\ListBase.as:939]

    at spark.components::List/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1069]

    at spark.components.supportClasses::DropDownListBase/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\DropDownListBase.as:508]

    at spark.components::ComboBox/commitProperties()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\ComboBox.as:725]

    at mx.core::UIComponent/validateProperties()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:8209]

    at spark.components::List/item_mouseDownHandler()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\List.as:1842]

    at spark.components.supportClasses::DropDownListBase/item_mouseDownHandler()[E:\dev\4.5.1\frameworks\projects\spark\src\spark\components\supportClasses\DropDownListBase.as:732]

    at flash.events::EventDispatcher/dispatchEventFunction()

    at flash.events::EventDispatcher/dispatchEvent()

    at mx.core::UIComponent/dispatchEvent()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\core\UIComponent.as:13128]

    at mx.managers::SystemManager/mouseEventHandler()[E:\dev\4.5.1\frameworks\projects\framework\src\mx\managers\SystemManager.as:2924]

Avatar

Employee

Hi try changing the mic using the API MicrophoneManager.micIndex. Let us know if the code below works for you.

audioPub.stop()

audioPub.microphoneManager.micIndex = micComboBox.selectedIndex

audioPub.start()

Avatar

Level 4

EDIT: After muting the mic in the UI.

Hmm I'm getting the same RTE:

Line 976 as Raff pointed out is in fact null ( _mic.codec ), what's odd is that in we setup our AudioPublisher as such:

<collaboration:AudioPublisher id="audioPublisher" includeInLayout="false" codec="{SoundCodec.SPEEX}" gainControl="true" useEchoSuppression="false"/>

Still looking at possible cause of this, since our flow seems to be a bit different, RTE above occurs after we:

EDIT: It was actually this code, which makes now makes sense

- Alex

Avatar

Level 4

By changing:

if ( mute && _audioPublisher.isPublishing ) {

    try {

        _audioPublisher.stop();

    } catch ( e:Error ) {

        trace("ERROR audioPublisher.stop: " + e.toString());

}

to

EDIT: Audio still isn't publishing, event though that gets rid of the RTE, but this is makes me feel like I don't understand what's really causing the issue in the first place. Also this started happening right after switching to LCCS v2.2.0 ( FP 10.3 ) swc. Any thoughts ?

Avatar

Level 4

A bit more info on what' I'm seeing in my app:

Scenario 1:

1) Launch player1 - invoke AudioPublisher.publish() anytime ( it's in a try+catch block so I get the following ( from StreamManager.as line 950 )

2) Launch player2 - will at some point AudioSubscriber.subscribe() and AudioPublisher.publish()

* once this player2 begins initializing I get the RTE

RESULT: Two different runtime issues, maybe the first error is because the user 2 is not there yet, but this is ok ?

Scenario 2:

1) Launch player1 - do not invoke AudioPublisher.publish()

2) Launch player2 - AudioSubscriber.subscribe() and AudioPublisher.publish()

3) once both views are completely rendered

* call player1's AudioPublisher.publish()

RESULT: This works correctly.

Avatar

Employee

Hi Alex,

If all you are doing is _audioPublisher.stop() for muting the mic, I am not hitting any RTE. My dev set up is -

LCCS SDK Version : 2.2.0    Player Version : MAC 11,0,1,152 on FireFox & Mac 10.6

Can you share more info if possible to reproduce the issue. Also the mic always has a default codec, and should never be null.

Thanks

Arun

Avatar

Level 4

Flex SDK 4.5.1

LCCS SDK v 2.2.0 ( targeting FP 10.3 )

Mac 10.6.8

Firefox 8.0

FlashPlayer 10,3,183,10

Here's the easiest way to reproduce Scenario 1:

1) Get the "Audio.mxml" app you guys provide in the SDK

2) Modify the "audioPub" line:

3) Add the following:

This is rather interesting because calling "audioPub.publish()" twice in a synchrounous fashion, doesn't cause the RTE.

This is basically what's happening in my app, I'm trying to publish twice within a short time span because of views & bindings firing off which causes the RTE for me.

Full test app source:

Avatar

Level 4

Offending code: Microphone.getMicrophone( micIndex ); // mixIndex is most likely irrelevant here

Workaround:        MicrophoneManager.getInstance().selectedMic;

Details:

Why it started happening: We switched to the LCCS v2.2.0 FP10.3 swc for the AEC.

Early on in the init sequence of the app, we were getting a mic using "Microphone" class, then later in the code using AudioPublisher  tries to create an enhancedMic to enable the AEC for

and for some reason this caused AudioPublisher to RTE on:

We commented out all of Microphone and MicrophoneManager references where we were setting micIndex so it's just bare bones AudioPublisher + Subscriber and

this setup works fine. After switching to MicManager things seemed to have worked.