Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-28525

Phonon::VideoPlayer doesn't display video on Windows 7

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.8.x
    • (Inactive) Phonon
    • 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.

      Attachments

        1. phonon.zip
          4.42 MB
          Mitch Curtis
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mitch_curtis Mitch Curtis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes