Just a simple tip, what I just discovered recently – you probably know that when you play any music file or tune FM radio station on Windows Phone 8, this volume bar controls appear, when you press Volume Up/Down buttons. But even when you stop the music playback, there is no simple way, how to remove this media playback bar.
But since there is already at least one app, that can remove this Volume bar, I was wondering, how to do it in C# as well.
After couple of minutes tinkering with the MediaPlayer class I’ve discovered the solution, and it’s pretty easy:
- You need to add into your app empty file with .wma extension and set the build action as “Content”, for instance “empty.wma” into the app root folder.
- To stop the media playback and remove the media player just create dummy Song object and try to play it like this:
Song s = Song.FromUri("empty", new Uri("empty.wma", UriKind.Relative)); MediaPlayer.Play(s);
And that’s all 🙂
Note I’ve tested this only on Windows Phone 8 device with GDR3 update, but I guess it will work on WP7.5 as well.