Home > Back-end >  How to use QMediaPlayer broadcast audio resource files in QT5
How to use QMediaPlayer broadcast audio resource files in QT5

Time:03-20

How to use in QT5 QMediaPlayer play audio resource file
Mainly path problem


Player=new QMediaPlayer;
Player - & gt; SetMedia (QUrl: : fromLocalFile (" :/new/music/Sound/Sound mp3 "));//into/Sound/Sound. The mp3 is feasible, is this not?
Player - & gt; SetVolume (30);
Player - & gt; Play ();

CodePudding user response:

Player - & gt; SetMedia (QUrl (" QRC:/new/music/Sound/Sound mp3 "));
Be sure to QRC,

CodePudding user response:

Right-click resource file select copy path or copy the url don't need to spell it
  • Related