wxMediaCtrl: Usage questions

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
xargon
Knows some wx things
Knows some wx things
Posts: 25
Joined: Wed Feb 25, 2009 3:00 pm

wxMediaCtrl: Usage questions

Post by xargon » Wed Jan 13, 2016 5:17 pm

I am using wxMediaCtrl to play some video files and I tried to put it all together from some very simple code samples on the web as follows:

Code: Select all

class PlayerApp : public wxApp
{
public:
    bool OnInit()
    {
        wxFrame *main = new wxFrame(NULL, wxID_ANY, wxT("App"));
        wxMediaCtrl *media = new wxMediaCtrl(main, wxID_ANY, wxT("/home/xargon/media.avi"));        
        media->ShowPlayerControls();
        main->Show(true); // show it
        media->Play();
        return true;
    }
};

wxIMPLEMENT_APP(PlayerApp);
Now, I have a couple of questions:
When I call ShowPlayerControls(), I do not see any player controls actually. I am guessing this is due to the underlying media system. Is that correct? In any case, I do not want to show any controls. Would that usually be as simple as removing this call to the ShowPlayerControls()

Second, this shows the video quite distorted. I would like to show the video with its original size. How can I go about doing that?

User avatar
doublemax
Moderator
Moderator
Posts: 15263
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxMediaCtrl: Usage questions

Post by doublemax » Wed Jan 13, 2016 7:07 pm

I don't work under Linux, so i can't say whether this is normal or not. Did you test the "mediaplayer" sample that comes with wxWidgets?

One problem could be that your wxMediaCtrl is the only child of a wxFrame. In this special case the control is automatically stretched to fill the whole client area of the frame. Try putting it into a wxPanel and a wxSizer, this could eventually solve the problem with the distorted video.
Use the source, Luke!

Post Reply