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
Forum Updated to NodeBB v4.3 + New Features

Qt Android MediaPlayer NoMEdia

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 1 Posters 2.4k 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.
  • H Offline
    H Offline
    hdehaan
    wrote on 22 Aug 2013, 14:55 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
    • H Offline
      H Offline
      hdehaan
      wrote on 23 Aug 2013, 15:00 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
      • H Offline
        H Offline
        hdehaan
        wrote on 28 Aug 2013, 11:28 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

        1/3

        22 Aug 2013, 14:55

        • Login

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