Search code examples
c++wxwidgets

wxWidgets video player


I want to play a video in a frame using wxSmith ( which is a wxWidgets extension ) . I've read the documentation from their website ( http://docs.wxwidgets.org/2.6.3/wx_wxmediactrl.html ) but I barely understood it . What I did by now :

wxMediaCtrl* Video;
wxString filename='/home/cristi/Desktop/intro.mp4';    
Video= new wxMediaCtrl(this, filename,"IDVideo",wxDefaultPosition,wxDefaultSize,0,wxT(""),wxDefaultValidator,wxPanelNameStr);
this->Connect(IDVideo, wxEVT_MEDIA_STOP, (wxObjectEventFunction)
(wxEventFunction)(wxMediaEventFunction) &t2Frame::OnMediaStop);
void t2Frame::OnMediaStop(const wxMediaEvent& evt)
{
    if(I don't know what to put here)
    {
        m_mediactrl->SetPosition(
            m_mediactrl->GetDuration() << 1
                                );
        evt.Veto();
    }
}

But I don't know what to do next. I have a lots of error. It's the first time I use wxWidgets and I've searched a lot on the Internet but no results.

Thanks in advance.


Solution

  • Two general advices:

    1. Start from a non-ancient wxWidgets version such as 3.0.2.
    2. Look at the sample showing the use of this control.

    Beyond this I really am not sure what are you asking about, e.g. why are you handling wxEVT_MEDIA_STOP in the first place. And, of course, you should really make some better effort than "lots of error[s]" if you want to get any help.