wxMediaCtrl fails to load any media

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

wxMediaCtrl fails to load any media

Post by art-ganseforth »

Hey folks,

i've just a simple test-program using wx 3.1.2 / MinGW32, that creates a wxMediaCtrl inside a wxFrame:

Code: Select all

#include <wx/wx.h>
#include <wx/mediactrl.h>

class MyApp: public wxApp {
    virtual bool OnInit();
};


IMPLEMENT_APP(MyApp)


class MyFrame : public wxFrame {
    public:
        MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
        
        wxMediaCtrl *CTRLmedia;
        void OnMediaLoad(wxMediaEvent &ev);
};


bool MyApp::OnInit() {
    MyFrame *frame = new MyFrame( _("Test"), wxPoint(50, 50), wxSize(450, 350));

    frame->Show(true);
    SetTopWindow(frame);

    return true;
}

void MyFrame::OnMediaLoad(wxMediaEvent &ev) {
    wxMessageBox("Load");
} 

MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) : wxFrame( NULL, -1, title, pos, size ) {
                      
    CTRLmedia = new wxMediaCtrl(this, -1, "", wxPoint(0,0), wxSize(100,100), 0, "");
    CTRLmedia->ShowPlayerControls(wxMEDIACTRLPLAYERCONTROLS_STEP);
    CTRLmedia->Connect(wxEVT_MEDIA_LOADED, wxMediaEventHandler(MyFrame::OnMediaLoad),NULL, this);
    
    if (!CTRLmedia->Load ("F:\\drop.avi")) {
        wxMessageBox("Loading failed");     
        exit(0);
    }
    SetClientSize(CTRLmedia->GetBestSize());
}
This was a test from 2019 for later implemenation in a bigger project. I think (but i'm) not sure i used wx 2.9.7 or 2.9.3 and it was working.
Now, it fails to load any media. I tested different meditypes, but Load() always returns false.

Any ideay why?



Thank you,
Frank
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxMediaCtrl fails to load any media

Post by ONEEYEMAN »

Hi,
Can you reproduce it with the media sample?

Thank you.
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxMediaCtrl fails to load any media

Post by art-ganseforth »

ONEEYEMAN wrote: Thu May 14, 2020 8:10 pm Hi,
Can you reproduce it with the media sample?

Thank you.
The resault is some more information:
The Create()-call (line 1497) fails already. But why?
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4204
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxMediaCtrl fails to load any media

Post by PB »

FWIW, I tried a couple weeks old master on Win10 (built with 32-bit mingw-64 with GCC 8.1). The media sample could play a random MP3 and AVI files I tried.
Post Reply