Hi,
Just got this problem myself and in my case it looks like the handling in mediactrl_am.cpp wxAMMediaEvtHandler::OnActiveX() for the ReadyStateChange (0xfffffd9f) event is not correct.
According to the windows docs for this event (
http://msdn.microsoft.com/en-us/library/ms985677) the media should be playable if the parameter is equal to 3 or 4.
The code however does this:
Code: Select all
if(event.ParamCount() >= 1)
{
long eventParam = event[0].GetInteger(); // NGP to see value
if(eventParam == 0)
{
m_bLoadEventSent = false;
}
// Originally this was >= 3 here but on 3 we can't get the
// size of the video (will error) - however on 4
// it won't play on downloaded things until it is
// completely downloaded so we use the lesser of two evils...
else if(eventParam == 3 &&
!m_bLoadEventSent)
{
m_bLoadEventSent = true;
m_amb->FinishLoad();
}
}
I changed the code slightly so I could see the parameter value easier. So this will trigger the finish load handling when the param is equal to 3. But in the cases I've seen with local files (not tested streaming) the state jumps over 3 (interactive) and goes straight to 4 (complete). The comment above the check does not make sense. Looks like this has been here since the first version of the file from Feb 2006. The order of states that I saw when loading a WAV file was 1, 0, 4, 1, 4 slightly odd order. Anyway the following change causes it to work as expected for the cases I have tested:
Code: Select all
if(event.ParamCount() >= 1)
{
long eventParam = event[0].GetInteger(); // NGP to see value
if(eventParam == 0)
{
// Uninitialised state. Prevent any event being
// sent without going through the loading state
m_bLoadEventSent = true;
}
else if (eventParam == 1)
{
// Loading state. Allow finish load to be sent
// if either interactive (3) or complete (4) state
// is reached.
m_bLoadEventSent = false;
}
else if(eventParam >= 3 &&
!m_bLoadEventSent)
{
m_bLoadEventSent = true;
m_amb->FinishLoad();
}
}
I now get the wxEVT_MEDIA_LOADED event fired correctly and can start playing the media from the event handler.
Cheers
Nigel