Seek Bar For Media Element In WPF

No.of Views1380
Bookmarked0 times
Downloads 
Votes0
By  dpatra   On  30 Sep 2010 09:09:58
Tag : WPF , Utilities
In the previous article about “Screenshot From Media Element in WPF”, we saw how to capture screenshot from the media (Video) playing in Media Element. In this article we will see how we can add a Seek Bar that will seek to the desired position.
emailbookmarkadd commentsprint

Images in this article missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at info@codegain.com

 

Introduction

In the previous article about “Screenshot From Media Element in WPF”, we saw how to capture screenshot from the media (Video) playing in Media Element. In this article we will see how we can add a Seek Bar that will seek to the desired position.

Creating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as MediaSampleWPF. 

Image Loading

I am just extending the feature that we experienced in our last application titled “Media Element In WPF” and “Screenshot From Media Element in WPF”.
We will just add a Slider control that will seek to the desired position of the Media Element. See following figure. 

Image Loading

First in the constructor of the Application add a DispatcherTimer object as follows: 

Image Loading

Then in the MediaElement’s MediaOpened event add the following code:

Image Loading

Now Add two events to the slider control, events are Thumb.DragStarted and Thumb.DragCompleted in XAML behind. 

Image Loading

In the above event handlers add the following code: 

Image Loading

That’s it we are ready to run our application. Open the media and seek to the desired position. 

Image Loading

Hope the article helps.

 
Sign Up to vote for this article
 
About Author
 
dpatra
Occupation-Not Provided
Company-Not Provided
Member Type-Expert
Location-Not Provided
Joined date-13 Jul 2009
Home Page-Not Provided
Blog Page-Not Provided
 
 
Other popularSectionarticles
Comments
There is no comments for this articles.
Leave a Reply
Title:
Display Name:
Email:
(not display in page for the security purphase)
Website:
Message:
Please refresh your screen using Ctrl+F5
If you can't read this number refresh your screen
Please input the anti-spam code that you can read in the image.
^ Scroll to Top