Current TimeCode while Movie plays?

Apr 14, 2011 at 6:49 PM

Hi,

thanks for providing this great example on how to use quicktime in WPF!

I was wondering who to implement a function that shows the current timecode from the movie, while the movie plays?

So i found an example function in a book called "QuickTime for .NET and COM Developers", but i can't figure out, why this doesn't work in the wpf lib. Maybe i am doing something wrong.

Private Sub QTControl0_QTEvent(ByVal EventClass As Long, 
            ByVal EventID As Long, ByVal Phase As Long, 
            ByVal EventObject As Object, Cancel As Boolean)
  Dim t As Long
  
If EventID = qtEventTimeWillChange Then
    t = EventObject.GetParam(QTEventObjectParametersEnum.
            qtEventParamMovieTime)
    Me.tbTime = GetTimeCode(QTControl0.Movie, t)
  End If
End Sub

So i took a look at the function QTEvent in AxQTControlEventMulticaster, but it doesn't seem to be called at all. Is there a trick?

public virtual void QTEvent(int eventClass, int eventID, int phase, QTEventObject eventObject, ref bool cancel)
{
  _IQTControlEvents_QTEventEvent e = new _IQTControlEvents_QTEventEvent(eventClass, eventID, phase, eventObject, cancel);
  this.parent.RaiseOnQTEvent(this.parent, e);
  cancel = e.cancel;
}

Is there an Event I can subscribe to in order to repeatingly update my timecode?

Would be great, if you could help me out. I am usually working with Linux as a target system, I don't have a clue about all the windows active x stuff.

Thanks

Tobi

Nov 8, 2011 at 7:30 PM
Edited Nov 8, 2011 at 7:34 PM

Hi Tobi,

I'm using the QTEvent and have canged the constructor in the QuickTimeControl. I have added an eventhandler and that's it. See code below:

Constructor:
qtControl.QTEvent += QTControlEvent;
qtControl.QuickTime.EventListeners.Add(QTOLibrary.QTEventClassesEnum.qtEventClassStateChange, QTEventIDsEnum.qtEventMovieDidEnd, null, null);
Eventhandler:

private void QTControlEvent(object sender, AxQTOControlLib._IQTControlEvents_QTEventEvent e)
{
  MediaEvent(this, new MediaEventArgs(e.eventID));
}