Jaa


BackgroundMediaPlayer Class

Definition

Provides access to the media player while it is running in the background.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

public ref class BackgroundMediaPlayer abstract 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.Both)]
class BackgroundMediaPlayer final
/// [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.Both)]
/// [Windows.Foundation.Metadata.Deprecated("Use MediaPlayer instead of BackgroundMediaPlayer.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
class BackgroundMediaPlayer 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.Both)]
public static class BackgroundMediaPlayer
[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.Both)]
[Windows.Foundation.Metadata.Deprecated("Use MediaPlayer instead of BackgroundMediaPlayer.  For more info, see MSDN.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 262144, "Windows.Foundation.UniversalApiContract")]
public static class BackgroundMediaPlayer
Public Class BackgroundMediaPlayer
Inheritance
Object Platform::Object IInspectable BackgroundMediaPlayer
Attributes

Windows requirements

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

Remarks

Starting with Windows 10, version 1607, apps should use the MediaPlayer for media playback. The MediaPlayer object allows you to play media in the background seamlessly, using a single process. For information on using MediaPlayer, see Play audio and video with MediaPlayer. For information on playing media in the background with MediaPlayer, see Play media in the background. For information on the legacy, two-process background playback model, which is still supported for backwards compatibility, see Legacy background media playback.

Properties

Current

Gets the current instance of the background media player.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

Methods

IsMediaPlaying()

Returns a Boolean value indicating if other media is currently playing on the device.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

SendMessageToBackground(ValueSet)

Sends a message to the background media player.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

SendMessageToForeground(ValueSet)

Sends a message to the foreground task.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

Shutdown()

Shuts down the current background media player.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

Events

MessageReceivedFromBackground

Occurs when a message is received from the background task.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

MessageReceivedFromForeground

Occurs when a message is received from the foreground task.

Note

Starting with Windows, version 1703, BackgroundMediaPlayer is deprecated and may not be available in future versions of Windows. Use the MediaPlayer class instead. For more information, see Play media in the background.

Applies to

See also