How to get sound on iOS

From Qt Wiki
Revision as of 15:19, 10 June 2015 by NetZwerg (talk | contribs) (Added Category)
Jump to: navigation, search

iOS Sound

To play a sound file on IOS platform you can't store it in the qrc file but you have to put it in the bundle together with the qml files. Here you can find my example that plays sound on IOS. The most important part is in the .pro file), where the qml and audio are put in the bundle:

DATA_FILES = $$PWD/qml/iosqt/main.qml ../iosqt/page.qml ../iosqt/audio.mp3 ios: {

 data.files = $$DATA_FILES
 data.path = Documents


obviously you have to include the plugin: QTPLUGIN *= qtaudio_coreaudio QTPLUGIN *= qtmedia_audioengine QTPLUGIN *= qavfcamera QTPLUGIN *= qavfmediaplayer

thus in main.qml: MediaPlayer {

 id: playMusic
 volume: 0.5
 source: "audio.mp3"