Player.DetachFlow Method

Detaches an AudioVideoFlow instance from this player.

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

Syntax

'Declaration
Public Sub DetachFlow ( _
    audioVideoFlow As AudioVideoFlow _
)
'Usage
Dim instance As Player
Dim audioVideoFlow As AudioVideoFlow

instance.DetachFlow(audioVideoFlow)
public void DetachFlow(
    AudioVideoFlow audioVideoFlow
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

Thrown when the audioVideoFlow parameter is null.

Remarks

If the specified AudioVideoFlow instance is not attached to this player, DetachFlow merely returns.

Examples

The following example attaches and detaches a Player 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)
                {

                    Player player = new Player();
                    player.AttachFlow(avFlow);

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

                    if (avFlow.Player != null)
                    {
                        // As Player accepts multiple AudioVideoFlows, DetachFlow requires an AudioVideoFlow as argument.
                        avFlow.Player.DetachFlow(avFlow);
                    }

                }
            };

See Also

Reference

Player Class

Player Members

Microsoft.Rtc.Collaboration.AudioVideo Namespace