QMediaPlayer video playback issue



  • I'm currently investigating an odd problem whereby an application that uses QMediaPlayer to playback video files is experiencing intermittent playback problems.

    When the problem occurs, no video frames are rendered, but the video's audio track is played correctly.

    At no time is an error reported and all player state and media status changes are valid and sensible, suggesting the media is opened, buffered and played correctly.

    I've checked system RAM, application heap and used GOOM to verify that no low memory events are being generated by the GPU. So this doesn't seem to be an OOM or GOOM issue.

    I'm trying to build a debug version of Qt Mobility (or QtMultimediaKit) to allow me to investigate what is happening within QMediaPlayer, but so far I am unable to build the code. (If I build QtMobility, there are missing directories and headers, if I just build QtMultimediaKit there are problems with symbols missing from the Elf file!)

    Currently building with Qt SDK 1.1.1 / Qt 4.7.3 for Symbian^3 / Qt Mobility 1.1.3.

    The problem is completely intermittent and only affects some individual C7 and N8 handsets (not whole phone models).

    Has anyone else experienced this sort of difficulty with QMediaPlayer? Any hints as to what I should look at next?

    Thanks in advance!



  • Could you please share your source code?

    There is example usage of "QMediaPlayer at the official documentation of Qt Mobility 1.1":http://doc.qt.nokia.com/qtmobility/qmediaplayer.html Have you already looked at it?



  • Naturally I have examined the official documentation. As I say, the problem is completely intermittent and only affects some handsets. And even on the affected handsets sometimes the videos work and sometimes they don't! I strongly suspected some OOM issue, but that seems not to be the case.

    Here's the code:
    @CVideoView::CVideoView(const QString &videoName, QWidget *parent):
    CMyAppBaseView(parent)
    {
    mPlayer = new QMediaPlayer();
    mPlayer->setMedia(QUrl::fromLocalFile(videoName));

        connect(mPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onMediaPlayerStateChanged(QMediaPlayer::State)));
        connect(mPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
                this, SLOT(onMediaStatusChanged(QMediaPlayer::MediaStatus)));
    
        mVideoWidget = new QVideoWidget(this);
        mVideoWidget->setGeometry(0,0,640,360);
        mVideoWidget->setFullScreen(true);
        mVideoWidget->show();
    
        mPlayer->setVideoOutput(mVideoWidget);
        qDebug()<<this<<"Calling play() on mPlayer.";
        mPlayer->setVolume(50);
        mPlayer->play();
    

    }

    CVideoView::~CVideoView()
    {
    if (mPlayer)
    {
    mPlayer->stop();
    delete mPlayer;
    delete mVideoWidget;
    }
    }

    void CVideoView::onMediaPlayerStateChanged(QMediaPlayer::State state)
    {
    qDebug() << this << "QMediaPlayer::State = "<<state;

    if (QMediaPlayer::StoppedState == state)
    {
    

    // ...
    // Code to switch back to parent view
    // ...
    }
    }

    void CVideoView::onMediaStatusChanged(QMediaPlayer::MediaStatus state)
    {
    qDebug()<<this<<"Media status = "<< state;
    }@



  • Thanks for sharing the source code. It looks pretty standard. Btw I found a similar "thread at Forum Nokia":http://discussion.forum.nokia.com/forum/showthread.php?211738-QVideoWidget-Sound-is-available-but-no-video

    [quote author="GavinM" date="1308043014"]As I say, the problem is completely intermittent and only affects some handsets. [/quote]

    Do you use the "smart installer":http://developer.qt.nokia.com/wiki/Nokia_Smart_Installer_for_Symbian to verify that all dependency are up to date when you install the app? The different behavior on different devices of a same model might be caused by this.



  • I don't use the smart installer during development. But that's not the problem - the issue is intermittent on some devices; it's not that videos refuse to play on particular devices. Sometimes they play, sometimes they don't.

    Further investigation seems to suggest that setting Media and VideoOutput on QMediaPlayer and then calling play, as shown in the documentation and all sample code is not sufficient.
    Having prepared the QMediaPlayer instance, I now defer calling play until I've received a signal to tell me the media has been loaded. Calling play prior to confirmation the media has loaded seems quite unreliable.

    However, even that isn't sufficient. I still have a problem whereby the first attempted play of a video clip in my application still only plays the audio track. Subsequent plays of the same or other video clips from that point on work, playing both video and audio.

    My assumption is that there is some plugin that needs to be loaded, which isn't being loaded before my application calls play, but that is available the next time I try to play a video.
    Is that correct? If so, how do I guarantee that my QMediaPlayer object is fully ready to play my video clip? How can I force all necessary components / plugins to be loaded?

    Thanks in advance!


Log in to reply
 

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