Important: Please read the Qt Code of Conduct -

Qt Android MediaPlayer NoMEdia

  • I have the strange situation that on any Android platform i try to play a movie, but nothing happens.

    The code is simple:

    videoItem = new QGraphicsVideoItem;
    videoItem->setSize(QSizeF(MainView::getInstance()->geometry().width(), MainView::getInstance()->geometry().height()));
    mediaPlayer = new QMediaPlayer;
    QFile movie(movieName);
    if (!movie.exists())
    qDebug() << QTime::currentTime().toString("HH:mm:ss:zzz") << "info_player" << "Movie does not exist" << movieName;

    I have added the signals stateChanged and mediaStatusChanged. A don't get any signal either.
    When I have added the statement:
    qDebug() << QTime::currentTime().toString("HH:mm:ss:zzz") << "info_player" << mediaPlayer->mediaStatus();

    I get the message in my log: QMediaPlayer::NoMedia
    On windows this works wonderfull.

    What's wrong?
    Do I need to add something in the Android Manifest?

    Please help.

  • I came a bit further.

    When I create a QVideoWidget as a child of QWidget
    and create the QMediaPlayer as:
    new QMediaPlayer(widget)
    I get the sound of the movie.

    As soon as I add
    I get the NoMedia result.

  • I have solved the issue myself.
    I added the Qt kibraries in the apk file. That shouldn't. Ministro should download them on the tablet.

    Then I got the eeror: Illegal state.
    You have to create the mediaplayer with:
    mediaPlayer = new QMediaPlayer(videoItem);

    After that the player started to play the movies

Log in to reply