QMediaPlayerControlclass provides access to the media playing functionality of aQMediaService. 更多 …
若
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,和bufferingprogress.The functionality provided by this control is exposed to application code through the
QMediaPlayer类。The interface name of
QMediaPlayerControlisorg.qt-project.qt.mediaplayercontrol/5.0作为定义在QMediaPlayerControl_iid.
QMediaPlayerControl
(
[
parent=None
]
)
¶
- param parent
QObject
Constructs a new media player control with the given
parent
.
PySide2.QtMultimedia.QMediaPlayerControl.
audioAvailableChanged
(
audioAvailable
)
¶
audioAvailable
–
bool
PySide2.QtMultimedia.QMediaPlayerControl.
availablePlaybackRanges
(
)
¶
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
)
¶
ranges
–
QMediaTimeRange
PySide2.QtMultimedia.QMediaPlayerControl.
bufferStatus
(
)
¶
int
Returns the buffering progress of the current media. Progress is measured in the percentage of the buffer filled.
PySide2.QtMultimedia.QMediaPlayerControl.
bufferStatusChanged
(
percentFilled
)
¶
percentFilled
–
int
PySide2.QtMultimedia.QMediaPlayerControl.
duration
(
)
¶
qint64
Returns the duration of the current media in milliseconds.
PySide2.QtMultimedia.QMediaPlayerControl.
durationChanged
(
duration
)
¶
duration
–
qint64
PySide2.QtMultimedia.QMediaPlayerControl.
error
(
error
,
errorString
)
¶
error
–
int
errorString – unicode
PySide2.QtMultimedia.QMediaPlayerControl.
isAudioAvailable
(
)
¶
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
(
)
¶
bool
Returns the mute state of a player control.
PySide2.QtMultimedia.QMediaPlayerControl.
isSeekable
(
)
¶
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
(
)
¶
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
(
)
¶
Returns the current media source.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
mediaChanged
(
content
)
¶
content
–
QMediaContent
PySide2.QtMultimedia.QMediaPlayerControl.
mediaStatus
(
)
¶
MediaStatus
Returns the status of the current media.
PySide2.QtMultimedia.QMediaPlayerControl.
mediaStatusChanged
(
status
)
¶
status
–
MediaStatus
PySide2.QtMultimedia.QMediaPlayerControl.
mediaStream
(
)
¶
QIODevice
Returns the current media stream. This is only a valid if a stream was passed to
setMedia()
.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
mutedChanged
(
mute
)
¶
mute
–
bool
PySide2.QtMultimedia.QMediaPlayerControl.
pause
(
)
¶
Pauses playback of the current media.
If successful the player control will immediately enter the
paused
状态。
PySide2.QtMultimedia.QMediaPlayerControl.
play
(
)
¶
Starts playback of the current media.
If successful the player control will immediately enter the
playing
状态。
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
playbackRate
(
)
¶
qreal
Returns the rate of playback.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
playbackRateChanged
(
rate
)
¶
rate
–
qreal
PySide2.QtMultimedia.QMediaPlayerControl.
position
(
)
¶
qint64
Returns the current playback position in milliseconds.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
positionChanged
(
position
)
¶
position
–
qint64
PySide2.QtMultimedia.QMediaPlayerControl.
seekableChanged
(
seekable
)
¶
seekable
–
bool
PySide2.QtMultimedia.QMediaPlayerControl.
setMedia
(
media
,
stream
)
¶
media
–
QMediaContent
stream
–
QIODevice
设置当前
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
,
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.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
setMuted
(
mute
)
¶
mute
–
bool
设置
mute
state of a player control.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
setPlaybackRate
(
rate
)
¶
rate
–
qreal
设置
rate
of playback.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
setPosition
(
position
)
¶
position
–
qint64
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.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
setVolume
(
volume
)
¶
volume
–
int
Sets the audio
volume
of a player control.
The volume is scaled linearly, ranging from
0
(silence) to
100
(full volume).
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
state
(
)
¶
State
Returns the state of a player control.
PySide2.QtMultimedia.QMediaPlayerControl.
stateChanged
(
newState
)
¶
newState
–
State
PySide2.QtMultimedia.QMediaPlayerControl.
stop
(
)
¶
Stops playback of the current media.
If successful the player control will immediately enter the
stopped
状态。
PySide2.QtMultimedia.QMediaPlayerControl.
videoAvailableChanged
(
videoAvailable
)
¶
videoAvailable
–
bool
PySide2.QtMultimedia.QMediaPlayerControl.
volume
(
)
¶
int
Returns the audio volume of a player control.
另请参阅
PySide2.QtMultimedia.QMediaPlayerControl.
volumeChanged
(
volume
)
¶
volume
–
int