Unable to play videos in wxWidgets sample Media player

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
bshaibaz01
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Dec 29, 2020 5:13 pm

Unable to play videos in wxWidgets sample Media player

Post by bshaibaz01 »

I am using wxWidgets samples code for media player. Here first we need to select the file from the wxFileDialog and on clicking play button it will play the video.

But I don't want to select the file from the wxFileDialog, I am passing the video path in DoOpenFile(path, bNewPage); and then clicking on play button then the video is not playing.
void wxMediaPlayerFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
{
DoOpenFile(_("D:\\myvideo.mp4"), false);
wxMediaPlayerNotebookPage* currentpage = (wxMediaPlayerNotebookPage*)m_notebook->GetCurrentPage();

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

Re: Unable to play videos in wxWidgets sample Media player

Post by doublemax »

The code you posted is not helpful. What happens inside DoOpenFile? Did you confirm that the event handler gets executed?

Which platform, wxWidgets version are you using?

Can you play in the standard Windows media player?

Can the "mediaplayer" sample that comes with wxWidgets play that file?
Use the source, Luke!
bshaibaz01
In need of some credit
In need of some credit
Posts: 2
Joined: Tue Dec 29, 2020 5:13 pm

Re: Unable to play videos in wxWidgets sample Media player

Post by bshaibaz01 »

I am using wxWidgets-3.1.4 on windows 10. And yes, it is playing the file in the wxwidgets sample mediaplayer.
In the sample code, first we are going to select the file from the menu bar item "Open File" which will call the function
OnOpenFileSamePage
=>
OpenFile
=>
DoOpenFile
. And on clicking the play button it will call "OnPlay".

I made only one change in the sample code.

I am directly calling
DoOpenFile
in
OnPlay
by providing the file path. Then the video is not playing.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: Unable to play videos in wxWidgets sample Media player

Post by PB »

Is this different from this bug (i.e, does the workaround mentioned there work)
https://trac.wxwidgets.org/ticket/18976

EDIT Please disregard the above, I got confused by the thread title claiming that the sample does not work.
Post Reply