Results 1 to 5 of 5

Thread: SoundEffect in QML for iOS

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2016
    Posts
    76
    Thanks
    28
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Windows Android

    Default SoundEffect in QML for iOS

    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:

    Qt Code:
    1. ios {
    2. APP_Sounds.files = $$PWD/sounds/kimya.mp3
    3. APP_Sounds.path = sounds
    4. QMAKE_BUNDLE_DATA += APP_Sounds
    5. }
    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:

    Qt Code:
    1. import QtQuick 2.12
    2. import QtQuick.Window 2.12
    3. import QtMultimedia 5.12
    4.  
    5. Window {
    6. visible: true
    7. width: 640; height: 480
    8. title: qsTr("Hello World")
    9.  
    10. Rectangle {
    11. width: 100; height: 100
    12. color: "green"
    13. anchors.centerIn: parent
    14.  
    15. MouseArea {
    16. anchors.fill: parent
    17. onClicked: playExplosion.play()
    18. }
    19. }
    20.  
    21. SoundEffect {
    22. id: playExplosion
    23. source: "file:///Users/Me/QML/soundTest/soundTest/sounds/kimya.mp3"
    24. }
    25. }
    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?
    Last edited by franky; 15th April 2019 at 08:16.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.