Windows Phone 7 : How to play media

Windows Phone 7 can flawlessly play media files. There are list of supported codec which Windows Phone 7 can play. However below is the simple XAML which can enable the media loading.

<MediaElement x:Name="myVideo" AutoPlay="True" Source="Kalimba.mp3" />

You can also control various behaviors through your code. 


1. Now while using the Windows Phone 7 Emulator you will not be able to play video file. But the audio file is easy to play as mentioned above.

2. Also you need to ensure if you are using local media file the Build Type of that media should be Content