.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Articles >> Windows 7 >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Add Media player in Windows 7 Mobile Application

Posted By:Dhananjay Kumar       Posted Date: April 10, 2010    Points: 25    Category: Windows 7    URL: http://www.dotnetspark.com  

Add Media player in Windows 7 Mobile. This article will give step to step illustration of creating a simple media application for Windows 7 mobile.


This article will give step to step illustration of creating a simple media application for Windows 7 mobile.

Step 1

Create a new Windows Phone Application. From Silverlight for Windows Phone tab select Windows Phone Application project type.


Step 2

Design page.
  1. Divide content grid in two rows
  2. In first row put a media element control
  3. In second row put a button.




Step 3

Right click on project and add an existing .wmv in project. I am adding a.wmv file here.

Step 4

Now in code behind just play the 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;

namespace PhotoApplication
    public partial class MainPage : PhoneApplicationPage
        public MainPage()

            SupportedOrientations = SupportedPageOrientation.Portrait | SupportedPageOrientation.Landscape;
            btnPlay.Click += new RoutedEventHandler(btnPlay_Click);

        void btnPlay_Click(object sender, RoutedEventArgs e)
            mediactrl.Source = new Uri("a.wmv", UriKind.Relative);


Press F5 to get the output.


I hope this article was useful. Thanks for reading. Happy coding.
 Subscribe to Articles


Further Readings:

Author: Ananthi Devi         Company URL: http://www.dotnetspark.com
Posted Date: October 15, 2010

Mr.Dhananjay Kumar,

Very nice .but on running this program the video files does not play properly .It show as image .Why this ? Can u help me out to play it as video file ?Can i use swf file instead of wmv file ?
Can i use timer control in windows 7 mobile application?

Thankyou ,

With Regards ,
K.Ananthi Kasivel

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend