Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Android MediaPlayer NoMEdia
Qt 6.11 is out! See what's new in the release blog

Qt Android MediaPlayer NoMEdia

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 1 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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()));
    MainView::getInstance()->scene()->addItem(videoItem);
    mediaPlayer = new QMediaPlayer;
    mediaPlayer->setVideoOutput(videoItem);
    QFile movie(movieName);
    if (!movie.exists())
    qDebug() << QTime::currentTime().toString("HH:mm:ss:zzz") << "info_player" << "Movie does not exist" << movieName;
    else
    {
    mediaPlayer->setMedia(<movieName>);
    mediaPlayer->play();
    }

    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.

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      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
      mediaPlayer->setVideoOutput(widget);
      I get the NoMedia result.

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved