MediaEnded, set starting frame, Position never updated

Nov 17, 2010 at 8:56 AM
Edited Nov 17, 2010 at 3:39 PM

i have a wmv and an mp4 that i'm playing with the MediaUriElement. when the video is done, the MediaEnded event fires, running the following:

player.MediaPosition = 10000000 / 2;                

i need to reset the player to a certain position, which it does, and it pauses there. however, when i start playback again, the MediaPosition is now always reported back as 10000000 / 2 (= 5000000), even though the video is clearly being played through.

has anyone run into this before, and/or know of a way to fix it? (it happens with both the wmv and the mp4)




UPDATE: it seems once mediaended has fired, even if i don't do anything else, the position is never updated (when reading it) once i set it. not sure what i'm doing different in this project than in previous ones :\ (it must be something simple...)

Nov 19, 2010 at 9:31 PM

ok, i think i may have solved it, but i'm not sure i did The Right Thing -- in any case, i can get it to fire the positionchanged event after the media has ended by restarting the graph poll timer, which gets stopped, but apparently never restarted, in OnMediaEvent when the event code is Complete (StopGraphPollTimer() is called, stopping and disposing of the timer). (wow that was a long sentence.)

in BaseClasses.cs, i just added StartGraphPollTimer(); 

        /// <summary>
        /// Plays the media
        /// </summary>
        public virtual void Play()


            if (m_basicAudio != null)
                //Balance = Balance;
                //Volume = Volume;

            if (m_mediaControl != null)

Mar 3, 2014 at 1:52 PM
had the same problem. Worked for me too. thx :)