Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMediaPlayer + QIODevice



  • Hello everyone.

    I have a problem trying to use QMediaPlayer with QIODevice. I want to play audio from URL and know audio downloaded progress. So I decided to use QNetworkReply as QIODevice. But it didn't work. I don't know when I should call setMedia(). I tried to call it after QNetworkAccessManager's method get(), after first QNetworkReply's signal readyRead() and after finished() and no results. So i need some help. Is it possible to use QNetworkReply as QIODevice with QMediaPlayer? How? There is nothing about QIODevice in QMediaPlayer docs.


    For example I've tried to use QFile and it works fine:
    @
    mf = new QFile("test.mp3");
    mf->open(QIODevice::ReadOnly);
    m_mediaPlayer->setMedia(QMediaContent(), mf);
    m_mediaPlayer->setVolume(50);
    m_mediaPlayer->play();
    @


Log in to reply