MediaPlayer.SourceChanged MediaPlayer.SourceChanged MediaPlayer.SourceChanged MediaPlayer.SourceChanged MediaPlayer.SourceChanged Event

Definition

Occurs when the media source for the MediaPlayer changes.

public : event TypedEventHandler<MediaPlayer, object> SourceChanged
// Register
event_token SourceChanged(TypedEventHandler<MediaPlayer, object> const& handler) const;

// Revoke with event_token
void SourceChanged(event_token const& cookie) const;

// Revoke with event_revoker
SourceChanged_revoker SourceChanged(auto_revoke_t, TypedEventHandler<MediaPlayer, object> const& handler) const;
public event TypedEventHandler<MediaPlayer, object> SourceChanged
Public Event SourceChanged As TypedEventHandler (Of MediaPlayer, object)
function onSourceChanged(eventArgs){/* Your code */}


mediaPlayer.addEventListener("sourcechanged", onSourceChanged);
mediaPlayer.removeEventListener("sourcechanged", onSourceChanged);

Remarks

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.