Edit

Share via


Player.DetachFlow(AudioVideoFlow) Method

Definition

Detaches an AudioVideoFlow instance from this player.

public:
 void DetachFlow(Microsoft::Rtc::Collaboration::AudioVideo::AudioVideoFlow ^ audioVideoFlow);
public void DetachFlow (Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoFlow audioVideoFlow);
member this.DetachFlow : Microsoft.Rtc.Collaboration.AudioVideo.AudioVideoFlow -> unit

Parameters

audioVideoFlow
AudioVideoFlow

The AudioVideoFlow instance to be detached.

Exceptions

Thrown when the audioVideoFlow parameter is null.

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);
        }

    }
};


Remarks

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

Applies to