QMediaPlayerControl

The QMediaPlayerControl class provides access to the media playing functionality of a QMediaService . More

Inheritance diagram of PySide2.QtMultimedia.QMediaPlayerControl

Detailed Description

If a QMediaService can play media is will implement QMediaPlayerControl . This control provides a means to set the media to play, start , pause and stop playback, seek , and control the volume . It also provides feedback on the duration of the media, the current position , and buffering progress.

The functionality provided by this control is exposed to application code through the QMediaPlayer class.

The interface name of QMediaPlayerControl is org.qt-project.qt.mediaplayercontrol/5.0 as defined in QMediaPlayerControl_iid .

class PySide2.QtMultimedia.QMediaPlayerControl([parent=None])
param parent:

PySide2.QtCore.QObject

Constructs a new media player control with the given parent .

PySide2.QtMultimedia.QMediaPlayerControl.audioAvailableChanged(audioAvailable)
Parameters:

audioAvailable – bool

PySide2.QtMultimedia.QMediaPlayerControl.availablePlaybackRanges()
Return type:

PySide2.QtMultimedia.QMediaTimeRange

Returns a range of times in milliseconds that can be played back.

Usually for local files this is a continuous interval equal to [0.. duration() ] or an empty time range if seeking is not supported, but for network sources it refers to the buffered parts of the media.

PySide2.QtMultimedia.QMediaPlayerControl.availablePlaybackRangesChanged(ranges)
Parameters:

rangesPySide2.QtMultimedia.QMediaTimeRange

PySide2.QtMultimedia.QMediaPlayerControl.bufferStatus()
Return type:

int

Returns the buffering progress of the current media. Progress is measured in the percentage of the buffer filled.

PySide2.QtMultimedia.QMediaPlayerControl.bufferStatusChanged(percentFilled)
Parameters:

percentFilled – int

PySide2.QtMultimedia.QMediaPlayerControl.duration()
Return type:

int

Returns the duration of the current media in milliseconds.

PySide2.QtMultimedia.QMediaPlayerControl.durationChanged(duration)
Parameters:

duration – int

PySide2.QtMultimedia.QMediaPlayerControl.error(error, errorString)
Parameters:
  • error – int

  • errorString – str

PySide2.QtMultimedia.QMediaPlayerControl.isAudioAvailable()
Return type:

bool

Identifies if there is audio output available for the current media.

Returns true if audio output is available and false otherwise.

PySide2.QtMultimedia.QMediaPlayerControl.isMuted()
Return type:

bool

Returns the mute state of a player control.

PySide2.QtMultimedia.QMediaPlayerControl.isSeekable()
Return type:

bool

Identifies if the current media is seekable.

Returns true if it possible to seek within the current media, and false otherwise.

PySide2.QtMultimedia.QMediaPlayerControl.isVideoAvailable()
Return type:

bool

Identifies if there is video output available for the current media.

Returns true if video output is available and false otherwise.

PySide2.QtMultimedia.QMediaPlayerControl.media()
Return type:

PySide2.QtMultimedia.QMediaContent

Returns the current media source.

See also

setMedia()

PySide2.QtMultimedia.QMediaPlayerControl.mediaChanged(content)
Parameters:

contentPySide2.QtMultimedia.QMediaContent

PySide2.QtMultimedia.QMediaPlayerControl.mediaStatus()
Return type:

MediaStatus

Returns the status of the current media.

PySide2.QtMultimedia.QMediaPlayerControl.mediaStatusChanged(status)
Parameters:

statusMediaStatus

PySide2.QtMultimedia.QMediaPlayerControl.mediaStream()
Return type:

PySide2.QtCore.QIODevice

Returns the current media stream. This is only a valid if a stream was passed to setMedia() .

See also

setMedia()

PySide2.QtMultimedia.QMediaPlayerControl.mutedChanged(mute)
Parameters:

mute – bool

PySide2.QtMultimedia.QMediaPlayerControl.pause()

Pauses playback of the current media.

If successful the player control will immediately enter the paused state.

See also

state() play() stop()

PySide2.QtMultimedia.QMediaPlayerControl.play()

Starts playback of the current media.

If successful the player control will immediately enter the playing state.

See also

state()

PySide2.QtMultimedia.QMediaPlayerControl.playbackRate()
Return type:

float

Returns the rate of playback.

PySide2.QtMultimedia.QMediaPlayerControl.playbackRateChanged(rate)
Parameters:

rate – float

PySide2.QtMultimedia.QMediaPlayerControl.position()
Return type:

int

Returns the current playback position in milliseconds.

See also

setPosition()

PySide2.QtMultimedia.QMediaPlayerControl.positionChanged(position)
Parameters:

position – int

PySide2.QtMultimedia.QMediaPlayerControl.seekableChanged(seekable)
Parameters:

seekable – bool

PySide2.QtMultimedia.QMediaPlayerControl.setMedia(media, stream)
Parameters:

Sets the current media source. If a stream is supplied; data will be read from that instead of attempting to resolve the media source. The media source may still be used to supply media information such as mime type.

Setting the media to a null QMediaContent will cause the control to discard all information relating to the current media source and to cease all I/O operations related to that media.

Qt resource files are never passed as is. If the service supports StreamPlayback , a stream is supplied, pointing to an opened QFile . Otherwise, the resource is copied into a temporary file and media contains the url to that file.

See also

media()

PySide2.QtMultimedia.QMediaPlayerControl.setMuted(mute)
Parameters:

mute – bool

Sets the mute state of a player control.

See also

isMuted()

PySide2.QtMultimedia.QMediaPlayerControl.setPlaybackRate(rate)
Parameters:

rate – float

Sets the rate of playback.

See also

playbackRate()

PySide2.QtMultimedia.QMediaPlayerControl.setPosition(position)
Parameters:

position – int

Sets the playback position of the current media. This will initiate a seek and it may take some time for playback to reach the position set.

See also

position()

PySide2.QtMultimedia.QMediaPlayerControl.setVolume(volume)
Parameters:

volume – int

Sets the audio volume of a player control.

The volume is scaled linearly, ranging from 0 (silence) to 100 (full volume).

See also

volume()

PySide2.QtMultimedia.QMediaPlayerControl.state()
Return type:

State

Returns the state of a player control.

PySide2.QtMultimedia.QMediaPlayerControl.stateChanged(newState)
Parameters:

newStateState

PySide2.QtMultimedia.QMediaPlayerControl.stop()

Stops playback of the current media.

If successful the player control will immediately enter the stopped state.

PySide2.QtMultimedia.QMediaPlayerControl.videoAvailableChanged(videoAvailable)
Parameters:

videoAvailable – bool

PySide2.QtMultimedia.QMediaPlayerControl.volume()
Return type:

int

Returns the audio volume of a player control.

See also

setVolume()

PySide2.QtMultimedia.QMediaPlayerControl.volumeChanged(volume)
Parameters:

volume – int