Partilhar via


AudioControl.GetChannels Method

Gets the audio channels.

Namespace:  Microsoft.Rtc.Collaboration.AudioVideo
Assembly:  Microsoft.Rtc.Collaboration (in Microsoft.Rtc.Collaboration.dll)

Syntax

'Declaration
Public Function GetChannels As IDictionary(Of ChannelLabel, AudioChannel)
'Usage
Dim instance As AudioControl
Dim returnValue As IDictionary(Of ChannelLabel, AudioChannel)

returnValue = instance.GetChannels()
public IDictionary<ChannelLabel, AudioChannel> GetChannels()

Return Value

Type: System.Collections.Generic.IDictionary<ChannelLabel, AudioChannel>
Dictionary with with an AudioChannel indexed by its ChannelLabel.

Remarks

Returns a read-only dictionary of the channels held by AudioControl. Modification at the Dictionary will not have an effect, as the returned object is a copy of the original one.

Examples

The following example disconnects the call if audio channel direction changes to some value different than SendReceive or Inactive.

C# Getting AudioChannel and verifying its property.

 

            audioVideoFlow.ConfigurationChanged += delegate(object sender, AudioVideoFlowConfigurationChangedEventArgs arg)
            {
                AudioVideoFlow avFlow = (AudioVideoFlow)sender;

                // check directions
                AudioChannel audioChannel = (AudioChannel)avFlow.Audio.GetChannels()[ChannelLabel.AudioMono];
                if ((audioChannel.Direction != MediaChannelDirection.SendReceive)
                    && (audioChannel.Direction != MediaChannelDirection.Inactive))
                {
                    AudioVideoCall call = avFlow.Call;
                    call.EndTerminate(call.BeginTerminate(null, null));
                }
            };


See Also

Reference

AudioControl Class

AudioControl Members

Microsoft.Rtc.Collaboration.AudioVideo Namespace