Share via


MediaPlayer.CurrentStateChanged Event

Definition

Occurs when the state of the media player has changed.

Note

MediaPlayer.CurrentStateChanged may be altered or unavailable after Windows 10, version 1607. Instead, use the MediaPlayer.PlaybackSession property to get a MediaPlaybackSession object and then use the MediaPlaybackSession.PlaybackStateChanged event.

// Register
event_token CurrentStateChanged(TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;

// Revoke with event_token
void CurrentStateChanged(event_token const* cookie) const;

// Revoke with event_revoker
MediaPlayer::CurrentStateChanged_revoker CurrentStateChanged(auto_revoke_t, TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;
/// [add: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
/// [remove: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
// Register
event_token CurrentStateChanged(TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;

// Revoke with event_token
void CurrentStateChanged(event_token const* cookie) const;

// Revoke with event_revoker
MediaPlayer::CurrentStateChanged_revoker CurrentStateChanged(auto_revoke_t, TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;
public event TypedEventHandler<MediaPlayer,object> CurrentStateChanged;
[add: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
[remove: Windows.Foundation.Metadata.Deprecated("Use PlaybackSession.PlaybackStateChanged instead of CurrentStateChanged.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 196608, "Windows.Foundation.UniversalApiContract")]
public event TypedEventHandler<MediaPlayer,object> CurrentStateChanged;
function onCurrentStateChanged(eventArgs) { /* Your code */ }
mediaPlayer.addEventListener("currentstatechanged", onCurrentStateChanged);
mediaPlayer.removeEventListener("currentstatechanged", onCurrentStateChanged);
- or -
mediaPlayer.oncurrentstatechanged = onCurrentStateChanged;
Public Custom Event CurrentStateChanged As TypedEventHandler(Of MediaPlayer, Object) 

Event Type

Attributes

Applies to