/////////////////////////////////////////////////////////////////////////////
-// Name: mediactrltest.
+// Name: mediaplayer.cpp
// Purpose: wxMediaCtrl sample
// Author: Ryan Norton
// Modified by:
Minimal_Quit = wxID_EXIT,
Minimal_Loop,
Minimal_OpenFile,
- Minimal_OpenURL,
Minimal_Play,
Minimal_Pause,
Minimal_Stop,
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Loop, MyFrame::OnLoop)
EVT_MENU(Minimal_OpenFile, MyFrame::OnOpenFile)
- EVT_MENU(Minimal_OpenURL, MyFrame::OnOpenURL)
EVT_MENU(Minimal_Play, MyFrame::OnPlay)
EVT_MENU(Minimal_Pause, MyFrame::OnPause)
EVT_MENU(Minimal_Stop, MyFrame::OnStop)
helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog"));
menuFile->Append(Minimal_OpenFile, _T("&Open File"), _T("Open a File"));
- menuFile->Append(Minimal_OpenURL, _T("Open &URL"), _T("Open a URL"));
menuFile->AppendSeparator();
menuFile->Append(Minimal_Play, _T("&Play"), _T("Resume playback"));
menuFile->Append(Minimal_Pause, _T("P&ause"), _T("Pause playback"));
}
}
-
-//
-//OnOpenURL
-//-------
-//Called from file->openurl.
-//Opens a URL.
-//Windows DirectShow only.
-//
-void MyFrame::OnOpenURL(wxCommandEvent& WXUNUSED(event))
-{
- wxString theURL = wxGetTextFromUser(wxT("Enter the URL that has the movie to play"));
-
-#if defined(__WXMSW__) && wxUSE_DIRECTSHOW
- if(!theURL.empty())
- {
- if( !m_mediactrl->Load(wxURI(theURL)) )
- wxMessageBox(wxT("Couldn't load URL!"));
-
- if( !m_mediactrl->Play() )
- wxMessageBox(wxT("Couldn't play movie!"));
-
- ResetStatus();
- }
-#else
- wxMessageBox(wxT("Not supported!"));
-#endif
-}
-
//
//OnPlay
//-------