I'm trying to create fully working onefile executable from QML+PySide2 app. I'm using auto-py-to-exe (tried also PyInstaller). Firstly created .exe did not want to start (there wasn't main.qml file), but thanks to this post: PyInstaller and QML Files and @eyllanesc answer - 3rd method worked (only the 3rd). And the problem now is that app works, but without sounds (button clicks, etc.). The console displays the following messages:
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"
(I have 3 sounds files)
My file structure is as follows:
sounds
├── button_click.mp3
├── check.mp3
└── uncheck.mp3
appIcon.png
appIcon.ico
FunkcjePython.py
main.py
main.qml
qml.qrc
qml_rc.py
Problem now is also that there is no sound even when I run it in Pycharm
main.py
import sys
import os
from FunkcjePython import Bridge
import qml_rc
from PySide2.QtGui import QGuiApplication, QIcon
from PySide2.QtQml import QQmlApplicationEngine
from PySide2 import QtCore
if __name__ == "__main__":
app = QGuiApplication(sys.argv)
app.setWindowIcon(QIcon("appIcon.png"))
os.environ["QT_QUICK_CONTROLS_STYLE"] = "Universal"
engine = QQmlApplicationEngine()
bridge = Bridge()
engine.rootContext().setContextProperty("pybridge", bridge)
engine.load(":/main.qml")
if not engine.rootObjects():
sys.exit(-1)
sys.exit(app.exec_())
qml.qrc
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>sounds/button_click.mp3</file>
<file>sounds/check.mp3</file>
<file>sounds/uncheck.mp3</file>
</qresource>
</RCC>
So what can I do to make the sounds work in the pycharm project and later in the .exe file?