Jump to content



Photo

c# BackgroundAudioPlayer Win Phone 8

c# backgroundaudioplayer windows phone 8

  • Please log in to reply
4 replies to this topic

#1 James Rose

James Rose

    Software Developer

  • Tech Issues Solved: 1
  • Joined: 20-January 04
  • Location: New York City

Posted 15 August 2013 - 19:02

Hello gang,

 

I'm making a phone app for a friend's broadcast and I need to use the BackgroundAudioPlayer.  I have a sample from MS and this code works, but in my own phone app nothing happens.  Any clues?

                AudioTrack GABAudio = new AudioTrack(new Uri("http://www.alexbennett.com/podcast/gab81413.mp3", UriKind.Absolute), "Great American Podcast", null, null, null, "1", EnabledPlayerControls.All);
                BackgroundAudioPlayer.Instance.Track = GABAudio; 
                BackgroundAudioPlayer.Instance.Play();



#2 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 15 August 2013 - 19:19

What do the properties of the BackgroundAudioPlayer indicate, especially Error, PlayerState, Position and Volume?



#3 OP James Rose

James Rose

    Software Developer

  • Tech Issues Solved: 1
  • Joined: 20-January 04
  • Location: New York City

Posted 15 August 2013 - 23:19

No errors, just no sound.  I did add a line of code about Volume code (oops) and checked the playstate when I click another button and it comes back "unknown"

 

Thanks kindly for the response



#4 Andre S.

Andre S.

    Asik

  • Tech Issues Solved: 14
  • Joined: 26-October 05

Posted 16 August 2013 - 03:48

Unknown: The current PlayState is indeterminate. For example, a new AudioTrack has been set, but playback has not been initiated. 

http://msdn.microsof...(v=vs.105).aspx

Looks like Play() isn't successfully initiating playback for some reason. Any exception thrown? Can you try with a local mp3 instead of something on the web? Just throwing random suggestions out there, I have no experience whatsoever with Windows Phone development. :p



#5 OP James Rose

James Rose

    Software Developer

  • Tech Issues Solved: 1
  • Joined: 20-January 04
  • Location: New York City

Posted 19 August 2013 - 17:13

Thanks Asik,

 

I found the answer here:  http://msdn.microsof...e/hh781030.aspx  I didn't include AudioPlayerAgent.

 

James