Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
4.8.x
-
None
-
Windows 7
Description
Phonon::VideoPlayer does not display video:
#include <QApplication> #include <QWidget> #include <Phonon> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget *myWidget = new QWidget; myWidget->show(); Phonon::VideoPlayer *player = new Phonon::VideoPlayer(Phonon::VideoCategory, myWidget); QObject::connect(player, SIGNAL(finished()), player, SLOT(deleteLater())); player->play(QString::fromLatin1("winsat.wmv")); return a.exec(); }
Using a Phonon::MediaObject in combination with the two calls to Phonon::createPath() works (basically a cut-down version of demos/qmediaplayer; full code is attached):
#include "mediaplayerwidget.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MediaPlayerWidget w; w.show(); return a.exec(); } #include "mediaplayerwidget.h" #include <QVBoxLayout> MediaPlayerWidget::MediaPlayerWidget(QWidget *parent) : QWidget(parent), audioOutput(Phonon::VideoCategory), videoWidget(new Phonon::VideoWidget(this)) { QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setContentsMargins(8, 8, 8, 8); QVBoxLayout *videoLayout = new QVBoxLayout(); videoLayout->addWidget(videoWidget); videoLayout->setContentsMargins(0, 0, 0, 0); videoWindow.setLayout(videoLayout); videoWindow.setMinimumSize(100, 100); vLayout->addWidget(&videoWindow); Phonon::createPath(&mediaObject, &audioOutput); Phonon::createPath(&mediaObject, videoWidget); resize(500, 500); videoWindow.show(); QString fileName(QString::fromLatin1("winsat.wmv")); mediaObject.setCurrentSource(Phonon::MediaSource(fileName)); mediaObject.play(); } MediaPlayerWidget::~MediaPlayerWidget() { }
I've tried using absolute paths to the video file, which does change the execution path within Phonon's code, but doesn't affect the output; using relative and absolute paths with the working example is fine.