Revision as of 08:16, 30 November 2012 by hamishwillee (Talk | contribs)

How to play a streamed mp3 on Windows Phone 7

From Nokia Developer Wiki
Jump to: navigation, search
WP Metro Icon Multimedia.png
WP Metro Icon XNA.png
SignpostIcon WP7 70px.png
Article Metadata
Tested with
SDK: Windows Phone 7.1
Devices(s): Nokia Lumia 800
Platform(s): Windows Phone 7.5
Windows Phone 7.5
Created: sreerajvr (06 Apr 2012)
Last edited: hamishwillee (30 Nov 2012)


How To

  1. To start creating a new Windows Phone Application, start Microsoft Visual studio then create a new Project and select Windows Phone Application Template
  2. In Visual Studio Solution Explorer, right-click References under your project and click Add Reference
  3. In the Add Reference dialog box, click the .NET tab. Click 'Microsoft.Xna.Framework' entry to select it, and click OK.
  4. In the Solution Explorer panel, you will see the 'Microsoft.Xna.Framework' listed in the References folder of your project.
  5. In the source file that you want to use to program on XNA MediaPlayer classes, add the following code in the using section of your code.

using Microsoft.Xna.Framework.Media;


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Xna.Framework.Media;//for getting MediaPlayer
namespace MP3Playback
public partial class MainPage : PhoneApplicationPage
string url = "http://traffic.libsyn.com/slashfilmcast/Davidmichod.mp3";//your url link
// Constructor
public MainPage()
Song track = Song.FromUri("Sample Song", new Uri(url));
69 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.