Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Cannot save playlist



  • I am using Qt 5.12 and Visual Studio 2017 to create an audio application. I used a method shown below (CreatePlayList) to create a QMediaPlaylist. I can use the playlist to play and seek without problems. I trying to use the built in save method by calling
    QString location = "M/Tools/Language/AudioServer/NewTest.txt";
    bool saved = mPlaylist- >save(QUrl::fromLocalFile(location));

    saved is always false and no file is created.

    Any thoughts or suggestions would be greatly appreciate.

    Bruce

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    int QtAudioWrapper::CreatePlayList(QString filename)
    {
    int status = -1;

    mMediaPlayList.clear();
    
    if (mMediaPlayer != NULL)
    {
    	mPlaylist = new QMediaPlaylist(mMediaPlayer);
    
    	if (mPlaylist != NULL)
    	{
    		bool added = mPlaylist->addMedia(QUrl::fromLocalFile(filename));
    
    		mMediaPlayList.push_back(filename);
    
    		mPlaylist->setCurrentIndex(1);
    
    		status = -1;
    	}
    }
    
    return(status);
    

    }


  • Lifetime Qt Champion

    Hi,

    Are you sure the path is valid ?



  • Yes. I have tried both absolute paths and relative paths neither worked. I could not tell from the documentation if the location is supposed to be a file name or directory name


  • Lifetime Qt Champion

    @bclay1297 said in Cannot save playlist:

    NewTest.txt

    I don't think that .txt is a valid playlist format extension.



  • I also tried m3u. Someone posted a comment on another site that said the playlist format was based on a plugin but there was no indication of where or what the plugin might be. I am beginning to think it is another one of those functions not implemented in the Windows version of Qt just like the QMediaRecorder.


  • Lifetime Qt Champion

    m3u is available on all platforms.

    Look into the plugins folder.



  • Thank you for your help I was looking in the wrong place for the plugin. It is working now


Log in to reply