1. On the menu bar, choose File and then New Project.
2.Choose Programming language as Visual C# in the templates list,
choose the Windows Phone and then choose Windows Phone App.
3.Name the project as MediaPlayer and specify the address of your folder.
4.In the design window of the page design as shown below.
1. First TextBlock Name is StackPanelTextBlock1 and the Text property is Media Player Application
2. Second TextBlock Name is StackPanelTextBlock2 and the Text property is Main Page
3. Media-Element name is medPalyer and the media source should be set in the solution explorer as follows.
Media->Source=/Assets/video1.wmv
Media->Source=/Assets/video1.wmv
Here, Video1.wmv is the video file to be played. Hence , you need to copy the video file and paste it in the assets folder present in the solution explorer.
4. An Ellipse is used and given the Name as ellPlay Brush-> Fill ->Tile Brush
ImageSource=/Assets/Media-Play.png (before doing this you
should save the file play.png into the Assets folder)
Stretch=Fill
5. The ButtonName is set as btnPause and Content property is set to pause
Follow the following steps for colour effect.
Brush ->BackGround ->Gradient Brush ->Yellow, Red
6. Another ButtonName is btnStop and the content property is set to stop.
Follow the following steps for colour effect.
Brush ->BackGround ->Gradient Brush ->Pink, Blue
7. Another Button Name is set to btnResume and Content property is set to
Resume. Follow the following steps for colour effect.
Brush ->BackGround->Gradient Brush-> Green, Yellow
8. Double click the buttons , corresponding MediaPalyer.xaml.cs window will be opened . Type the following code.
private void btnPause_Click(object sender, RoutedEventArgs e)
{
medPalyer.Pause();
}
private void btnStop_Click(object sender, RoutedEventArgs e)
{
medPalyer.Stop();
}
private void btnResume_Click(object sender, RoutedEventArgs e)
{
medPalyer.Play();
}
9. Select the ellipse control on the screen. In the properties windows
press events symbol and add play_tap event. Press Enter key. Then
play_tap() method is opened type the following code.
private void play_Tap(object sender,System.Windows. Input.GestureEventArgs e)
{
medPalyer.Play();
}
10.In the Solution Explorer Expand Properties tab and select WMAppManifest.xml. file. Then select Capabilities tab. In that check ID_CAP_MICROPHONE option.This setting need to be done to hear the sound of the video.
11. Run
the App and see the result.
No comments:
Post a Comment