The following compose the three main classes used for background audio, which are explored in this chapter:
BackgroundAudioPlayer
AudioPlayerAgent
AudioStreamingAgent
BackgroundAudioPlayer
is a class that allows you to specify an audio file for playback and to carry out playback activities such as play, pause, fast-forward, and rewind. BackgroundAudioPlayer
allows you to specify track information, such as the title of the track and its location. The built-in playback capabilities of the BackgroundAudioPlayer
allow audio files to be streamed from either a remote server, or locally, from isolated storage.
Out of the box, BackgroundAudioPlayer
supports playback formats such as MP3, WMA, and WAV. For a complete list of supported audio formats, see http://bit.ly/pnnT8C. BackgroundAudioPlayer
offers little in the way of coordinating the playback of a list of audio tracks. This is the task of the AudioPlayerAgent
.
AudioPlayerAgent
classes are specialized agents used to retrieve audio files and coordinate the playback of background audio via the BackgroundAudioPlayer
. AudioPlayerAgent
provides a number of method callbacks that are automatically called by the OS based on user actions.
An AudioStreamingAgent
can be used to customize how audio data is procured by your BackgroundAudioPlayer
. You can supplant the BackgroundAudioPlayer
’s media sourcing capabilities by providing your own logic to download and decode an audio file.
3.142.252.199