May 2019
Intermediate to advanced
542 pages
13h 37m
English
Our old friend QMediaPlayer can handle video playback as well as audio. However, just as a Blu-ray player needs to be connected to a TV or monitor to display what it's playing, QMediaPlayer needs to be connected to a widget that will actually display the video. The widget we need is the QVideoWidget class, which is found in the QtMultimediaWidgets module.
To use it, we'll need to import QMultimediaWidgets, as follows:
from PyQt5 import QtMultimediaWidgets as qtmmw
To connect our QMediaPlayer() method to a QVideoWidget() method, we set the player's videoOutput property, as follows:
self.player = qtmm.QMediaPlayer() self.video_widget = qtmmw.QVideoWidget() self.player.setVideoOutput(self.video_widget)
This is easier than hooking ...
Read now
Unlock full access