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. Getting duration of music file in android
Forum Updated to NodeBB v4.3 + New Features

Getting duration of music file in android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 540 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.
  • M Offline
    M Offline
    MajidKamali
    wrote on last edited by
    #1

    Hi. I want to get duration of a music sound on android.
    I connected a slot to durationChanged signal of QMediaPlayer but it shows the following error in android

    W/dalvikvm(32228): No implementation found for native Lorg/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer;.onStateChangedNative (IJ)V
    

    my code:

        player = new QMediaPlayer(this);
        player->setMedia(QMediaContent(QUrl(media_file_name)));
        connect(player, &QMediaPlayer::durationChanged, [=](qint64 duration){
            qDebug() << "Duration:" << duration;
            media_duration = duration;
        });
        connect(player, &QMediaPlayer::stateChanged, [=](QMediaPlayer::State newState){
            if(newState == QMediaPlayer::PlayingState)
                setTilesEnabled(false);
            else
                setTilesEnabled(true);
        });
    

    I commented second connect, but does not work either.

    Qt 5.6.0 on Arch linux
    Thanks

    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