PDA

View Full Version : Streaming / playing internet radio using QMediaPLayer



ivareske
3rd August 2014, 23:10
Does anyone know how to stream / play an internet radio source using QMediaPlayer? I have tried as follows,but it does not work... Nothing happens.

player = new QMediaPlayer;
player->setMedia(QUrl("http://www.p4.no/lyttesenter/p4_norge.m3u"));
player->setVolume(50);
player->play();

Do I have to start messing with network requests and such?

Regards, Ivar

d_stranz
3rd August 2014, 23:22
Does your code work if you give it the QUrl to a local mp3 file on your own PC?

ivareske
10th August 2014, 15:39
I got it to work now, the problem was that I was trying to play an URL pointing to a playlist, and not a file... Downloading the content of the playlist and then using the code above works. Anyone interested can check my project here:
https://github.com/ivareske/QtInternetRadio
Note that it is far from finished!