As a part of work I was gathering some information regarding playing media contents in Windows Phone 7 (WP7) emulator. I thought it is simple as similar with WM series devices. Though the code snippet for playing is not more than 5-7 lines but faced little problem while transferring media file from my hard drive to Emulator & playing the same.
In WM series devices we are transferring a file (manually) from desktop to Emulator either by using Active Sync or by using WMDC (Windows Mobile Device Center).
In WM series devices we are transferring a file (manually) from desktop to Emulator either by using Active Sync or by using WMDC (Windows Mobile Device Center).
However in WP7 it is totally different. Here we need to install the WP7 Isolated Storage Explorer. It is local storage for WP7 applications & all I/O operations need to use it. You can download it from HERE . Once you downloaded then follow the instructions .
Thanks to Microsoft Corporation for providing wonderful contents
Now its time for using MediaPlayerLauncher to play your media file.
Code snippet for playing media is as below :
MediaPlayerLauncher objMPlayerLauncher = new MediaPlayerLauncher();
objMPlayerLauncher.Media = new Uri("gags.wmv", UriKind.Relative);
//replace "gags" with your file path.
objMPlayerLauncher.Location = MediaLocationType.Data;
objMPlayerLauncher.Controls = MediaPlaybackControls.Pause| MediaPlaybackControls.Stop;
objMPlayerLauncher.Show();
Please checkout this screen shot :
Hope this will helps.