Share via


AudioTrack Class

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

Represents a single track of audio.

Inheritance Hierarchy

System..::.Object
  Microsoft.Phone.BackgroundAudio..::.AudioTrack

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

Syntax

Public Class AudioTrack _
    Implements IEditableObject
public class AudioTrack : IEditableObject
<AudioTrack .../>

The AudioTrack type exposes the following members.

Constructors

  Name Description
AudioTrack()()() Creates a new instance of the AudioTrack class.
AudioTrack(Uri, String, String, String, Uri) Creates and initializes a new instance of the AudioTrack class.
AudioTrack(Uri, String, String, String, Uri, String, EnabledPlayerControls) Creates and initializes a new instance of the AudioTrack class.

Top

Properties

  Name Description
Album Text to display as the track’s album.
AlbumArt The path to the album art for the track.
Artist Text to display as the track's artist.
Duration The length of the track.
PlayerControls Determines which playback controls are enabled in the system user interface.
Source The URI path to the track.
Tag An arbitrary string associated with this track, used to store application-specific state.
Title Text to display as the track's title.

Top

Methods

  Name Description
BeginEdit Sets the track object into edit mode.
CancelEdit This method is not implemented for AudioTrack objects and always throws a NotSupportedException.
EndEdit Ends an edit operation, saving all property changes to the underlying store.
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.)
ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

This class makes use of IEditableObject to enable batching of property change requests. For example, when a track changes, the application may want to update several pieces of metadata all at once, such as track name, artist, album, and so on.

Once the track has been created using one of the AudioTrack constructors, then the BeginEdit()()() and EndEdit()()() methods must be used to update the object.

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