QVideoWidget

The QVideoWidget class provides a widget which presents video produced by a media object. More

Inheritance diagram of PySide2.QtMultimediaWidgets.QVideoWidget

Inherited by: QCameraViewfinder

Synopsis

Functions

Slots

Signals

Detailed Description

Attaching a QVideoWidget to a QMediaObject allows it to display the video or image output of that media object. A QVideoWidget is attached to media object by passing a pointer to the QMediaObject in its constructor, and detached by destroying the QVideoWidget .

player = new QMediaPlayer;

playlist = new QMediaPlaylist(player);
playlist->addMedia(QUrl("http://example.com/myclip1.mp4"));
playlist->addMedia(QUrl("http://example.com/myclip2.mp4"));

videoWidget = new QVideoWidget;
player->setVideoOutput(videoWidget);

videoWidget->show();
playlist->setCurrentIndex(1);
player->play();

Note : Only a single display output can be attached to a media object at one time.

See also

QMediaObject QMediaPlayer QGraphicsVideoItem

class PySide2.QtMultimediaWidgets.QVideoWidget([parent=None])

Constructs a new video widget.

The parent is passed to QWidget .

PySide2.QtMultimediaWidgets.QVideoWidget.aspectRatioMode()
Return type:

AspectRatioMode

This property holds how video is scaled with respect to its aspect ratio..

PySide2.QtMultimediaWidgets.QVideoWidget.brightness()
Return type:

int

This property holds an adjustment to the brightness of displayed video..

Valid brightness values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.brightnessChanged(brightness)
Parameters:

brightness – int

PySide2.QtMultimediaWidgets.QVideoWidget.contrast()
Return type:

int

This property holds an adjustment to the contrast of displayed video..

Valid contrast values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.contrastChanged(contrast)
Parameters:

contrast – int

PySide2.QtMultimediaWidgets.QVideoWidget.fullScreenChanged(fullScreen)
Parameters:

fullScreen – bool

PySide2.QtMultimediaWidgets.QVideoWidget.hue()
Return type:

int

This property holds an adjustment to the hue of displayed video..

Valid hue values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.hueChanged(hue)
Parameters:

hue – int

PySide2.QtMultimediaWidgets.QVideoWidget.saturation()
Return type:

int

This property holds an adjustment to the saturation of displayed video..

Valid saturation values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.saturationChanged(saturation)
Parameters:

saturation – int

PySide2.QtMultimediaWidgets.QVideoWidget.setAspectRatioMode(mode)
Parameters:

modeAspectRatioMode

This property holds how video is scaled with respect to its aspect ratio..

PySide2.QtMultimediaWidgets.QVideoWidget.setBrightness(brightness)
Parameters:

brightness – int

This property holds an adjustment to the brightness of displayed video..

Valid brightness values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.setContrast(contrast)
Parameters:

contrast – int

This property holds an adjustment to the contrast of displayed video..

Valid contrast values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.setFullScreen(fullScreen)
Parameters:

fullScreen – bool

This property holds whether video display is confined to a window or is ..

PySide2.QtMultimediaWidgets.QVideoWidget.setHue(hue)
Parameters:

hue – int

This property holds an adjustment to the hue of displayed video..

Valid hue values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.setSaturation(saturation)
Parameters:

saturation – int

This property holds an adjustment to the saturation of displayed video..

Valid saturation values range between -100 and 100, the default is 0.

PySide2.QtMultimediaWidgets.QVideoWidget.videoSurface()
Return type:

PySide2.QtMultimedia.QAbstractVideoSurface

This property holds Returns the underlaying video surface that can render video frames to the current widget. This property is never nullptr . Example of how to render video frames to QVideoWidget :.

QImage img = QImage("images/qt-logo.png").convertToFormat(QImage::Format_ARGB32);
QVideoSurfaceFormat format(img.size(), QVideoFrame::Format_ARGB32);
videoWidget = new QVideoWidget;
videoWidget->videoSurface()->start(format);
videoWidget->videoSurface()->present(img);
videoWidget->show();

See also

setVideoOutput