IOS SOUND IMAGE: Difference between revisions
Jump to navigation
Jump to search
AutoSpider (talk | contribs) (Convert ExpressionEngine section headers) |
No edit summary |
||
Line 1: | Line 1: | ||
= IOS sound and image = | = IOS sound and image = | ||
For to play sound file on IOS platform you can't store in qrc file but you must put it in the bundle together the qml files. | For to play sound file on IOS platform you can't store in qrc file but you must put it in the bundle together the qml files. | ||
Line 6: | Line 4: | ||
The most important part is this (in .pro file), where puts the qml and audio in the bundle: | The most important part is this (in .pro file), where puts the qml and audio in the bundle: | ||
< | <pre> | ||
DATA_FILES = $$PWD/qml/iosqt/main.qml ../iosqt/page.qml ../iosqt/audio.mp3 | DATA_FILES = $$PWD/qml/iosqt/main.qml ../iosqt/page.qml ../iosqt/audio.mp3 | ||
Line 13: | Line 11: | ||
data.files = $$DATA_FILES | data.files = $$DATA_FILES | ||
data.path = Documents | data.path = Documents | ||
QMAKE_BUNDLE_DATA | QMAKE_BUNDLE_DATA *= data | ||
} | } | ||
</ | </pre> | ||
obviously you have to include the plugin: | obviously you have to include the plugin: | ||
< | <pre> | ||
QTPLUGIN | QTPLUGIN *= qtaudio_coreaudio | ||
QTPLUGIN | QTPLUGIN *= qtmedia_audioengine | ||
QTPLUGIN | QTPLUGIN *= qavfcamera | ||
QTPLUGIN | QTPLUGIN *= qavfmediaplayer | ||
</ | </pre> | ||
thus in main.qml: | thus in main.qml: | ||
< | <pre> | ||
MediaPlayer { | MediaPlayer { | ||
id: playMusic | id: playMusic | ||
Line 34: | Line 32: | ||
source: "audio.mp3" | source: "audio.mp3" | ||
} | } | ||
</ | </pre> | ||
Good fun | Good fun |
Revision as of 10:31, 10 June 2015
IOS sound and image
For to play sound file on IOS platform you can't store in qrc file but you must put it in the bundle together the qml files. Here https://github.com/niqt/iosqt you can find my example that plays sound on IOS. The most important part is this (in .pro file), where puts the qml and audio in the bundle:
DATA_FILES = $$PWD/qml/iosqt/main.qml ../iosqt/page.qml ../iosqt/audio.mp3 ios: { data.files = $$DATA_FILES data.path = Documents QMAKE_BUNDLE_DATA *= data }
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" }
Good fun