ToneController.AttachFlow Method

Attaches an AudioVideoFlow instance.

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

public void AttachFlow(
	AudioVideoFlow audioVideoFlow
)

Parameters

audioVideoFlow
Type: Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoFlow
The AudioVideoFlow instance to be attached.

ExceptionCondition
ArgumentNullException

Thrown when the audioVideoFlow argument is null.

InvalidOperationException

Thrown when another AudioVideoFlow instance is already attached or when the specified AudioVideoFlow instance is already attached to another ToneController.

The following example attaches and detaches a ToneController by the time AudioVideoFlow changes its state to Active and Terminated.

C# Attaching and detaching an AudioVideoFlow.

 

            audioVideoFlow.StateChanged += delegate(object sender, MediaFlowStateChangedEventArgs args)
            {
                AudioVideoFlow avFlow = (AudioVideoFlow)sender;

                if(avFlow.State == MediaFlowState.Active)
                {

                    ToneController toneController = new ToneController();
                    toneController.AttachFlow(avFlow);

                }
                else if(avFlow.State == MediaFlowState.Terminated)
                {

                    if (avFlow.ToneController != null)
                    {
                        avFlow.ToneController.DetachFlow();
                    }

                }
            };



Show: