I have a very strange issue with the QMediaPlayer
class. I created a new Qt Widgets Application project with Qt Creator. In the MainWindow class (in mainwindow.h) I wrote this:
QMediaPlayer *player = new QMediaPlayer(this);
I also wrote
Since building gave me an undefined reference error to QMediaPlayer
, in project-name.pro I added
QT += multimedia
Then building my project went smoothly. This is the really strange part: when I ran the executable generated, it logged me out of my laptop! As in I had to log into my laptop again!
This was with Qt 5.8.0 download from the Qt website. After asking on the Qt Forum (here
), I uninstalled Qt completely an reinstalled the Debian provided Qt5. Now I could compile and run without getting logged out, but error messages were shown in the application output (handled in the Qt Forum). Also, audio/video couldn't be played. I installed the Qt multimedia packages since the folks on Qt Forum told me to. I installed GStreamer (errors about GStreamer) and tried to play a video file (MP4) with
in the terminal, but that logged me out as well! This was all after I showed them my error messages.
So, it was determined that this wasn't a Qt problem. It is a Debian problem (works fine in Windows 10). Any help to get QMediaPlayer
working and why this is happening?
before getting logged out: Here
after getting logged out: Here
diff -u dmesgOutputBeforeLogout.txt dmesgOutputAfterLogout.txt
(differences between the two outputs [shows how first file should be changed to match second file with +
(add line) and -
(delete line) signs] ): Here
P.S. I can play audio/video files in the default GNOME MPlayer.