Dela via


SystemMediaTransportControls Class

Definition

Represents an object that enables integration with the system media transport controls and support for media commands.

public ref class SystemMediaTransportControls sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
class SystemMediaTransportControls final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.MTA)]
public sealed class SystemMediaTransportControls
Public NotInheritable Class SystemMediaTransportControls
Inheritance
Object Platform::Object IInspectable SystemMediaTransportControls
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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 media application developers integrate with the built-in system UI to display media metadata such as artist, album title, or chapter title. The system transport control also allows a user to control the playback of a media app using the built-in system UI, such as pausing playback and skipping forward and backward in a playlist.

System Media Transtport Controls

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

Gets or sets a value representing the current auto-repeat mode of the SystemMediaTransportControls.

DisplayUpdater

Gets the display updater for the SystemMediaTransportControls which enable updating the information displayed about the currently playing song.

IsChannelDownEnabled

Gets or sets a value that specifies if the channel down button is supported.

IsChannelUpEnabled

Gets or sets a value that specifies if the channel up button is supported.

IsEnabled

Enables and disables the system media transport controls for the app.

IsFastForwardEnabled

Gets or sets a value that specifies if the fast forward button is supported.

IsNextEnabled

Gets or sets a value that specifies if the next button is supported.

IsPauseEnabled

Gets or sets a value that specifies if the pause button is supported.true if the pause button is supported; otherwise, false.

IsPlayEnabled

Gets or sets a value that specifies if the play button is supported.

IsPreviousEnabled

Gets or sets a value that specifies if the previous button is supported.

IsRecordEnabled

Gets or sets a value that specifies if the record button is supported.true if the record button is supported; otherwise, false.

IsRewindEnabled

Gets or sets a value that specifies if the rewind button is supported.

IsStopEnabled

Gets or sets a value that specifies if the stop button is supported.

PlaybackRate

Gets or sets the playback rate of the SystemMediaTransportControls.

PlaybackStatus

Gets or sets the playback status of the media.

ShuffleEnabled

Gets or sets a value representing the current shuffle state of the SystemMediaTransportControls.

SoundLevel

Gets the sound level of the media for the capture and render streams.

Methods

GetForCurrentView()

The system media transport controls for the current view.

UpdateTimelineProperties(SystemMediaTransportControlsTimelineProperties)

Updates the SystemMediaTransportControls timeline properties with the values in the provided object.

Events

AutoRepeatModeChangeRequested

Occurs when the user modifies the SystemMediaTransportControls auto-repeat mode.

ButtonPressed

Occurs when a button is pressed on the SystemMediaTransportControls.

PlaybackPositionChangeRequested

Occurs when the user modifies the playback position of the SystemMediaTransportControls.

PlaybackRateChangeRequested

Occurs when the user modifies the SystemMediaTransportControls playback rate.

PropertyChanged

Occurs when a property on the SystemMediaTransportControls has changed.

ShuffleEnabledChangeRequested

Occurs when the user modifies the SystemMediaTransportControls shuffle state.

Applies to

See also