AudioPlayerAgent Class

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

An implementation of a BackgroundAgent specifically designed to play audio in the background.

Inheritance Hierarchy

System..::.Object
Microsoft.Phone..::.BackgroundAgent
Microsoft.Phone.BackgroundAudio..::.AudioPlayerAgent

Namespace: Microsoft.Phone.BackgroundAudio
Assembly: Microsoft.Phone (in Microsoft.Phone.dll)
XMLNS for XAML: Not mapped to an xmlns.

Syntax

Public Class AudioPlayerAgent _
    Inherits BackgroundAgent
public class AudioPlayerAgent : BackgroundAgent
<AudioPlayerAgent .../>

The AudioPlayerAgent type exposes the following members.

Constructors

Name Description
AudioPlayerAgent Creates a new instance of AudioPlayerAgent.

Top

Methods

Name Description
Abort Informs the operating system that the agent is unable to perform its intended task and that it should not be launched again until the foreground application mitigates the blocking issue and reenables the agent. (Inherited from BackgroundAgent.)
Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
GetType Gets the Type of the current instance. (Inherited from Object.)
MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
NotifyComplete Informs the operating system that the agent has completed its intended task for the current invocation of the agent. (Inherited from BackgroundAgent.)
NotifyCompleteWithResult Informs the operating system that the agent has completed its intended task for the current invocation of the agent. Call this method after successfully handling an invocation with a result. (Inherited from BackgroundAgent.)
OnCancel Called by the operating system to alert a background agent that it is going to be put into a dormant state or terminated. (Inherited from BackgroundAgent.)
OnError Called when there is an error with playback, such as an audio track not downloading correctly.
OnPlayStateChanged Called when the play state changes, except for the error state.
OnUserAction Called when the user requests an action using some application-provided UI or the Universal Volume Control (UVC) and the application has requested notification of the action.
ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

The AudioPlayerAgent is a base class that you can extend to create your own background audio player agent. The only method that you must override is OnUserAction(BackgroundAudioPlayer, AudioTrack, UserAction, Object).

Warning

This API is not supported for Silverlight 8.1 apps.

Version Information

Windows Phone OS

Supported in: 8.1, 8.0, 7.1

Platforms

Windows Phone

Thread Safety

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

See Also

Reference

Microsoft.Phone.BackgroundAudio Namespace

Other Resources

Background audio overview for Windows Phone 8

How to play background audio for Windows Phone 8