Using a MediaStreamSource to Play Back an Assembly Resource

The built-in streaming and decoding system on the phone only supports playback of local audio files when they are located in isolated storage. This section looks at enabling the direct playback of audio files located within an app assembly.

The code for this section resides in the AssemblyAudioStreamingAgent class of the WPUnleashed.BackgroundAudio project in the downloadable sample code. AssemblyAudioStreamingAgent is a subclass of AudioStreamingAgent and overrides the base type’s OnBeginStreaming method (see Listing 34.2). The custom IsolatedStorageUtility is used to retrieve the byte stream for an audio file, whose location is specified by the AudioTrack.Tag property. An Mp3MediaStreamSource ...

Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.