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