How to fix QMultimedia after upgrading to Linux Mint 19.3

david <[email protected]> Mon, 13 Apr 2020 23:56:03 -0700
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <[email protected]>
Hello,

This is my first
request for help from the mailing list. Please let me know if I
am not doing it right.

I have a Python3 video
player program that was working OK in Linux Mint 19.1 (64-bit
Cinnamon desktop). I upgraded to Mint 19.3 (also 64-bit Cinnamon desktop) and now the
player does not show video. Audio is OK but the screen is dark.

With the old system I
was using Python 3.6.8, Qt 5.9.5 and PyQt 5.10.1. It is the same
with the new system except for Python 3.6.9.

I stripped down my
program to the code shown below just to recreate the error on my
new system; I also verified it works OK on the old system. Do
any of you know what might be missing or wrong on my system to
cause this problem?

Thanks for any help you
can give,

Dave

-----------------------------------------------------------------

#!/usr/bin/env python3

import sys

from PyQt5 import QtWidgets, QtGui, QtCore

from PyQt5 import QtMultimedia, QtMultimediaWidgets

class ShowVideo(QtWidgets.QDialog):

def __init__(self, fileName, parent=None):

super(ShowVideo, self).__init__(parent)

self.mediaPlayer = QtMultimedia.QMediaPlayer()

self.videoWidget = QtMultimediaWidgets.QVideoWidget()

controlLayout = QtWidgets.QHBoxLayout()

layout = QtWidgets.QVBoxLayout()

layout.addWidget(self.videoWidget)

self.setLayout(layout)

self.mediafile = QtCore.QFile(fileName)

self.mediafile.open(QtCore.QIODevice.ReadOnly)

self.mediaPlayer.setMedia(QtMultimedia.QMediaContent(),
self.mediafile)

self.mediaPlayer.setVideoOutput(self.videoWidget)

QtWidgets.QShortcut(QtGui.QKeySequence('Esc'),self,self._quit)

def _quit(self):

if (self.mediaPlayer.state() ==
QtMultimedia.QMediaPlayer.PlayingState):

self.mediaPlayer.pause()

self.mediafile.close()

self.close()

if __name__ == '__main__':

app = QtWidgets.QApplication(sys.argv)

fileName = '/media/work/sample.mp4'

sv = ShowVideo(fileName)

sv.mediaPlayer.play()

sv.exec_()

sys.exit()

_______________________________________________
PyQt mailing list    [email protected]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt