WebEngineDesktopMediaRequest QML Type

A request for populating a dialog with available sources for screen capturing. More...

Import Statement: import QtWebEngine
Since: Qt 6.7
In C++: QWebEngineDesktopMediaRequest

Properties

Methods

Detailed Description

To allow web applications to capture contents of a display, applications must connect to WebEngineView::desktopMediaRequested, which takes a WebEngineDesktopMediaRequest instance as an argument.

If a web application requests access to the contents of a display, WebEngineView::desktopMediaRequested will be emitted with a WebEngineDesktopMediaRequest instance as an argument which holds references to ListModels for available windows and screens that can be captured.

The data model's DisplayRole specifies the name of the source which is the title of a window or the number of the display. The model is dynamically updated if the available list of sources has changed; e.g when a window is opened/closed.

The signal handler needs to then either call selectScreen() or selectWindow() to accept the request and start screensharing.

See also WebEngineView::desktopMediaRequested.

Property Documentation

screensModel : ListModel [read-only]

A ListModel containing a list of available screens.

See also windowsModel.


windowsModel : ListModel [read-only]

A ListModel containing a list of available windows.

See also screensModel.


Method Documentation

void cancel()

Rejects a request. Screen capturing will be aborted.


void selectScreen(QModelIndex index)

Selects the screen at the index to be captured.

See also WebEngineDesktopMediaRequest::selectWindow().


void selectWindow(QModelIndex index)

Selects the window at the index to be captured.

See also WebEngineDesktopMediaRequest::selectScreen().


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.