dano_labrosse
17th October 2009, 19:01
Hi
I'm new to Qt. I'm trying to get a Phonon::VideoPlayer running to playback an MPEG4 video. I have the VideoPlayer window displaying but the the video screen is just black and there is no video playback. I'm running this on Windows XP. My code is below, hope you can help.
thanks
Dano
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
//setup media object
//
media = new Phonon::MediaObject();
media->setCurrentSource(Phonon::MediaSource(QString("C:\\workspace\\sample_mpeg4.mp4")));
//setup player
//
videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory);
videoPlayer->setFixedSize(QSize(400,300));
videoPlayer->move(1280-400,0);
videoPlayer->show();
connect(videoPlayer, SIGNAL(finished()), videoPlayer, SLOT(deleteLater()));
videoPlayer->play(media->currentSource());
}
I'm new to Qt. I'm trying to get a Phonon::VideoPlayer running to playback an MPEG4 video. I have the VideoPlayer window displaying but the the video screen is just black and there is no video playback. I'm running this on Windows XP. My code is below, hope you can help.
thanks
Dano
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
//setup media object
//
media = new Phonon::MediaObject();
media->setCurrentSource(Phonon::MediaSource(QString("C:\\workspace\\sample_mpeg4.mp4")));
//setup player
//
videoPlayer = new Phonon::VideoPlayer(Phonon::VideoCategory);
videoPlayer->setFixedSize(QSize(400,300));
videoPlayer->move(1280-400,0);
videoPlayer->show();
connect(videoPlayer, SIGNAL(finished()), videoPlayer, SLOT(deleteLater()));
videoPlayer->play(media->currentSource());
}