Player.AttachFlow Method

Attaches an AudioVideoFlow instance to this player.

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

Syntax

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

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

Parameters

Exceptions

Exception Condition
ArgumentNullException

Thrown when the audioVideoFlow parameter is null.

OperationFailureException

Thrown when the operation failed, such as for an overloaded system.

InvalidOperationException

Thrown when the operation is invalid for the current object state.

InvalidOperationException

Thrown when the operation is invalid because an unbuffered media source is already being played to another AudioVideoFlow attached to this Player.

Remarks

If the player is already started, the AudioVideoFlow will join in a broadcast fashion.

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