Important: Please read the Qt Code of Conduct -

Question about QPlayList

  • Hi,

    After doing a bit of reading up on documentation for QMediaPlayer(there isn't much for Python, sadly), I realized that the only way to do a loop in QMediaPlayer is by passing it a QPlayList rather than using setMedia(QMediaContent).

    All seemed to compile fine except now I'm not getting any video playback at all.
    Here's my code:

    playlist = QMediaPlaylist()
    playlist.setPlaybackMode(3) # I think this is setting it to loop
    self.preview_mPlayer.setPlaylist(playlist) # "self.preview_mPlayer" would be my QMediaPlayer object

    If I avoided all this and ran this instead:


    the video plays fine (albeit without looping)

    Has anyone had any experience with QPlayList and have gotten it to work?


  • Lifetime Qt Champion


    Since you only have one element, I'd use CurrentItemInLoop.

    You should also add error checking to get more information about what is going on.

  • I don't think QMediaContent has a way of setting the playback type like QPlayList does.
    I did manage to get around the issue by signalling when playback state changed to zero to play the video over again. Currently that seems to work fine.


  • Just an update to the working state of this code. Yes it does loop as it should in both mac and windows, however, when it loops on the mac, the video scales up for some bizarre reason. I have no clue what would make it do that. Any thoughts?

Log in to reply