c++linuxwindowsqtmxe

using QMediaPlayer on Windows system with code compiled on Linux


A project of mine is written with Qt5/c++, using the QMediaPlayer class to read audio files. Everything's ok as long as I run this project on Linux. Since I want to run my program on Windows, I use MXE to compile my code and create a binary file for Windows systems.

The program seems ok, except this problem with the QMediaPlayer class. When the program runs on a Windows system, I read this message :

defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer".

By googling around, I came to understand that the QMediaPlayer used several plugins, different on each platform. On Windows, The WMF plugin is Microsoft-only, DirectShow seems useless; others suggest to use other external plugins like portaudio, SdlAudio ou OpenAI.

How may I solve this problem ?


Solution

  • I found the problem and know how to fix it : according to this thread, just add the following line to your .pro file :

    QTPLUGIN += dsengine qtmedia_audioengine