I've been using wxMediaCtrl quite happily in my application. Unfortunately, my application's use of wxMediaCtrl does not seem to work on Windows Vista. I'm wondering if there are known Vista issues with wxMediaCtrl?
I'm doing pretty basic stuff. I create a wxMediaCtrl, load a file, and when the EVT_MEDIA_LOADED occurs, I call Play().
On Win2K, XP, and Mac OS X, this works fine. But on Vista, no video plays. I've tried using WMV files as well as a couple other formats with no luck.
wxMediaCtrl on Windows Vista Topic is solved
Some lines of code would be helpful.
How and where do you create your wxMediaCtrl object?
Sebastian
How and where do you create your wxMediaCtrl object?
Sebastian
Programming today is a race between software engineers stirring to build bigger and better idiot-proof programs, and the universe is trying to produce bigger and better idiots. So far, the universe is winning. [Rich Cook]
wxMediaCtrl problem on Vista
I create it in a wxDialog. This code works fine under XP and Win2K. I've tried various video formats. Here is the actual code I'm using (minus standard #include statements):
Code: Select all
// wxMediaCtrl *cMediaCtrl is defined in header
/*!
* MyDlg type definition
*/
IMPLEMENT_DYNAMIC_CLASS( MyDlg, wxDialog )
/*!
* MyDlg event table definition
*/
BEGIN_EVENT_TABLE( MyDlg, wxDialog )
EVT_BUTTON( ID_STARTVIDEO, MyDlg::StartVideo )
END_EVENT_TABLE()
MyDlg::~MyDlg()
{
if (cMediaCtrl)
delete cMediaCtrl;
}
MyDlg::MyDlg( )
{
wxASSERT(FALSE);
}
MyDlg::MyDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& WXUNUSED(size), long style )
{
Create(parent, id, caption, pos, wxSize(300,300), style);
}
bool MyDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls();
CentreOnScreen();
return true;
}
void MyDlg::CreateControls()
{
MyDlg* itemDialog1 = this;
cMediaCtrl=NULL;
cMediaCtrl=new wxMediaCtrl( itemDialog1, wxID_MEDIACTRL, wxEmptyString,wxPoint(0,0),wxSize(240,240));
wxButton *aButton= new wxButton( itemDialog1, ID_BD_NEXTSTRETCH, _("&Next Stretch"), wxPoint(0, 245), wxSize(130, 24), 0 );
Connect(wxID_MEDIACTRL, wxEVT_MEDIA_LOADED, wxMediaEventHandler(MyDlg::OnMediaLoaded));
}
void MyDlg::OnMediaLoaded(wxMediaEvent& WXUNUSED(evt))
{
if( !cMediaCtrl->Play() )
wxASSERT(FALSE);
}
void MyDlg::StartVideo( wxCommandEvent& WXUNUSED(event) )
{
wxCHECK_RET(cMediaCtrl->Load("c:/videos/MyVideo.mpg"),_("VideoNotLoaded"));
}
Im not sure, it is just a guess: Maybe you have a problem with the wxMediaBackend. Try wxMEDIABACKEND_WMP10 in the Create call.
If this does not help, you'll have to describe closer what you mean with "does not seem to work"
Sebastian
If this does not help, you'll have to describe closer what you mean with "does not seem to work"
Sebastian
Programming today is a race between software engineers stirring to build bigger and better idiot-proof programs, and the universe is trying to produce bigger and better idiots. So far, the universe is winning. [Rich Cook]
That indeed solved the problem. I'm a little confused why other's don't seem to have noticed this problem. In any case, in my code now, I just check for Vista, and if my app is running on Vista, I specify the backend as wxMEDIABACKEND_WMP10 in the call to Create() and it works.
Thanks for the good suggestion!
-Ron
Thanks for the good suggestion!
-Ron