Phonon::VideoPlayer
-
How can I create a realy simple video player with Phonon? (which can play the avi files)
I search one tutorial/example/program many hours ago, but I did not find, which it worked.
Thanks! -
For starting (from this book: "Advanced Qt Programming"):
@
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
playIcon = QIcon(":/play.png");
pauseIcon = QIcon(":/pause.png");
mediaObject = new Phonon::MediaObject(this);
mediaObject->setTickInterval(OneSecond);
videoWidget = new Phonon::VideoWidget(this);
Phonon::createPath(mediaObject, videoWidget);
audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);
Phonon::createPath(mediaObject, audioOutput);
createActions();
createToolBar();
createWidgets();
createLayout();
createConnections();
setWindowTitle(QApplication::applicationName());
}...
// i.e: one method of the others:
void MainWindow::playOrPause()
{
switch (mediaObject->state()) {
case Phonon::PlayingState:
mediaObject->pause();
playOrPauseAction->setIcon(playIcon);
break;
case Phonon::PausedState: // Fallthrough
case Phonon::StoppedState:
mediaObject->play();
playOrPauseAction->setIcon(pauseIcon);
break;
default:
break;
}
}
@Edit: please use @ tags around code sections; Andre