QMediaPlayerControl¶
The
QMediaPlayerControl
class provides access to the media playing functionality of aQMediaService
. More…
Detailed Description¶
If a
QMediaService
can play media is will implementQMediaPlayerControl
. This control provides a means to set themedia
to play,start
,pause
andstop
playback,seek
, and control thevolume
. It also provides feedback on theduration
of the media, the currentposition
, andbuffering
progress.The functionality provided by this control is exposed to application code through the
QMediaPlayer
class.The interface name of
QMediaPlayerControl
isorg.qt-project.qt.mediaplayercontrol/5.0
as 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
paused
state.
- PySide2.QtMultimedia.QMediaPlayerControl.play()¶
Starts playback of the current media.
If successful the player control will immediately enter the
playing
state.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
media
source. If astream
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
, astream
is supplied, pointing to an openedQFile
. Otherwise, the resource is copied into a temporary file andmedia
contains the url to that file.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setMuted(mute)¶
- Parameters:
mute – bool
Sets the
mute
state of a player control.See also
- PySide2.QtMultimedia.QMediaPlayerControl.setPlaybackRate(rate)¶
- Parameters:
rate – float
Sets the
rate
of playback.See also
- 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
- 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) 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
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
- 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.