MediaPlayer.CurrentStateChanged 事件

定义

当媒体播放器的状态发生更改时发生。

注意

MediaPlayer.CurrentStateChanged 可能在Windows 10版本 1607 后更改或不可用。 请改用 MediaPlayer.PlaybackSession 属性获取 MediaPlaybackSession 对象,然后使用 MediaPlaybackSession.PlaybackStateChanged 事件。

// 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) 

事件类型

属性

适用于