QMediaPlayerControl 類提供訪問媒體播放功能,針對 QMediaService . 更多...
| 頭: | #include <QMediaPlayerControl> |
| qmake: | QT += multimedia |
| 繼承: | QMediaControl |
該類已過時。 提供它是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它。
| virtual | ~QMediaPlayerControl () |
| virtual QMediaTimeRange | availablePlaybackRanges () const = 0 |
| virtual int | bufferStatus () const = 0 |
| virtual qint64 | duration () const = 0 |
| virtual bool | isAudioAvailable () const = 0 |
| virtual bool | isMuted () const = 0 |
| virtual bool | isSeekable () const = 0 |
| virtual bool | isVideoAvailable () const = 0 |
| virtual QMediaContent | media () const = 0 |
| virtual QMediaPlayer::MediaStatus | mediaStatus () const = 0 |
| virtual const QIODevice * | mediaStream () const = 0 |
| virtual void | pause () = 0 |
| virtual void | play () = 0 |
| virtual qreal | playbackRate () const = 0 |
| virtual qint64 | position () const = 0 |
| virtual void | setMedia (const QMediaContent & media , QIODevice * stream ) = 0 |
| virtual void | setMuted (bool mute ) = 0 |
| virtual void | setPlaybackRate (qreal rate ) = 0 |
| virtual void | setPosition (qint64 position ) = 0 |
| virtual void | setVolume (int volume ) = 0 |
| virtual QMediaPlayer::State | state () const = 0 |
| virtual void | stop () = 0 |
| virtual int | volume () const = 0 |
| void | audioAvailableChanged (bool audioAvailable ) |
| void | availablePlaybackRangesChanged (const QMediaTimeRange & ranges ) |
| void | bufferStatusChanged (int percentFilled ) |
| void | durationChanged (qint64 duration ) |
| void | error (int error , const QString & errorString ) |
| void | mediaChanged (const QMediaContent & content ) |
| void | mediaStatusChanged (QMediaPlayer::MediaStatus status ) |
| void | mutedChanged (bool mute ) |
| void | playbackRateChanged (qreal rate ) |
| void | positionChanged (qint64 position ) |
| void | seekableChanged (bool seekable ) |
| void | stateChanged (QMediaPlayer::State newState ) |
| void | videoAvailableChanged (bool videoAvailable ) |
| void | volumeChanged (int volume ) |
| QMediaPlayerControl (QObject * parent = nullptr) |
| QMediaPlayerControl_iid |
若 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 ,和 buffering progress.
The functionality provided by this control is exposed to application code through the QMediaPlayer 類。
The interface name of QMediaPlayerControl is
org.qt-project.qt.mediaplayercontrol/5.0
作為定義在
QMediaPlayerControl_iid
.
另請參閱 QMediaService::requestControl () 和 QMediaPlayer .
[protected]
QMediaPlayerControl::
QMediaPlayerControl
(
QObject
*
parent
= nullptr)
Constructs a new media player control with the given parent .
[signal]
void
QMediaPlayerControl::
audioAvailableChanged
(
bool
audioAvailable
)
Signals that there has been a change in the availability of audio output audioAvailable .
另請參閱 isAudioAvailable ().
[signal]
void
QMediaPlayerControl::
availablePlaybackRangesChanged
(const
QMediaTimeRange
&
ranges
)
Signals that the available media playback ranges have changed.
另請參閱 QMediaPlayerControl::availablePlaybackRanges ().
[signal]
void
QMediaPlayerControl::
bufferStatusChanged
(
int
percentFilled
)
發射信號,當以百分比方式錶示本地緩衝填充量通過 percentFilled .
另請參閱 bufferStatus ().
[signal]
void
QMediaPlayerControl::
durationChanged
(
qint64
duration
)
發射信號,當 duration 若當前媒體已改變。
另請參閱 duration ().
[signal]
void
QMediaPlayerControl::
error
(
int
error
, const
QString
&
errorString
)
發射信號,當 error 齣現。 errorString provides a more detailed explanation.
[signal]
void
QMediaPlayerControl::
mediaChanged
(const
QMediaContent
&
content
)
Signals that the current media content 已改變。
[signal]
void
QMediaPlayerControl::
mediaStatusChanged
(
QMediaPlayer::MediaStatus
status
)
發射信號,當 status 若當前媒體已改變。
另請參閱 mediaStatus ().
[signal]
void
QMediaPlayerControl::
mutedChanged
(
bool
mute
)
Signals a change in the mute status of a player control.
另請參閱 isMuted ().
[signal]
void
QMediaPlayerControl::
playbackRateChanged
(
qreal
rate
)
Signal emitted when playback rate changes to rate .
[signal]
void
QMediaPlayerControl::
positionChanged
(
qint64
position
)
Signals the playback position 已改變。
This is only emitted in when there has been a discontinous change in the playback postion, such as a seek or the position being reset.
另請參閱 position ().
[signal]
void
QMediaPlayerControl::
seekableChanged
(
bool
seekable
)
發射信號,當 seekable state of a player control has changed.
另請參閱 isSeekable ().
[signal]
void
QMediaPlayerControl::
stateChanged
(
QMediaPlayer::State
newState
)
Signals that the state of a player control has changed to newState .
另請參閱 state ().
[signal]
void
QMediaPlayerControl::
videoAvailableChanged
(
bool
videoAvailable
)
Signal that the availability of visual content has changed to videoAvailable .
另請參閱 isVideoAvailable ().
[signal]
void
QMediaPlayerControl::
volumeChanged
(
int
volume
)
Signals the audio volume of a player control has changed.
另請參閱 volume ().
[虛擬]
QMediaPlayerControl::
~QMediaPlayerControl
()
Destroys a media player control.
[pure virtual]
QMediaTimeRange
QMediaPlayerControl::
availablePlaybackRanges
() const
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.
[pure virtual]
int
QMediaPlayerControl::
bufferStatus
() const
Returns the buffering progress of the current media. Progress is measured in the percentage of the buffer filled.
[pure virtual]
qint64
QMediaPlayerControl::
duration
() const
Returns the duration of the current media in milliseconds.
[pure virtual]
bool
QMediaPlayerControl::
isAudioAvailable
() const
Identifies if there is audio output available for the current media.
Returns true if audio output is available and false otherwise.
[pure virtual]
bool
QMediaPlayerControl::
isMuted
() const
Returns the mute state of a player control.
[pure virtual]
bool
QMediaPlayerControl::
isSeekable
() const
Identifies if the current media is seekable.
Returns true if it possible to seek within the current media, and false otherwise.
[pure virtual]
bool
QMediaPlayerControl::
isVideoAvailable
() const
Identifies if there is video output available for the current media.
Returns true if video output is available and false otherwise.
[pure virtual]
QMediaContent
QMediaPlayerControl::
media
() const
Returns the current media source.
另請參閱 setMedia ().
[pure virtual]
QMediaPlayer::MediaStatus
QMediaPlayerControl::
mediaStatus
() const
Returns the status of the current media.
[pure virtual]
const
QIODevice
*QMediaPlayerControl::
mediaStream
() const
Returns the current media stream. This is only a valid if a stream was passed to setMedia ().
另請參閱 setMedia ().
[pure virtual]
void
QMediaPlayerControl::
pause
()
Pauses playback of the current media.
If successful the player control will immediately enter the paused 狀態。
另請參閱 state (), play (),和 stop ().
[pure virtual]
void
QMediaPlayerControl::
play
()
Starts playback of the current media.
If successful the player control will immediately enter the playing 狀態。
另請參閱 state ().
[pure virtual]
qreal
QMediaPlayerControl::
playbackRate
() const
Returns the rate of playback.
另請參閱 setPlaybackRate ().
[pure virtual]
qint64
QMediaPlayerControl::
position
() const
Returns the current playback position in milliseconds.
另請參閱 setPosition ().
[pure virtual]
void
QMediaPlayerControl::
setMedia
(const
QMediaContent
&
media
,
QIODevice
*
stream
)
設置當前 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.
將媒體設為 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 QMediaServiceProviderHint::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.
另請參閱 media ().
[pure virtual]
void
QMediaPlayerControl::
setMuted
(
bool
mute
)
設置 mute state of a player control.
另請參閱 isMuted ().
[pure virtual]
void
QMediaPlayerControl::
setPlaybackRate
(
qreal
rate
)
設置 rate of playback.
另請參閱 playbackRate ().
[pure virtual]
void
QMediaPlayerControl::
setPosition
(
qint64
position
)
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.
另請參閱 position ().
[pure virtual]
void
QMediaPlayerControl::
setVolume
(
int
volume
)
設置音頻 volume of a player control.
The volume is scaled linearly, ranging from
0
(無聲) 到
100
(full volume).
另請參閱 volume ().
[pure virtual]
QMediaPlayer::State
QMediaPlayerControl::
state
() const
Returns the state of a player control.
[pure virtual]
void
QMediaPlayerControl::
stop
()
Stops playback of the current media.
If successful the player control will immediately enter the stopped 狀態。
[pure virtual]
int
QMediaPlayerControl::
volume
() const
Returns the audio volume of a player control.
另請參閱 setVolume ().
org.qt-project.qt.mediaplayercontrol/5.0
定義接口名為 QMediaPlayerControl 類。