10-03-2012 09:10 AM
Im using the code from teh following:
MediaPlayer mp(this); mp.setSourceUrl(QUrl("/assets/audio/magichour.mp3"
But the mp3 won't play, any ideas?
I've enabled the correct permissions.
Solved! Go to Solution.
11-01-2012 05:02 PM
The MediaPlayer API actually needs the absolute path to do the playback right now (I know, it is a very annoying limitation at the moment; I already this internally and hopefully it will be fixed soon).
If you are packaging the file within the application, you would have to do something like the following:
mp.setSourceUrl(QDir::currentPath() + "/app/native/assets/sounds/magichour.mp3");
You can also play the media files from the "shared" folders (with the "access_shared" permissions in the bar-descriptor.xml file). In that case, the code could be something like the following:
MediaPlayer mp(this); mp.setSourceUrl("/accounts/1000/shared/music/magicAlso, note that the simulator has limited support on codecs (only a few audio codecs and no video) for proprietary reasons. Hope that helps and please let us know if you have any further questions. Cheers, Rashid
11-20-2012 04:27 PM
Just a quick update on this thread:
In addition to what I mentioned before in the thread already, the following "asset" way of accessing files in the assets folder should also work:
MediaPlayer mp(this); mp.setSourceUrl(QUrl("asset:///file.mp3")); mp.play();
Note that this solution only went in the most recent public Beta3 OS/SDK (10.0.9.388/10.0.9.386)
03-07-2013 04:57 AM