Results 1 to 1 of 1

Thread: QMediaPlayer crash using QPlaylist

  1. #1
    Join Date
    Mar 2019
    Posts
    22
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows

    Question QMediaPlayer crash using QPlaylist

    Hello,

    so i want to run background music on loop and i searched for it on how to do it on google and i found this bit of code:
    Qt Code:
    1. playlist = new QMediaPlaylist();
    2. playlist->addMedia(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
    3. playlist->setPlaybackMode(QMediaPlaylist::Loop);
    4.  
    5. music = new QMediaPlayer();
    6. music->setPlaylist(playlist);
    7. music->play();
    To copy to clipboard, switch view to plain text mode 

    but this code crashes as soon as the first song stops playing ? (when it wants to loop)

    but doing only this works, but the problem is it won't loop the media:
    Qt Code:
    1. music = new QMediaPlayer();
    2. music->setMedia(QUrl("qrc:/World_Sounds/BackgroundSound.wav"));
    3. music->play();
    To copy to clipboard, switch view to plain text mode 

    Here is the error message:
    File_2.PNG

    More error messages:
    https://imgur.com/P0c8UKh

    If anyone knows why does this happen, please help
    Any help is appreciated !!!!
    Attached Images Attached Images
    Last edited by MongKong; 31st March 2020 at 20:03.

Similar Threads

  1. QMediaPlayer crash
    By FlyDoodle in forum Qt Programming
    Replies: 5
    Last Post: 15th October 2019, 09:56
  2. Replies: 0
    Last Post: 3rd November 2015, 17:58
  3. Timecode in QMediaPlayer
    By mkarol in forum Qt Programming
    Replies: 1
    Last Post: 5th December 2013, 17:50
  4. Playing MP4 and FLV with QMediaPlayer
    By JasonKretzer in forum Newbie
    Replies: 2
    Last Post: 12th September 2013, 21:58
  5. QMediaPlayer problems
    By alenn.masic in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2013, 15:32

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.