Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: QuickTime 7 (7.0.2.70) ActiveX control, how to subscribe for QTEvents



Hi Tom,

thanks for your support, I can get the events just fine now!

My goal has been to embed the QuckTime control into an ATL control, but I've been testing it in a .NET container. It seems to me that there I was basically doing the same thing to subscribe for Movie events, but I didn't call RemoveAll() on the EventListeners first, and perhaps I never used a valid combination of EventClass and EventID with EventListeners.Add(), but I'll go back to doing some more testing there...

Now I just tested with the embedded control, and that worked fine. I added the event listeners upon opening the movie:

HRESULT __stdcall compControl::StatusUpdateQtcontrol(long StatusCodeType, long StatusCode, BSTR StatusMessage) {
...
//enable sync recording when opening a clip from the file system
if(StatusCodeType == qtStatusCodeTypeControl &&
StatusCode == qtStatusMovieLoadFinalize)
{
//movie loaded, try subscribing for some movie events...
IQTMoviePtr pMovie = pQTControl->GetMovie();
if(pMovie) {
IQTEventListenersPtr pEventListeners = pMovie->GetEventListeners();
if(pEventListeners) {
pEventListeners->RemoveAll();
pEventListeners->Add(qtEventClassTemporal, qtEventTimeWillChange);
pEventListeners->Add(qtEventClassAudio, qtEventAudioVolumeDidChange);
pEventListeners->Add(qtEventClassStateChange, qtEventRateWillChange);
pEventListeners->Add(qtEventClassApplicationRequest, qtEventShowStatusStringRequest);
}
}
}
}


and read the status message:

HRESULT __stdcall compControl::QTEventQtcontrol(long EventClass, long EventID, long Phase, LPDISPATCH EventObject, BOOL* Cancel)
{
IQTEventObjectPtr pEvent = EventObject;
if(pEvent)
switch(pEvent->EventID) {
case qtEventShowStatusStringRequest:
{
_variant_t var = pEvent->GetParam(qtEventParamStatusString);
_bstr_t status = _bstr_t("Movie Status: ") + var.bstrVal;
PlayerStatus(qtEventShowStatusStringRequest, status); //fire some status info to the container
}
}
return 0;
}



Until the documentaion is available, I may have to ask back for a detail or two regarding the QuickTime control's interfaces, but this has really helped me alot already :)


BR,
Baenz



----- Original Message ----- From: "Tom McHale" <email@hidden>
To: "Bendicht Thomet" <email@hidden>
Sent: Thursday, August 18, 2005 9:13 PM
Subject: Re: QuickTime 7 (7.0.2.70) ActiveX control,how to subscribe for QTEvents



Bendight,

Did that work for you? Did you have a chance to try it?

- Tom McHale

On Aug 17, 2005, at 6:38 AM, Bendicht Thomet wrote:

thanks for the quick answers and suggestions, I'll try what Tom lined out for me, and report back when I know more :)

Baenz

----- Original Message ----- From: "Tom McHale" <email@hidden>
To: <email@hidden>
Sent: Tuesday, August 16, 2005 7:15 PM
Subject: Re: QuickTime 7 (7.0.2.70) ActiveX control,how to subscribe for QTEvents



Bendight,

Try something like this right after you create the control:


<code> void MyClass::AddEventListeners() { HRESULT hr = S_OK;

CComPtr<IQTControl> spQTControl;
CComPtr<IQTMovie> spQTMovie;
CComPtr<IQTEventListeners> spEventListeners;

// Get interface pointer to control
hr =  m_ax.QueryControl(&spQTControl) )

// Get interface pointer to movie
hr = spQTControl->get_Movie(&spQTMovie));

if (!spQTMovie)
return;

// Get interface pointer to event listeners collection
hr = spQTMovie->get_EventListeners(&spEventListeners );
if (! spEventListeners)
return;

spEventListeners->RemoveAll();


spEventListeners->Add(qtEventClassTemporal, qtEventTimeWillChange);

spEventListeners->Add(qtEventClassAudio, qtEventAudioVolumeDidChange);

spEventListeners->Add(qtEventClassStateChange, qtEventRateWillChange);

spEventListeners->Add(qtEventClassApplicationRequest, qtEventShowStatusStringRequest);
return;
}
void __stdcall MyClass::SinkQTEvent(long EventClass, long EventID, long Phase, IQTEventObject* EventObject, VARIANT_BOOL* Cancel)
{
float rate;
long time, volume;


CComPtr<IQTEventObject> event = EventObject;

switch (EventID)
{

case qtEventShowStatusStringRequest:
{
enum {
kStatusStringIsURLLink = 1L << 1,
kStatusStringIsStreamingStatus = 1L << 2,
kStatusHasCodeNumber = 1L << 3, /* high 16 bits of stringTypeFlags is error code number*/
kStatusIsError = 1L << 4
};


VARIANT msgString,
msgFlags,
msgCode;
TCHAR* pStrg=NULL;

event->GetParam(qtEventParamStatusString, &msgString);

VariantInit(&msgFlags);
event->GetParam((QTEventObjectParametersEnum)'flag', &vTemp);
if ( FAILED(VariantChangeType(&msgFlags, &vTemp, 0, VT_I4)) )
break;

VariantInit(&msgCode);
event->GetParam(qtEventParamStatusCode, &vTemp);
if ( FAILED(VariantChangeType(&msgCode, &vTemp, 0, VT_I4)) )
break;

theEvent.retValue = msgCode.lVal;
if ( V_VT(&msgString) == VT_BSTR )
pStrg  = OLE2T(msgString.bstrVal);
}
}
}

// and you will want SinkQTEvent declared in the header for the class like this
BEGIN_SINK_MAP(CMainWindow)
SINK_ENTRY_EX(ID_CHILD_CONTROL, DIID__IQTControlEvents, 1, SinkQTEvent)
END_SINK_MAP()


void __stdcall SinkQTEvent(long EventClass, long EventID, long Phase, IQTEventObject* EventObject, VARIANT_BOOL* Cancel);

</code>

Hope this helps. I did not put in much error checking and I left out how to handle the other events (I can show you that if you wish). I believe there is some documentation coming soon but I just do not know when.

Tom McHale
QuickTime Engineering

On Aug 16, 2005, at 7:56 AM, email@hidden wrote:

Hello everyone

over the past weeks I've been experimenting with the new QuckTime ActiveX control, and I realize that it's still being changed quite a bit, and no documentation seems to be available yet. Nevertheless, I find it very practical as the simpler functionality is intuitive to use, and with a little QuickTime api knowldege, many other aspects of the control can be guessed at as well.

What I haven't figured out, however, is how I can make the control fire QTEvent notifications. And I suspect that QTEvent is the only way to get more precise notifications about what the control is doing.
With the version 7.0.2.70 update (public preview 3, I believe), for example, the control doesn't seem to be sending messages like "Buffering..." as StatusUpdate events anymore. So if I'd like "Buffering.." back, I'd probably have to subscribe to some event interface now...


I've tried subscribing to events in the following way:

axQTControl.QuickTime.EventListeners.Add(
    QTOLibrary.QTEventClassesEnum.qtEventClassStateChange,
    QTOLibrary.QTEventIDsEnum.qtEventLoadStateDidChange,
    1,    //what flags are needed here?
    null);    //probably optional, right?

I've tried registring for events with other interfaces (not just control.QuickTime) as well, and I've called EventListeners.Add() with other argument combinations - all without success.

My question is therefore: Does anyone have more detailed knowledge on how to get QTEvent events out of the new QuickTime control?

Besides the fact that I'm not entirely sure about which combinations of QTEventClassesEnum and QTEventIDsEnum are allowed, I have no clue as to what values tha Flags prameter (3rd argument of the EventListeners.Add() method) should be. The fourth argument I'd expect to be some subscriber reference.

Any help would be greatly apprecieated, thanks.


Baenz


_______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-API mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-api/ email@hidden


This email sent to email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. QuickTime-API mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicktime-api/email@hidden

This email sent to email@hidden
References: 
 >Re: QuickTime 7 (7.0.2.70) ActiveX control, how to subscribe for QTEvents (From: Tom McHale <email@hidden>)
 >Re: QuickTime 7 (7.0.2.70) ActiveX control, how to subscribe for QTEvents (From: "Bendicht Thomet" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.