SystemMediaTransportControls
SystemMediaTransportControls
SystemMediaTransportControls
SystemMediaTransportControls
Class
Definition
Represents an object that enables integrate with the system media transport controls and support for media commands.
public : sealed class SystemMediaTransportControls : ISystemMediaTransportControls, ISystemMediaTransportControls2public sealed class SystemMediaTransportControls : ISystemMediaTransportControls, ISystemMediaTransportControls2Public NotInheritable Class SystemMediaTransportControls Implements ISystemMediaTransportControls, ISystemMediaTransportControls2// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Remarks
The SystemMediaTransportControls replaces the MediaControl class. In Windows 8.1 and later, you should use this control instead of MediaControl to interact with the system transport controls. The system transport controls enable music application developers to hook into a system-wide transport control. The system transport control allows a user to control a music application that is in the background as well as get and set the current information on which track is playing.
Starting with Windows 10, version 1607, UWP apps that use the MediaPlayer class or AudioGraph class to play media are automatically integrated with the SMTC by default. Simply instantiate a new instance of MediaPlayer and assign a MediaSource, MediaPlaybackItem, or MediaPlaybackList to the player's Source property and the user will see your app name in the SMTC and can play, pause, and move through your playback lists by using the SMTC controls. Get an instance of the SMTC by accessing the MediaPlayer object's SystemMediaTransportControls property. For how-to guidance on using the SMTC from your app, see Integrate with the SystemMediaTransportControls.
For some scenarios, you may want to disable automatic integration with the SMTC. In this case, you should disable the MediaPlayer object's CommandManager by setting the IsEnabled property to false. Call GetForCurrentView to get an instance of the SystemMediaTransportControls for current view. You will also need to get an instance this way if you are targeting an older version of Windows. For how-to guidance on manually controlling the SMTC, see Manual control of the System Media Transport Controls.
Properties
AutoRepeatMode AutoRepeatMode AutoRepeatMode AutoRepeatMode
Gets or sets a value representing the current auto-repeat mode of the SystemMediaTransportControls.
public : MediaPlaybackAutoRepeatMode AutoRepeatMode { get; set; }public MediaPlaybackAutoRepeatMode AutoRepeatMode { get; set; }Public ReadWrite Property AutoRepeatMode As MediaPlaybackAutoRepeatMode// You can use this property in JavaScript.
- Value
- MediaPlaybackAutoRepeatMode MediaPlaybackAutoRepeatMode MediaPlaybackAutoRepeatMode MediaPlaybackAutoRepeatMode
A value representing the current auto-repeat mode.
DisplayUpdater DisplayUpdater DisplayUpdater DisplayUpdater
Gets the display updater for the SystemMediaTransportControls which enable updating the information displayed about the currently playing song.
public : SystemMediaTransportControlsDisplayUpdater DisplayUpdater { get; }public SystemMediaTransportControlsDisplayUpdater DisplayUpdater { get; }Public ReadOnly Property DisplayUpdater As SystemMediaTransportControlsDisplayUpdater// You can use this property in JavaScript.
IsChannelDownEnabled IsChannelDownEnabled IsChannelDownEnabled IsChannelDownEnabled
Gets or sets a value that specifies if the channel down button is supported.
public : PlatForm::Boolean IsChannelDownEnabled { get; set; }public bool IsChannelDownEnabled { get; set; }Public ReadWrite Property IsChannelDownEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the channel down button is supported; otherwise, false.
IsChannelUpEnabled IsChannelUpEnabled IsChannelUpEnabled IsChannelUpEnabled
Gets or sets a value that specifies if the channel up button is supported.
public : PlatForm::Boolean IsChannelUpEnabled { get; set; }public bool IsChannelUpEnabled { get; set; }Public ReadWrite Property IsChannelUpEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the channel up button is supported; otherwise, false.
IsEnabled IsEnabled IsEnabled IsEnabled
Enables and disables the system media transport controls for the app.
public : PlatForm::Boolean IsEnabled { get; set; }public bool IsEnabled { get; set; }Public ReadWrite Property IsEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the system transport controls are enabled for the app; otherwise, false.
Remarks
Setting IsEnabled to false will disable the apps support for the system media transport controls, so the controls will not show. Setting IsEnabled to true will re-enable the controls for the app.
IsFastForwardEnabled IsFastForwardEnabled IsFastForwardEnabled IsFastForwardEnabled
Gets or sets a value that specifies if the fast forward button is supported.
public : PlatForm::Boolean IsFastForwardEnabled { get; set; }public bool IsFastForwardEnabled { get; set; }Public ReadWrite Property IsFastForwardEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the fast forward button is supported; otherwise, false.
IsNextEnabled IsNextEnabled IsNextEnabled IsNextEnabled
Gets or sets a value that specifies if the next button is supported.
public : PlatForm::Boolean IsNextEnabled { get; set; }public bool IsNextEnabled { get; set; }Public ReadWrite Property IsNextEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the next button is supported; otherwise, false.
IsPauseEnabled IsPauseEnabled IsPauseEnabled IsPauseEnabled
Gets or sets a value that specifies if the pause button is supported.true if the pause button is supported; otherwise, false.
public : PlatForm::Boolean IsPauseEnabled { get; set; }public bool IsPauseEnabled { get; set; }Public ReadWrite Property IsPauseEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the pause button is supported; otherwise, false.
IsPlayEnabled IsPlayEnabled IsPlayEnabled IsPlayEnabled
Gets or sets a value that specifies if the play button is supported.
public : PlatForm::Boolean IsPlayEnabled { get; set; }public bool IsPlayEnabled { get; set; }Public ReadWrite Property IsPlayEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the play is supported; otherwise, false.
IsPreviousEnabled IsPreviousEnabled IsPreviousEnabled IsPreviousEnabled
Gets or sets a value that specifies if the previous button is supported.
public : PlatForm::Boolean IsPreviousEnabled { get; set; }public bool IsPreviousEnabled { get; set; }Public ReadWrite Property IsPreviousEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the previous button is supported; otherwise, false.
IsRecordEnabled IsRecordEnabled IsRecordEnabled IsRecordEnabled
Gets or sets a value that specifies if the record button is supported.true if the record button is supported; otherwise, false.
public : PlatForm::Boolean IsRecordEnabled { get; set; }public bool IsRecordEnabled { get; set; }Public ReadWrite Property IsRecordEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the record button is supported; otherwise, false.
IsRewindEnabled IsRewindEnabled IsRewindEnabled IsRewindEnabled
Gets or sets a value that specifies if the rewind button is supported.
public : PlatForm::Boolean IsRewindEnabled { get; set; }public bool IsRewindEnabled { get; set; }Public ReadWrite Property IsRewindEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the rewind button is supported; otherwise, false.
IsStopEnabled IsStopEnabled IsStopEnabled IsStopEnabled
Gets or sets a value that specifies if the stop button is supported.
public : PlatForm::Boolean IsStopEnabled { get; set; }public bool IsStopEnabled { get; set; }Public ReadWrite Property IsStopEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
true if the stop button is supported; otherwise, false.
PlaybackRate PlaybackRate PlaybackRate PlaybackRate
Gets or sets the playback rate of the SystemMediaTransportControls.
public : double PlaybackRate { get; set; }public double PlaybackRate { get; set; }Public ReadWrite Property PlaybackRate As double// You can use this property in JavaScript.
- Value
- double double double double
The playback rate of the SystemMediaTransportControls.
PlaybackStatus PlaybackStatus PlaybackStatus PlaybackStatus
Gets or sets the playback status of the media.
public : MediaPlaybackStatus PlaybackStatus { get; set; }public MediaPlaybackStatus PlaybackStatus { get; set; }Public ReadWrite Property PlaybackStatus As MediaPlaybackStatus// You can use this property in JavaScript.
The playback status.
ShuffleEnabled ShuffleEnabled ShuffleEnabled ShuffleEnabled
Gets or sets a value representing the current shuffle state of the SystemMediaTransportControls.
public : PlatForm::Boolean ShuffleEnabled { get; set; }public bool ShuffleEnabled { get; set; }Public ReadWrite Property ShuffleEnabled As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the SystemMediaTransportControls have shuffle enabled; otherwise, false.
SoundLevel SoundLevel SoundLevel SoundLevel
Gets the sound level of the media for the capture and render streams.
public : SoundLevel SoundLevel { get; }public SoundLevel SoundLevel { get; }Public ReadOnly Property SoundLevel As SoundLevel// You can use this property in JavaScript.
The sound level.
Remarks
Music and media capture apps should monitor the SoundLevel to determine whether the audio streams on the app have been Muted. For apps using the MediaCapture object, capture will be automatically stopped when the capture streams of the app are muted. Capture is not re-started automatically when the audio streams are unmuted, so the SoundLevel changed notification can be used to restart capture. Use the PropertyChanged event to determine when the SoundLevel property changes.
Methods
GetForCurrentView() GetForCurrentView() GetForCurrentView() GetForCurrentView()
The system transport controls for the current view.
public : static SystemMediaTransportControls GetForCurrentView()public static SystemMediaTransportControls GetForCurrentView()Public Static Function GetForCurrentView() As SystemMediaTransportControls// You can use this method in JavaScript.
The system transport controls for the current view.
UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties) UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties) UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties) UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties)
Updates the SystemMediaTransportControls timeline properties with the values in the provided object.
public : void UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties timelineProperties)public void UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties timelineProperties)Public Function UpdateTimelineProperties(timelineProperties As SystemMediaTransportControlsTimelineProperties) As void// You can use this method in JavaScript.
- timelineProperties
- SystemMediaTransportControlsTimelineProperties SystemMediaTransportControlsTimelineProperties SystemMediaTransportControlsTimelineProperties SystemMediaTransportControlsTimelineProperties
The object representing the new timeline property values.
Events
AutoRepeatModeChangeRequested AutoRepeatModeChangeRequested AutoRepeatModeChangeRequested AutoRepeatModeChangeRequested
Occurs when the user modifies the SystemMediaTransportControls auto-repeat mode.
public : event TypedEventHandler AutoRepeatModeChangeRequested<SystemMediaTransportControls, AutoRepeatModeChangeRequestedEventArgs>public event TypedEventHandler AutoRepeatModeChangeRequested<SystemMediaTransportControls, AutoRepeatModeChangeRequestedEventArgs>Public Event AutoRepeatModeChangeRequested<SystemMediaTransportControls, AutoRepeatModeChangeRequestedEventArgs>// You can use this event in JavaScript.
Remarks
Registering for this event causes an app to be notified when the SystemMediaTransportControls auto-repeat mode changes. An app can change its auto-repeat behavior based on the request or ignore the request and update the SystemMediaTransportControls by setting the AutoRepeatMode property to a value that reflects the app's actual auto-repeat state.
ButtonPressed ButtonPressed ButtonPressed ButtonPressed
Occurs when a button is pressed on the SystemMediaTransportControls.
public : event TypedEventHandler ButtonPressed<SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs>public event TypedEventHandler ButtonPressed<SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs>Public Event ButtonPressed<SystemMediaTransportControls, SystemMediaTransportControlsButtonPressedEventArgs>// You can use this event in JavaScript.
Remarks
Starting with Windows 10, version 1607, UWP apps that use the MediaPlayer class or AudioGraph class to play media are automatically integrated with the SMTC by default. For some scenarios, you may want to manually control the SMTC. In this case, you should ButtonPressed event to be notified that the user has pressed one of the SMTC buttons. For how-to guidance on manually controlling the SMTC, see Manual control of the System Media Transport Controls.
- See Also
PlaybackPositionChangeRequested PlaybackPositionChangeRequested PlaybackPositionChangeRequested PlaybackPositionChangeRequested
Occurs when the user modifies the playback position of the SystemMediaTransportControls.
public : event TypedEventHandler PlaybackPositionChangeRequested<SystemMediaTransportControls, PlaybackPositionChangeRequestedEventArgs>public event TypedEventHandler PlaybackPositionChangeRequested<SystemMediaTransportControls, PlaybackPositionChangeRequestedEventArgs>Public Event PlaybackPositionChangeRequested<SystemMediaTransportControls, PlaybackPositionChangeRequestedEventArgs>// You can use this event in JavaScript.
Remarks
Registering for this event causes an app to be notified when the SystemMediaTransportControls playback position changes. An app can change its auto-repeat behavior based on the request or ignore the request and update the SystemMediaTransportControls by populating a SystemMediaTransportControlsTimelineProperties object with values indicating the actual playback position and calling SystemMediaTransportControls::UpdateTimelineProperties.
PlaybackRateChangeRequested PlaybackRateChangeRequested PlaybackRateChangeRequested PlaybackRateChangeRequested
Occurs when the user modifies the SystemMediaTransportControls playback rate.
public : event TypedEventHandler PlaybackRateChangeRequested<SystemMediaTransportControls, PlaybackRateChangeRequestedEventArgs>public event TypedEventHandler PlaybackRateChangeRequested<SystemMediaTransportControls, PlaybackRateChangeRequestedEventArgs>Public Event PlaybackRateChangeRequested<SystemMediaTransportControls, PlaybackRateChangeRequestedEventArgs>// You can use this event in JavaScript.
Remarks
Registering for this event causes an app to be notified when the SystemMediaTransportControls playback rate changes. An app can change its playback rate based on the request or ignore the request and update the SystemMediaTransportControls by setting the PlaybackRate property to a value that reflects the app's actual playback rate.
PropertyChanged PropertyChanged PropertyChanged PropertyChanged
Occurs when a property on the SystemMediaTransportControls has changed.
public : event TypedEventHandler PropertyChanged<SystemMediaTransportControls, SystemMediaTransportControlsPropertyChangedEventArgs>public event TypedEventHandler PropertyChanged<SystemMediaTransportControls, SystemMediaTransportControlsPropertyChangedEventArgs>Public Event PropertyChanged<SystemMediaTransportControls, SystemMediaTransportControlsPropertyChangedEventArgs>// You can use this event in JavaScript.
Remarks
Use the Property value of the event SystemMediaTransportControlsPropertyChangedEventArgs to determine which property has changed.
ShuffleEnabledChangeRequested ShuffleEnabledChangeRequested ShuffleEnabledChangeRequested ShuffleEnabledChangeRequested
Occurs when the user modifies the SystemMediaTransportControls shuffle state.
public : event TypedEventHandler ShuffleEnabledChangeRequested<SystemMediaTransportControls, ShuffleEnabledChangeRequestedEventArgs>public event TypedEventHandler ShuffleEnabledChangeRequested<SystemMediaTransportControls, ShuffleEnabledChangeRequestedEventArgs>Public Event ShuffleEnabledChangeRequested<SystemMediaTransportControls, ShuffleEnabledChangeRequestedEventArgs>// You can use this event in JavaScript.
Remarks
Registering for this event causes an app to be notified when the SystemMediaTransportControls shuffle state changes. An app can change its shuffle state based on the request or ignore the request and update the SystemMediaTransportControls by setting the ShuffleEnabled property to a value that reflects the app's actual shuffle state.