QPlaybackOptions Class

The QPlaybackOptions class enables low-level control of media playback options. More...

Header: #include <QPlaybackOptions>
CMake: find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
qmake: QT += multimedia
Since: Qt 6.10
In QML: playbackOptions

Public Types

(since 6.10) enum PlaybackIntent { Playback, LowLatencyStreaming }

Properties

Public Functions

int networkTimeoutMs() const
QPlaybackOptions::PlaybackIntent playbackIntent() const
int probeSize() const
void resetNetworkTimeoutMs()
void resetPlaybackIntent()
void resetProbeSize()
void setNetworkTimeoutMs(int timeout)
void setPlaybackIntent(QPlaybackOptions::PlaybackIntent intent)
void setProbeSize(int probeSizeBytes)

Detailed Description

QPlaybackOptions gives low-level control of media playback options. Although we strongly recommend to rely on the default settings of QMediaPlayer, QPlaybackOptions can be used to optimize media playback to specific use cases where the default options are not ideal.

Note that options are hints to the media backend, and may be ignored if they are not supported by the current media format or codec.

Playback options rely on support in the media backend. Availability is documented per option.

See also QMediaPlayer.

Member Type Documentation

[since 6.10] enum QPlaybackOptions::PlaybackIntent

Configures the intent of media playback, to focus on either high quality playback or low latency media streaming.

ConstantValueDescription
QPlaybackOptions::Playback0The intent is robust and high quality media playback, enabling sufficient buffering to prevent glitches during playback.
QPlaybackOptions::LowLatencyStreaming1Buffering is reduced to optimize for low latency streaming, but with a higher likelihood of lost frames or other glitches during playback.

This enum was introduced in Qt 6.10.

Property Documentation

[since 6.10] networkTimeoutMs : int

Determines the network timeout (in milliseconds) used for socket I/O operations with some network formats.

This option is only supported with the FFmpeg media backend.

This property was introduced in Qt 6.10.

Access functions:

int networkTimeoutMs() const
void setNetworkTimeoutMs(int timeout)
void resetNetworkTimeoutMs()

[since 6.10] playbackIntent : PlaybackIntent

Determines if QMediaPlayer should optimize for robust high quality video playback (default), or low latency streaming.

This option is only supported with the FFmpeg media backend.

This property was introduced in Qt 6.10.

Access functions:

QPlaybackOptions::PlaybackIntent playbackIntent() const
void setPlaybackIntent(QPlaybackOptions::PlaybackIntent intent)
void resetPlaybackIntent()

[since 6.10] probeSize : int

Probesize defines the amount of data (in bytes) to analyze in order to gather stream information before media playback starts.

A larger probesize value can give more robust playback but may increase latency. Conversely, a smaller probesize can reduce latency but might miss some stream details. The default probesize is -1, and the actual probesize is determined by the media backend.

This option is only supported with the FFmpeg media backend.

This property was introduced in Qt 6.10.

Access functions:

int probeSize() const
void setProbeSize(int probeSizeBytes)
void resetProbeSize()