MediaPlayer.SourceChanged Event
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when the media source for the MediaPlayer changes.
// Register
event_token SourceChanged(TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;
// Revoke with event_token
void SourceChanged(event_token const* cookie) const;
// Revoke with event_revoker
MediaPlayer::SourceChanged_revoker SourceChanged(auto_revoke_t, TypedEventHandler<MediaPlayer, IInspectable const&> const& handler) const;
public event TypedEventHandler<MediaPlayer,object> SourceChanged;
function onSourceChanged(eventArgs) { /* Your code */ }
mediaPlayer.addEventListener("sourcechanged", onSourceChanged);
mediaPlayer.removeEventListener("sourcechanged", onSourceChanged);
- or -
mediaPlayer.onsourcechanged = onSourceChanged;
Public Custom Event SourceChanged As TypedEventHandler(Of MediaPlayer, Object)
TypedEventHandler<MediaPlayer,IInspectable>
Device family |
Windows 10 Anniversary Edition (introduced in 10.0.14393.0)
|
API contract |
Windows.Foundation.UniversalApiContract (introduced in v3.0)
|
A typical use of this event is if you are implementing your own transport controls. You can respond to this event by checking to see whether the source is a MediaSource, MediaPlaybackItem, or MediaPlaybackList and then update your UI accordingly. For example, if the source is a MediaPlaybackItem, you could subscribe to the list of audio and caption tracks and update the list in your UI so that the user can select the active track.
Product | Versions |
---|---|
WinRT | Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100 |