1

I am writing an application which using fake GPS data to simulate movement of a helicopter on an area. The application needs to sync that gps data with a video. In other word, the application needs to update the video to the frames which describe the location of the helicopter. I use windows media player as the main player for my application. However, whenever i assign the currentPosition property to the new value, the property didn't update it comes back to the old value instead (i have debugged the code line by line, currentPosition didn't get assigned correctly after the assign statement). it is really frustrating me. Below is my pseudo code. I don't know why it acts like that, any help would be appreciated.

void StartFakeGPS(string filename)
{
    While(true)
    {
        Coordinate currentLocation = GetCurrentLocation();
        double second = MappingLocationToTheRightVideoSecond(currentLocation);

        videoViewer.Ctlcontrols.currentPosition = second;
        videoViewer.Ctlcontrols.step(1); //jump to the next frame. This force the player to update frame.
        videoViwer.Refresh();
    }
}
stoney78us
  • 195
  • 2
  • 5
  • 17
  • Are you sure the player is ready and playing when you attempt to set the currentPosition property? – covertCoder Jul 02 '13 at 19:02
  • Yes! videoViewer.openState == WMPLib.WMPOpenState.wmposMediaOpen is verified before doing anything. – stoney78us Jul 02 '13 at 19:26
  • Hmm, Try checking the videoViewer.playState. They should be checking relatively the same thing, but states in WMP change all the time and very quickly so it's possible you're running into a race condition. Reference: http://stackoverflow.com/questions/4308785/how-to-jump-x-second-with-axwindowsmediaplayer-in-c-sharp – covertCoder Jul 02 '13 at 20:32
  • i did try but the problem still stays. Assigning new value to currentPosition doesn't work either in paused state or playing state. – stoney78us Jul 02 '13 at 22:30

0 Answers0