MediaChannelTemplate.AllowedDirection Property

Gets or sets the stream allowed direction.

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

Syntax

'Declaration
Public Property AllowedDirection As MediaChannelDirection
    Get
    Set
'Usage
Dim instance As MediaChannelTemplate
Dim value As MediaChannelDirection

value = instance.AllowedDirection

instance.AllowedDirection = value
public MediaChannelDirection AllowedDirection { get; set; }

Property Value

Type: Microsoft.Rtc.Collaboration.AudioVideo.MediaChannelDirection

Exceptions

Exception Condition
ArgumentOutOfRangeException

Thrown when assigned value is not defined in enumerated type.

Examples

The following example changes AllowedDirection and applies it to an AudioVideoFlow.

C# Modifying AudioChannelTemplate properties.

 

            AudioVideoFlowTemplate templateToApply = new AudioVideoFlowTemplate(audioVideoFlow);
            AudioChannelTemplate audioChannelTemplate = (AudioChannelTemplate)templateToApply.Audio.GetChannels()[ChannelLabel.AudioMono];
            audioChannelTemplate.AllowedDirection = MediaChannelDirection.SendOnly;
            audioChannelTemplate.SendDirectionSamplingRate = AudioSamplingRate.EightKhz;

            // ApplyChanges
            audioVideoFlow.BeginApplyChanges(
                templateToApply,
                new AsyncCallback(delegate(IAsyncResult result)
                {
                    try
                    {
                        audioVideoFlow.EndApplyChanges(result);
                    }
                    catch (RealTimeException e)
                    {
                        // handle exception
                        throw e;
                    }

                    // ApplyChanges is done, verify changes result..
                    AudioChannel audioChannel = audioVideoFlow.Audio.GetChannels()[ChannelLabel.AudioMono];
                    if (audioChannel.Direction == MediaChannelDirection.SendOnly &&
                        audioChannel.SendDirectionSamplingRate == AudioSamplingRate.EightKhz)
                    {
                        // remote side accepted changes as they were
                    }
                    else
                    {
                        // remote side accepted changes but filtered them more.
                    }
                }),
                this);


See Also

Reference

MediaChannelTemplate Class

MediaChannelTemplate Members

Microsoft.Rtc.Collaboration.AudioVideo Namespace