How to cyclically play video from one position to another using MediaElement in WPF
-
I am using WPF mediaelement for playing video. What I need is to cyclically play a video form x position to y position. Is there any way to achieve this without using timer and polling Position property?
-
Answer:
You don't have to poll the position property, but you can set it to begin play at start position, start a timer and set the interval for the time difference. TimeSpan startTime = TimeSpan.FromSeconds(45); TImeSpan endTime = TimeSpan.FromSeconds(55); int timeDifference = endTime.TotalSeconds - startTime.TotalSeconds; mediaElement.Position = startTime; Timer t = new Timer() { Interval = timeDifference * 1000, AutoReset = true }; t.Tick += (sender, e) { mediaElement.Position = startTime }; t.Start();
Peter17 at Stack Overflow Visit the source
Related Q & A:
- how to play video in wpf using mediaElement?Best solution by Stack Overflow
- How to pass an ArrayList from one class to another?Best solution by stackoverflow.com
- How can I move bookmarks from one email to another one?Best solution by pcworld.com
- How do you transfer info from one account to another in Yahoo?Best solution by Yahoo! Answers
- How can I transfer contacts from one phone to another?Best solution by eHow old
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.