QVideoWidget black window



  • I have added QVideoWidget as a child to QWidget, and I am trying to play local avi file, but without success. Here is the code:

    #include "widget.h"
    #include <QApplication>
    #include <QtWidgets>
    #include <QtMultimediaWidgets>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        Widget window;
        window.resize(320, 240);
        window.setWindowTitle(QApplication::translate("childwidget", "Child widget"));
        window.show();
    
        QMediaPlayer *player = new QMediaPlayer;
    
        QMediaPlaylist *playlist = new QMediaPlaylist(player);
        playlist->addMedia(QUrl::fromLocalFile("/home/designer/Desktop/drop.avi"));
    
        QVideoWidget *videoWidget = new QVideoWidget(&window);
        player->setVideoOutput(videoWidget);
    
        videoWidget->resize(320, 240);
        videoWidget->show();
        playlist->setCurrentIndex(1);
        player->play();
    
        return a.exec();
    }
    

    I included multimedia, multimediawidgets and widgets in my .pro file.

    Also gstreamer packages are installed with sudo apt-get install gstreamer* libgstreamer* and version is 0.10.

    I am running Debian Wheezy on VMWare and trying to build that code for i386 Desktop machine.

    Am I missing something important so this code won't work? Only I get is black QVideoWidget window inside parrent QWidget.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.