Hello I am trying to get to run the example from this site: http://doc.qt.io/qt-5/videooverview.html My code is the following:
#include "mainwindow.h"
#include <QApplication>
#include <QVideoWidget>
#include <QMediaPlayer>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
player = new QMediaPlayer;
playlist = new QMediaPlaylist(player);
playlist->addMedia(QUrl("http://example.com/myclip1.mp4"));
playlist->addMedia(QUrl("http://example.com/myclip2.mp4"));
videoWidget = new QVideoWidget;
player->setVideoOutput(videoWidget);
videoWidget->show();
playlist->setCurrentIndex(1);
player->play();
return a.exec();
}
When I try to execute it I get the errors:
error: 'player' was not declared in this scope player = new QMediaPlayer; ^ /home/roman/Downloads/Dropbox/PAdI/GuiAppTest/untitled/main.cpp:15: error: 'playlist' was not declared in this scope playlist = new QMediaPlaylist(player); ^ /home/roman/Downloads/Dropbox/PAdI/GuiAppTest/untitled/main.cpp:15: error: invalid use of incomplete type 'class QMediaPlaylist' playlist = new QMediaPlaylist(player); ^ I use Qt 5 and QT widget template. What is wrong?