Hi all,
I'm using Qt 5.12 and in the following project, I want to use a simple SoundEffect in QML to play a sound on iOS:
In the .pro file, I only added "multimedia" to the end of "QT += quick" and also the code block below at the end:
ios {
APP_Sounds.files = $$PWD/sounds/kimya.mp3
APP_Sounds.path = sounds
QMAKE_BUNDLE_DATA += APP_Sounds
}
ios {
APP_Sounds.files = $$PWD/sounds/kimya.mp3
APP_Sounds.path = sounds
QMAKE_BUNDLE_DATA += APP_Sounds
}
To copy to clipboard, switch view to plain text mode
The main.cpp file is intact, and without changes.
And, this is main.qml file:
import QtQuick 2.12
import QtQuick.Window 2.12
import QtMultimedia 5.12
Window {
visible: true
width: 640; height: 480
title: qsTr("Hello World")
Rectangle {
width: 100; height: 100
color: "green"
anchors.centerIn: parent
MouseArea {
anchors.fill: parent
onClicked: playExplosion.play()
}
}
SoundEffect {
id: playExplosion
source: "file:///Users/Me/QML/soundTest/soundTest/sounds/kimya.mp3"
}
}
import QtQuick 2.12
import QtQuick.Window 2.12
import QtMultimedia 5.12
Window {
visible: true
width: 640; height: 480
title: qsTr("Hello World")
Rectangle {
width: 100; height: 100
color: "green"
anchors.centerIn: parent
MouseArea {
anchors.fill: parent
onClicked: playExplosion.play()
}
}
SoundEffect {
id: playExplosion
source: "file:///Users/Me/QML/soundTest/soundTest/sounds/kimya.mp3"
}
}
To copy to clipboard, switch view to plain text mode
But the problem is that, no sound played on iOS. 
What part of this code is wrong, please?
Bookmarks