MediaPlayer metaData undefined when playing mp3 stream
Unsolved
QML and Qt Quick
-
I am working on an app for Ubuntu Touch (QT 5.12), and I want to play mp3 streams using the
MediaPlayer
. While the basic playback works fine, I cannot seem to access the meta data associated with it to get the artist, title and so on.However I do know for sure that the stream actually contains the meta data, since artist/title/etc. are being displayed when playing the stream using desktop media players (e.g. Clementine on ubuntu).
This is my code:
import Ubuntu.Components 1.3 import QtQuick 2.7 import QtQuick.Layouts 1.3 import QtMultimedia 5.12 Item { id: mainPage anchors.fill: parent function getMetaData(metaData) { var text = "" text += "title: " + metaData.title + "\n" text += "subTitle: " + metaData.subTitle + "\n" text += "author: " + metaData.author + "\n" text += "comment: " + metaData.comment + "\n" text += "description: " + metaData.description + "\n" text += "category: " + metaData.category + "\n" text += "genre: " + metaData.genre + "\n" text += "language: " + metaData.language + "\n" text += "albumTitle: " + metaData.albumTitle + "\n" text += "albumArtist: " + metaData.albumArtist + "\n" text += "coverArtUrlSmall: " + metaData.coverArtUrlSmall + "\n" text += "coverArtUrlLarge: " + metaData.coverArtUrlLarge + "\n" text += "posterUrl: " + metaData.posterUrl + "\n" return text } MediaPlayer { id: audioPlayer audioRole: MusicRole source: "https://s3-webradio.antenne.de/antenne/stream/mp3?aw_0_1st.playerid=radio.de" //source: "https://swr-swr3-live.cast.addradio.de/swr/swr3/live/mp3/128/stream.mp3" //source: "http://bob.hoerradar.de/radiobob-hartesaite-mp3-hq?sABC=5r65511s%230%23os634o21s23sr4751opp80560p2o2sr6%23fgernzf.enqvbobo.qr&amsparams=playerid:streams.radiobob.de;skey:1583698207" onPlaybackStateChanged: { console.log("State: " + audioPlayer.status + " Meta data: \n" + getMetaData(audioPlayer.metaData)); } } Button { width: 96 height: 96 color: "white" iconName: "media-playback-start" onClicked: { audioPlayer.play() } } }
Does anyone know why the meta data is not available? Do I have to add anything?