QMediaPlayerControl¶
The
QMediaPlayerControlclass provides access to the media playing functionality of aQMediaService. More…

Detailed Description¶
If a
QMediaServicecan play media is will implementQMediaPlayerControl. This control provides a means to set themediato play,start,pauseandstopplayback,seek, and control thevolume. It also provides feedback on thedurationof the media, the currentposition, andbufferingprogress.The functionality provided by this control is exposed to application code through the
QMediaPlayerclass.The interface name of
QMediaPlayerControlisorg.qt-project.qt.mediaplayercontrol/5.0as defined inQMediaPlayerControl_iid.See also
- class PySide2.QtMultimedia.QMediaPlayerControl([parent=None])¶
- param parent:
Constructs a new media player control with the given
parent.
- PySide2.QtMultimedia.QMediaPlayerControl.audioAvailableChanged(audioAvailable)¶
- Parameters:
audioAvailable – bool
- PySide2.QtMultimedia.QMediaPlayerControl.availablePlaybackRanges()¶
- Return type:
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:
ranges –
PySide2.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:
Returns the current media source.
See also
- PySide2.QtMultimedia.QMediaPlayerControl.mediaChanged(content)¶
- Parameters:
content –
PySide2.QtMultimedia.QMediaContent
- PySide2.QtMultimedia.QMediaPlayerControl.mediaStatus()¶
- Return type:
Returns the status of the current media.
- PySide2.QtMultimedia.QMediaPlayerControl.mediaStatusChanged(status)¶
- Parameters:
status –
MediaStatus
- PySide2.QtMultimedia.QMediaPlayerControl.mediaStream()¶
- Return type:
Returns the current media stream. This is only a valid if a stream was passed to
setMedia().See also
- 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
pausedstate.
- PySide2.QtMultimedia.QMediaPlayerControl.play()¶
Starts playback of the current media.
If successful the player control will immediately enter the
playingstate.See also
- PySide2.QtMultimedia.QMediaPlayerControl.playbackRate()¶
- Return type:
float
Returns the rate of playback.
See also
- PySide2.QtMultimedia.QMediaPlayerControl.playbackRateChanged(rate)¶
- Parameters:
rate – float
- PySide2.QtMultimedia.QMediaPlayerControl.position()¶
- Return type:
int
Returns the current playback position in milliseconds.
See also
- PySide2.QtMultimedia.QMediaPlayerControl.positionChanged(position)¶
- Parameters:
position – int
- PySide2.QtMultimedia.QMediaPlayerControl.seekableChanged(seekable)¶
- Parameters:
seekable – bool
- PySide2.QtMultimedia.QMediaPlayerControl.setMedia(media, stream)¶
- Parameters:
stream –
PySide2.QtCore.QIODevice
Sets the current
mediasource. If astreamis 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
QMediaContentwill 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, astreamis supplied, pointing to an openedQFile. Otherwise, the resource is copied into a temporary file andmediacontains the url to that file.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setMuted(mute)¶
- Parameters:
mute – bool
Sets the
mutestate of a player control.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setPlaybackRate(rate)¶
- Parameters:
rate – float
Sets the
rateof playback.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setPosition(position)¶
- Parameters:
position – int
Sets the playback
positionof the current media. This will initiate a seek and it may take some time for playback to reach the position set.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setVolume(volume)¶
- Parameters:
volume – int
Sets the audio
volumeof a player control.The volume is scaled linearly, ranging from
0(silence) to100(full volume).See also
- PySide2.QtMultimedia.QMediaPlayerControl.state()¶
- Return type:
Returns the state of a player control.
- PySide2.QtMultimedia.QMediaPlayerControl.stop()¶
Stops playback of the current media.
If successful the player control will immediately enter the
stoppedstate.
- 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
- PySide2.QtMultimedia.QMediaPlayerControl.volumeChanged(volume)¶
- Parameters:
volume – int
© 2022 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.