C

MediaSessionController QML Type

MediaSessionController controls the current media being played on a device. (Technical Preview). More...

Import Statement: import QtAndroidAutomotive.Media
Since: QtAndroidAutomotive 6.5

Properties

Signals

Methods

Detailed Description

MediaSessionController provides functions to control the actions of a media, such as playing and pausing, as well as retrieve information about the media, such as its metadata.

This class is instantiated by MediaSessionManager when it gets notified by the system about a new Media Controller being added or deleted. To get access to the controllers, use MediaSessionManager::activeControllers.

See also MediaSessionManager.

Property Documentation

availableActions : QMediaSessionController::PlaybackActions

This property holds the available actions for the media.


bufferProgress : float

This property holds how much of the media playback buffer is currently filled, from 0.0 (empty) to 1.0 (full).


coverArtImageUri : QString

This property holds the Uri of the cover art image of the media. If the media does not provide a cover art image, this will be an empty QString.


duration : qint64

This property describes the duration of the media in milliseconds.

Can also be retrieved from QMediaMetaData::Duration.


metaData : QMediaMetaData

This property holds the metadata of the media.


playbackRate : qreal

This property holds the playback rate of the media. 1 means that the media is playing at the normal rate. 2 means that media is playing at double rate. Negative values mean that the media is rewinding.

Returns 1 if failed to retrieve a valid playbackRate for the media.

See also setPlaybackRate().


playbackState : QMediaSessionController::PlaybackState

This property holds the playback state of the media.

Returns QMediaSessionController::NoState if unknown state or failed to retrieve a valid state.


position : qint64

This property holds the current playback position of the media in milliseconds.

Returns 0 if failed to retrieve a valid position.

See also setPosition().


thumbnailImageUri : QString

This property holds the Uri of the thumbnail image of the media. If the media does not provide a thumbnail image, this will be an empty QString.


Signal Documentation

availableActionsChanged()

This signal is emitted when the available actions for the media have changed.

Note: The corresponding handler is onAvailableActionsChanged.


bufferProgressChanged()

This signal is emitted when the buffer progress of the media has changed.

Note: The corresponding handler is onBufferProgressChanged.


durationChanged()

This signal is emitted when the duration of the media has changed.

Note: The corresponding handler is onDurationChanged.


metaDataChanged()

This signal is emitted when the QMediaMetaData has changed for the media.

Note: The corresponding handler is onMetaDataChanged.


playbackRateChanged()

This signal is emitted when the playback rate of the media has changed.

Note: The corresponding handler is onPlaybackRateChanged.


playbackStateChanged()

This signal is emitted when the playback state has changed for the media.

Note: The corresponding handler is onPlaybackStateChanged.


positionChanged()

This signal is emitted when the playback position of the media has changed. During normal media playback, it is emitted every 100 milliseconds.

Note: The corresponding handler is onPositionChanged.

See also position.


Method Documentation

void pause()

Pauses the media.


void play()

Starts or resumes the media.


void setPlaybackRate(real rate)

Sets the playback rate of the media.

On Android, passing the rate as 0 is ignored as it's not valid.

See also playbackRate.


void setPosition(int position)

Sets the playback position of the media in milliseconds.

The value is ignored if position is less than 0 or greater than duration

See also position.


void skipToNext()

Plays the next media in the queue of the application playing the media.


void skipToPrevious()

Plays the previous media in the queue of the application playing the media.


void stop()

Stops the media.


Available under certain Qt licenses.
Find out more.