Reputation: 1660
I'm currently working on an radio app for WP7 Mango and I want to disable the next and the previous track buttons in the UVC like last.fm did in their app, but I can't figure out how.
Can someone help me with this?
Upvotes: 2
Views: 1151
Reputation: 9604
You can select which controls are active in the UVC when you create the track to play in your agent (i.e. from the code which handles the TrackEnded event in the Background Audio Agent).
For example:
EnabledPlayerControls controls = EnabledPlayerControls.Pause |
EnabledPlayerControls.Rewind |
EnabledPlayerControls.FastForward;
AudioTrack track = new AudioTrack(
trackUri,
trackTitle,
trackBy,
trackAlbum,
trackAlbumArtUri,
trackTag,
controls);
...
return track
This will allow you to be able to make the agent skip tracks when your application wants, but Skip won't work by tapping the buttons on the UVC.
(In this example if the user taps and holds the fast-forward and rewind buttons in the UVC, the track will still fast-forward/rewind).
Upvotes: 3
Reputation: 26345
If you don't supply a entire playlist, but only a single MediaHistory
, the Previous/Next buttons should be automatically disabled.
The same should apply to the AudioStreamingAgent
. If you wish to disable the ability to use the buttons, handle the BackgroundAudioPlayer.Instance.PlayStateChanged
event, see WP7 Mango: How to handle skip next/previous from UVC outside of the Audio Playback Agent class library? for details.
Post some code, if you want more detailed help.
Upvotes: 0