Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

change audio/video source on the fly

Avatar

Level 2

something like this:

private function micChanged(event:Event):void

               {

                    

                    audioPub.stop();

                    audioPub.microphoneManager.micIndex = micSelection.selectedIndex;

                    audioPub.publish();

               }

but this don't works...

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi,

You might have to wait for the stream to have been deleted i.e. listen to StreamEvent.STREAM_DELETE event in audio publisher and after that set the microphone manager and then publish.

Are you using multiple microphones/cameras ?

Thanks

Hironmay Basu

View solution in original post

3 Replies

Avatar

Correct answer by
Former Community Member

Hi,

You might have to wait for the stream to have been deleted i.e. listen to StreamEvent.STREAM_DELETE event in audio publisher and after that set the microphone manager and then publish.

Are you using multiple microphones/cameras ?

Thanks

Hironmay Basu

Avatar

Level 2

Many thanks...

Yes, I'm using multiple microphones/cameras.

Now this is the right code (for me)

               private function micChanged(event:Event):void
               {
                    
                    audioPub.stop();
                    audioPub.addEventListener(StreamEvent.STREAM_DELETE, onMicChanged);
                    
               }
               
               private function onMicChanged(se:StreamEvent):void{
                    audioPub.microphoneManager.micIndex = micSelection.selectedIndex;
                    audioPub.publish();
                    audioPub.removeEventListener(StreamEvent.STREAM_DELETE, onMicChanged);
               }

Avatar

Level 2

I would to solve the same issue with the camera, but I don't know about some kind of "webcamera manager".

This is my code... (don't works), thanks in advance.

<rtc:WebCamera  id="videoContainer" height="250" width="640" aspectRatio="{StreamManager.AR_PORTRAIT}"/>

...

...

private function cameraChanged(event:Event):void

{

videoContainer.publisher.stop();

videoContainer.publisher.addEventListener(StreamEvent.STREAM_DELETE, onCameraChanged);

}

videoContainer.publisher.cameraNameIndex = cameraSelection.selectedIndex.toString();  //maybe here is wrong.

videoContainer.publisher.publish();

videoContainer.publisher.quality = camQualitySlider.value;

videoContainer.publisher.removeEventListener(StreamEvent.STREAM_DELETE, onCameraChanged);

}

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----