BackgroundAudioPlayer Class

BackgroundAudioPlayer Class

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Provides background access to audio playback functionality such as play, pause, fast-forward, and rewind.


Namespace:  Microsoft.Phone.BackgroundAudio
Assembly:  Microsoft.Phone (in Microsoft.Phone.dll)

public sealed class BackgroundAudioPlayer

The BackgroundAudioPlayer type exposes the following members.

Public propertyBufferingProgressThe amount of buffering that is completed for the media content.
Public propertyCanPauseGets a value indicating whether the media can be paused when the Pause() method is called.
Public propertyCanSeekGets a value indicating whether the media can be repositioned by setting the value of the Position property.
Public propertyErrorThe last error, if any, to have occurred while playing the current AudioTrack.
Public propertyStatic memberInstanceReturns an instance of the BackgroundAudioPlayer. If this application already has background audio playback resources allocated, the BackgroundAudioPlayer returned will contain references to those resources.
Public propertyPlayerStateGets the current PlayState of the player.
Public propertyPositionGets or sets the current position within the current Track.
Public propertyTrackGets or sets the current track for this application, whether the application is currently playing or not.
Public propertyVolumeThe media's volume represented on a linear scale between 0 and 1. The default is 0.85.

Public methodCloseCloses the player and removes all resources reserved for it, including the current AudioTrack.
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Public methodFastForwardStarts fast-forwarding through the current AudioTrack.
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodPausePauses playback at the current position.
Public methodPlayPlays or resumes the current AudioTrack at its current position.
Public methodRewindStarts rewinding through the current AudioTrack.
Public methodSkipNextSkips to the next track.
Public methodSkipPreviousSkips to the previous track.
Public methodStopStops and resets media to be played from the beginning.
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)

Public eventPlayStateChangedOccurs when the PlayState changes.

This is the main class for performing playback options and registering for PlayStateChanged events independent of which playlist is currently playing. It is used by both the foreground application and the background agent. Rather than relying on events, the background agent relies on callbacks.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Windows Phone

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

© 2017 Microsoft