mp3 via QMediaPlayer on Androis based XPeria Z2



  • Hello there,

    i try to play a mp3 on an Android based XPeria Z2.
    Code is very simple

    #include "mainwindow.h"
    #include <QApplication>
    #include <QMediaPlayer>

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;

    QMediaPlayer* player = new QMediaPlayer;
    // ...
    //player->setMedia(QUrl::fromLocalFile("C:/WithASpirit.mp3"));
    player->setMedia(QUrl::fromLocalFile("Music/Adiemus.mp3"));
    player->setVolume(100);
    player->play();
    
    w.show();
    
    return a.exec();
    

    }

    On Desktop Win7 PC is works fine.
    When deploying it to the Smartphone i get a

    E/MediaPlayer-JNI(11261): QCMediaPlayer mediaplayer NOT present
    D/Qt MediaPlayer(11261): null

    note. I guess it relates to the documentation saying
    "The compressed audio formats supported does depend on the operating system environment, and also what media plugins the user may have installed."

    I´m not deep enough in the material to figure out my self what to do.
    Has someone a hint?

    best regards!!


Log in to reply
 

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