Question

I want to play a song which is stored in Music+video Hub in AudioPlaybackAgent.

I can get songs by this way:

MediaLibrary mediaLibrary = new MediaLibrary();
var songs = mediaLibrary.Songs;

but this songs are of type Song and BackgroundAudioPlayer accepts sounds of type AudioTrack:

BackgroundAudioPlayer.Instance.Track = ..

Question: how can I play a song from music hub in AudioPlaybackAgent?

Was it helpful?

Solution

From here: Windows phone 8 on emulator - why can't I play audio files? see the answer number 3 (Author:Frederik Winstrup Johansen). He also added a good sample about playing AudioTracks

The BackgroundAudioPlayer can play files only from isolated storage or from a remote URI, that is why you can here anything!

If you have your file as resources in your app, you must first copy them to the isolated store, and then make a reference to the file in the isolated store to your BackgroundAudioPlayer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top