DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Windows Phone tip of the day: MediaLibrary can be tested in the emulator with built-in songs

Windows Phone tip of the day: MediaLibrary can be tested in the emulator with built-in songs

Denzel D. user avatar by
Denzel D.
·
Apr. 20, 11 · Mobile Zone · Interview
Like (0)
Save
Tweet
7.55K Views

Join the DZone community and get the full member experience.

Join For Free

Not a lot of developers know this, but the default OS image that is shipped with the Windows Phone Emulator has built-in media content (other than images) - songs. There are three tracks available for testing purposes:

  • Another Melody Song (00:00:31.3930000) by Windows Phone Artist [Pop]
  • Melody Song (00:00:30.4640000) by Windows Phone Artist [Rock]
  • Rhythm Variation (00:00:15.3710000) by Windows Phone Artist [R&B]

To try these out, simly add a reference to Microsoft.Xna.Framework and use the snippet below:

FrameworkDispatcher.Update();
MediaLibrary lib = new MediaLibrary();

foreach (Song s in lib.Songs)
{
    Debug.WriteLine(s.Name + " " + s.Duration + " " + s.Artist);
}

The songs can be played by the static instance of MediaPlayer (also tied to the Xna stack):

MediaPlayer.Play(lib.Songs[0]);

One of the advantages of having actual musical content in the emulator is the possibility to control it like actual device content.

Due to default platform restrictions, playlists cannot be created on the fly. SongCollection instances (required by MediaPlayer to play batches of songs) are also not open, so each song will have to be passed separately in order to be played.

For reference purposes, the media files are located here:

  • My Documents\Zune\Content\0100\00\15.wma (Another Melody Song)
  • My Documents\Zune\Content\0100\00\11.wma (Melody Song)
  • My Documents\Zune\Content\0100\00\17.wma (Rhythm Variation) 
This is in case you have access to an unlocked image and there is a file manager installed.
Windows Phone

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Why Is Software Integration Important for Business?
  • Adding Authentication to a Web Application with Auth0, React, and JWT
  • Applying Kappa Architecture to Make Data Available Where It Matters
  • An Overview of Key Components of a Data Pipeline

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo