QGraphicsVideoItem problem
-
Hi I'm having some truble getting QGraphicsVideoItem to display some video content. The QMediaPlayer states that there were 100+ images provided and 100+ images displayed, but there is no output on the item.
@#include "SimpleSplash.hpp"
#include <QTimer>
#include <QMediaPlayer>
#include <QUrl>
#include <QFile>
#include <QDir>
#include <QGraphicsScene>
#include <QGraphicsVideoItem>void SimpleSplash::startPlayback()
{
#ifdef Q_OS_SYMBIAN
player->setVideoOutput(videoPlayer);
if(player->mediaStatus() == QMediaPlayer::LoadedMedia)
player->play();
QTimer::singleShot(12000,this,SLOT(movieTimeOut()));
#else
emit splashTimeOut();
QTimer::singleShot(500,this,SLOT(differedClose()));
#endif
}void SimpleSplash::differedClose()
{
player->stop();
close();
this->deleteLater();
}void SimpleSplash::movieTimeOut()
{
emit splashTimeOut();
QTimer::singleShot(500,this,SLOT(differedClose()));
qDebug(player->errorString().toAscii());
}void SimpleSplash::mediaStateChanged()
{
qDebug(QString("Media Status %1").arg(player->mediaStatus()).toAscii());
if(player->mediaStatus() == QMediaPlayer::LoadedMedia)
{
startPlayback();
disconnect(player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(mediaStateChanged()));
}
else if(player->mediaStatus() == QMediaPlayer::InvalidMedia)
{
disconnect(player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(mediaStateChanged()));
movieTimeOut();
}
}SimpleSplash::SimpleSplash(QWidget *parent) :
QGraphicsView(parent)
{
videoPlayer = new QGraphicsVideoItem;
player = new QMediaPlayer(this);
QDir dir;
player->setMedia(QUrl::fromLocalFile(dir.absoluteFilePath("symbian_intro_anim_360x640_intro.mp4")));
connect(player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(mediaStateChanged()));
qDebug(player->errorString().toAscii());QGraphicsScene *scene = new QGraphicsScene(0,0,360,640); setScene(scene); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); scene->addItem(videoPlayer); scene->setBackgroundBrush(QBrush(QPixmap(":/eyecandy/spalsh/landing_screen.jpg"))); setFrameStyle(QFrame::NoFrame);
}
SimpleSplash::~SimpleSplash()
{
delete videoPlayer;
}
@I'm using Qt 4.6.3 and Mobility 1.0.2
-
There is no support for QGraphicsVideoItem on Symbian in 1.0. You should try 1.1+.
-
Thanks. I was also trying to run QVideoWidget witch ran fine on S^3 but panicked on S60 on this line.
@player->setVideoOutput(videoPlayer);@It throws 6
Invalid window handle.
A handle which should have referred to a window of a particular type referred to a window of another type, or the object index didn’t recognise the handle.
On the server side, this panic is ultimately raised by CWsClient::HandleToWindow() and CWsClient::HandleToClientWindow() during handle conversions.