Edit

Share via


Player.StateChanged Event

Definition

Raised to notify applications that the player state has changed.

public:
 event EventHandler<Microsoft::Rtc::Collaboration::AudioVideo::PlayerStateChangedEventArgs ^> ^ StateChanged;
public event EventHandler<Microsoft.Rtc.Collaboration.AudioVideo.PlayerStateChangedEventArgs> StateChanged;
member this.StateChanged : EventHandler<Microsoft.Rtc.Collaboration.AudioVideo.PlayerStateChangedEventArgs> 
Public Custom Event StateChanged As EventHandler(Of PlayerStateChangedEventArgs) 

Event Type

Examples

The following example shows an app subscribing to a StateChanged event. The event handler detaches all AudioVideoFlow if play is completed.

C# Subscribing to StateChanged event.


player.StateChanged += delegate(object sender, PlayerStateChangedEventArgs e)
{
    // Detaches all flow once player completes.
    if (e.TransitionReason == PlayerStateTransitionReason.PlayCompleted)
    {
        foreach (AudioVideoFlow avFlow in player.AudioVideoFlows)
        {
            player.DetachFlow(avFlow);
        }
    }
};



Remarks

The StateChanged Event is raised for every state change that occurs on the player, including when the application causes the state change.

Applies to