QMediaPlaylist has a method
addMedia
with the signature
bool QMediaPlaylist::addMedia(const QMediaContent &content)
http://doc.qt.io/qt-5/qmediaplaylist.html#addMedia
And the documentation suggests for c++ that
playlist->addMedia(QUrl("http://example.com/movie1.mp4"));
should work.
http://doc.qt.io/qt-5/qmediaplaylist.html#details
BUT in PyQT5
playlist.addMedia(QUrl.fromLocalFile("some/path/music.mp3")
errors out with unexpected QUrl.
So….. you have to do
QMediaContent(QtCore.QUrl.fromLocalFile("filePath/fileName.mp3"))
in python. A bit unwieldy but PySide2 appears to have stalled from an outsiders perspective.
Initially I suspect that QUrl and QMediaContent inherited from some sort of common base class and were split off and its perhaps an untested use case of using QUrl was lost. I ended up making a bandaid in python with
MakePath = lambda x: QtM.QMediaContent(QtCore.QUrl.fromLocalFile(x))
where QtM is `from PyQt5 import QtMultimedia as QtM`