Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. MediaPlayer metaData undefined when playing mp3 stream
Forum Updated to NodeBB v4.3 + New Features

MediaPlayer metaData undefined when playing mp3 stream

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 322 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    s710
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      s710
      wrote on last edited by
      #2

      Anyone??

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved