Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Local file format
Forum Update on Monday, May 27th 2025

Local file format

Scheduled Pinned Locked Moved Solved General and Desktop
urllocal filemediaplayer
2 Posts 1 Posters 467 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.
  • UnitScanU Offline
    UnitScanU Offline
    UnitScan
    wrote on last edited by
    #1

    I am slowly coming to the solution of the age-old problem of reading metadata. These are my experimental observations:

    reader is a in a istance of QMediaPlayer, and playlist is a istance of QMediaPlaylist

    If I write

    reader->setMedia(QUrl::fromLocalFile("D:/mysong.mp3"));
    

    The metadata is read correctly on the signal QMediaPlayer::LoadedMedia.

    But when I try to load the file from the playlist, the code doesn't work

    reader->setMedia((playlist->media(n)));
    

    with n a natural number

    Any suggestion?

    Thank you in advance

    1 Reply Last reply
    0
    • UnitScanU Offline
      UnitScanU Offline
      UnitScan
      wrote on last edited by
      #2

      Solved

      QString mediafile = playlist->media(n).request().url().toString();
      QFileInfo fi(mediafile);
      reader->setMedia(QUrl::fromLocalFile(fi.absoluteFilePath()));
      
      1 Reply Last reply
      1

      • Login

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