How to make you own music player and play music online

visual-studio-2013

Hey guys I’m back with a new tutorial. So what this is called. We let’s say we are building our own music player for Windows Phone that will fetch music directly from internet. In other word you can say you will be listening to songs directly from the internet. So lets begin with it.

Working on Creating a Music Player

  • So first of all create a Windows Phone Silverlight application.
  • On mainpage.xaml create a button and name it what you want to name it. In my I have name play and they button Content Name is Play Me.

Shot 1

  • Make sure you create an event handler for the above mentioned button.
  • So now when you have created an event handler press F12 and go to its definition. There write the following piece of code and there you go.

BackgroundAudioPlayer.Instance.Track = new AudioTrack(new Uri
(“http://i2.pinger.pl/paud1041/5ee6977200014a9248522a89/n2SYd6SnfpCgfGWZmn2KnZujlIOgpm2Fin12npZrsJmfoGRmn6Wvp6BomH6jppyfm2Z6g6WAbaKYoaigpaeKp6B7nKKlgJh6”,
UriKind.RelativeOrAbsolute),”Pocketfull of Sunshine”, “Natasha Bedingfield”, “”, null, null,
EnabledPlayerControls.All);
BackgroundAudioPlayer.Instance.Play();

  • You have successfully created a Music Player that fetches music directly from the internet.
  • Well here are some things that have to discuss like what does EnablePlayerControls.All means exactly.
  • The main purpose of EnablePlayerControls is it enables all the controls at of music player when you debug the application. In this case we have put .All that means it will provide you all the control of music player.
  • If you just try to rewrite the statement again after EnablePlayerControls. You will see list of other controls that can be activated.

Shot 3

  • Moreover if I choose EnablePlayerControls.Pause it will only activate the pause button during the debug mode. No other control can be used when you are used .Pause option.
  • So use as much controls in you music player as you can and build a nice music player.

For people who are still facing problem, you can write to me in comments. Moreover Click Here to get Sample Solution.