title: pyqt5 looping mp3 file
body: <p>I want to loop an audio file and using a combination of <a href="https://stackoverflow.com/questions/43018205/qtmultimedia-mp3-audio-playback">THIS CODE</a> (my orignal question with solution) and <a href="https://stackoverflow.com/questions/37690616/play-background-music-in-a-loop-qt">THIS CODE</a> (Qt C example) managed to create this:</p>
  
  <pre><code>from PyQt5.QtCore import *
  from PyQt5.QtMultimedia import *
  import sys
  
  if __name__ == "__main__":
  
      app = QCoreApplication(sys.argv)
  
      playlist = QMediaPlaylist()
      url = QUrl.fromLocalFile("./sound2.mp3")
      playlist.addMedia(url)
      playlist.setPlaybackMode(QMediaPlaylist.Loop)
  
      content = playlist()
      player = QMediaPlayer()
      player.setMedia(content)
      player.play()
  
      app.lastWindowClosed.connect(player.stop)
      app.exec()
  </code></pre>
  
  <p>However, this code does not work and the error reported is:</p>
  
  <p>TypeError: arguments did not match any overloaded call:
    addMedia(self, QMediaContent): argument 1 has unexpected type 'QUrl'
    addMedia(self, object): argument 1 has unexpected type 'QUrl'</p>
  
  <p>Where am I going wrong with the code? Any help is most appreciated.</p>