Class: QgsMediaWidget

A widget for playing back audio and video media files.

Added in version 3.30.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsMediaWidget

Base classes

QWidget

QObject

QPaintDevice

Methods

mediaPath

Returns the media path.

mediaPlayer

Returns the QMediaPlayer object.

mode

Returns the media widget mode.

setMediaPath

Sets the media path.

setMode

Sets the media widget mode.

setVideoHeight

Sets the video frame height.

videoHeight

Returns the video frame height.

Attributes

Audio

Video

class qgis.gui.QgsMediaWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None)

Constructor

Parameters:

parent (Optional[QWidget] = None)

Audio = 0
class Mode

Bases: int

Video = 1
mediaPath(self) str[source]

Returns the media path.

Return type:

str

mediaPlayer(self) QMediaPlayer | None[source]

Returns the QMediaPlayer object.

Return type:

Optional[QMediaPlayer]

mode(self) QgsMediaWidget.Mode[source]

Returns the media widget mode.

Return type:

QgsMediaWidget.Mode

setMediaPath(self, path: str | None)[source]

Sets the media path.

Parameters:

path (Optional[str])

setMode(self, mode: QgsMediaWidget.Mode)[source]

Sets the media widget mode.

Parameters:

mode (QgsMediaWidget.Mode)

setVideoHeight(self, height: int)[source]

Sets the video frame height.

Note

setting the height to 0 is interpreted as a video frame that will expand to fill available height in the widget’s parent layout.

Parameters:

height (int)

videoHeight(self) int[source]

Returns the video frame height.

Return type:

int