I'm trying to play a web radio stream. These streams are distributed in playlist files. I am successful if I download the playlist manually and directly add the media URL.
I've subclassed a
QMediaPlayerand I'm trying to load the playlists like this
url=QUrl("http://stream.station.com/live.m3u"); playlist->load(url); connect(playlist, &QMediaPlaylist::loaded, this, &QMediaPlayer::play);
However, I'm having trouble parsing the playlist in QMediaPlaylist::load. I see in GammaRay that the loadFailed() signal fires. I also see that a QPlaylistFileParser object fires the same loadFailed signal with an ParserError as a QString argument. How do I access this ParserError? QPlaylistFileParser has no officially documented interface
Are you using QtCreator IDE to develop? If so, Had you tried to get help from the interface?
If QMediaPlayer is open source, Had you see any repository of this class?
Anyways, if they are string, Can you get the value of that string?
@Hazzl Did you try to print out http://doc.qt.io/qt-5/qmediaplaylist.html#errorString ?
Thanks @jsulm , printing the
ErrorStringprovides a clue: I get an empty file error. Hmmm... Something seems to go wrong when retrieving the playlist from the remote server. Using
curlwith the provided URL does work, so that's not the problem. I'll try to dig deeper...