4 second jump MediaElement.Position

2 posts, 0 answers
  1. Ralph
    Ralph avatar
    3 posts
    Member since:
    Oct 2007

    Posted 04 Jan 2010 Link to this post

    Hi,

    The situation is as follows:
    I'm using Windows Media Services 9 to stream my video and I use the latest Silverlight Mediaplayer RadControl from Telerik. At the moment I'm testing it all local host and the streaming server is in the same network, so problems with bandwidth and buffering etc is not the cause. I want to skip my video for one second so I've added a button with the following code behind:

    private void StartFragmentRechts_Click(object sender, System.Windows.RoutedEventArgs e) 
            { 
                MediaPlayer.MediaElement.Pause(); 
                TimeSpan huidigetijd; 
                if (TimeSpan.TryParse(StartTijd.Text, out huidigetijd)) 
                { 
                    StartTijd.Text = huidigetijd.Add(new TimeSpan(0, 0, 0, 1, 0)).ToString(); 
                    MediaPlayer.MediaElement.Position = huidigetijd.Add(new TimeSpan(0, 0, 0, 1, 0)); 
                } 
            } 

    Occurring to the following thread: Forward, Rewind Buttons & Methods, this code should do the trick. As you can see, I first pause the video, and I can see in my textbox (StartTijd) that the time is being raised by one second. Also the video that's being showed in the MediaElement skips a second. Unfortunately, when I press play to continue my video, MediaElement.Position jumps with 4 seconds.

    I've tried several solutions and all didn't solved the problem:

    1.  Replaced "huidigetijd" with MediaPlayer.MediaElement.Position.
    2.  Removed MediaPlayer.MediaElement.Pause();
    3.  I've searched the internet but couldn't find anything about this strange 4 second jump.

    I've been struggling for hours now with this problem I've encountered, please help me out.


    With kind regards,

    Michiel

  2. Ralph
    Ralph avatar
    3 posts
    Member since:
    Oct 2007

    Posted 05 Jan 2010 Link to this post

    Meanwhile I tried to solve the problem.
    Here is what I did:

    1. Reproduce the problem with the standard MediaElement which is included in Expression Blend 3. Unfortunately the problem still occurs.
    2. Instead of using a mms adress as source for my MediaElement, I used a video on my desktop as source. After doing this, the MediaElement position doesn't jump with 4 seconds anymore, and my application works like a charm.

    So I think the problem is caused by the communication with Windows Media Services 9.


    With kind regards,

    Michiel
  3. DevCraft banner
Back to Top