I am using MediaPlayer class to play audio with the background audio capability enabled in the manifest. I am using my own play/pause button to control the playback.
Everything works fine except when I navigate away from the page and come back, I lose the current playback progress of the background audio being played which is being displayed on a TextBlock.
How do I connect back to that background audio?? I can't seem to find a solution.
Thanks
Thanks Johnny and Vimal for the correct pointers. I am using the class below that always returns a single instance...it works!
public class PlaybackService
{
private static PlaybackService instance;
public static PlaybackService Instance
{
get
{
if (instance == null)
instance = new PlaybackService();
return instance;
}
}
public MediaPlayer Player { get; private set; }
public PlaybackService()
{
// Create the player instance
Player = new MediaPlayer();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.