QMediaPlayer 類允許播放媒體文件。 更多...
| 頭: |
#include <QMediaPlayer>
|
| CMake: |
find_package(Qt6 REQUIRED COMPONENTS Multimedia)
target_link_libraries(mytarget PRIVATE Qt6::Multimedia)
|
| qmake: |
QT += multimedia
|
| 在 QML: | MediaPlayer |
| 繼承: | QObject |
| enum | Error { NoError, ResourceError, FormatError, NetworkError, AccessDeniedError } |
| enum | Loops { Infinite, Once } |
| enum | MediaStatus { NoMedia, LoadingMedia, LoadedMedia, StalledMedia, BufferingMedia, …, InvalidMedia } |
(從 6.10 起)
枚舉類
|
PitchCompensationAvailability { AlwaysOn, Available, Unavailable } |
| enum | PlaybackState { StoppedState, PlayingState, PausedState } |
|
|
| QMediaPlayer (QObject * parent = nullptr) | |
| virtual | ~QMediaPlayer () override |
| int | activeAudioTrack () const |
| int | activeSubtitleTrack () const |
| int | activeVideoTrack () const |
| QAudioBufferOutput * | audioBufferOutput () const |
| QAudioOutput * | audioOutput () const |
| QList<QMediaMetaData> | audioTracks () const |
| float | bufferProgress () const |
| QMediaTimeRange | bufferedTimeRange () const |
| qint64 | duration () const |
| QMediaPlayer::Error | error () const |
| QString | errorString () const |
| bool | hasAudio () const |
| bool | hasVideo () const |
| bool | isAvailable () const |
| bool | isPlaying () const |
| bool | isSeekable () const |
| int | loops () const |
| QMediaPlayer::MediaStatus | mediaStatus () const |
| QMediaMetaData | metaData () const |
(從 6.10 起)
bool
|
pitchCompensation () const |
(從 6.10 起)
QMediaPlayer::PitchCompensationAvailability
|
pitchCompensationAvailability () const |
| QPlaybackOptions | playbackOptions () const |
| qreal | playbackRate () const |
| QMediaPlayer::PlaybackState | playbackState () const |
| qint64 | position () const |
| void | setActiveAudioTrack (int index ) |
| void | setActiveSubtitleTrack (int index ) |
| void | setActiveVideoTrack (int index ) |
| void | setAudioBufferOutput (QAudioBufferOutput * output ) |
| void | setAudioOutput (QAudioOutput * output ) |
| void | setLoops (int loops ) |
| void | setVideoOutput (QObject *) |
| void | setVideoSink (QVideoSink * sink ) |
| QUrl | source () const |
| const QIODevice * | sourceDevice () const |
| QList<QMediaMetaData> | subtitleTracks () const |
| QObject * | videoOutput () const |
| QVideoSink * | videoSink () const |
| QList<QMediaMetaData> | videoTracks () const |
| void | pause () |
| void | play () |
| void | resetPlaybackOptions () |
(從 6.10 起)
void
|
setPitchCompensation (bool enabled ) const |
| void | setPlaybackOptions (const QPlaybackOptions & options ) |
| void | setPlaybackRate (qreal rate ) |
| void | setPosition (qint64 position ) |
| void | setSource (const QUrl & source ) |
| void | setSourceDevice (QIODevice * device , const QUrl & sourceUrl = QUrl()) |
| void | stop () |
| void | activeTracksChanged () |
| void | audioBufferOutputChanged () |
| void | audioOutputChanged () |
| void | bufferProgressChanged (float filled ) |
| void | durationChanged (qint64 duration ) |
| void | errorChanged () |
| void | errorOccurred (QMediaPlayer::Error error , const QString & errorString ) |
| void | hasAudioChanged (bool available ) |
| void | hasVideoChanged (bool videoAvailable ) |
| void | loopsChanged () |
| void | mediaStatusChanged (QMediaPlayer::MediaStatus status ) |
| void | metaDataChanged () |
| void | pitchCompensationChanged (bool) |
| void | playbackOptionsChanged () |
| void | playbackRateChanged (qreal rate ) |
| void | playbackStateChanged (QMediaPlayer::PlaybackState newState ) |
| void | playingChanged (bool playing ) |
| void | positionChanged (qint64 position ) |
| void | seekableChanged (bool seekable ) |
| void | sourceChanged (const QUrl & media ) |
| void | tracksChanged () |
| void | videoOutputChanged () |
QMediaPlayer 類是高級媒體迴放類。它可以用於迴放視頻媒體文件的音頻。要播放內容的指定為 QUrl 對象。
player = new QMediaPlayer; audioOutput = new QAudioOutput; player->setAudioOutput(audioOutput); connect(player, &QMediaPlayer::positionChanged, this, &MediaExample::positionChanged); player->setSource(QUrl::fromLocalFile("/Users/me/Music/coolsong.mp3")); audioOutput->setVolume(0.5); player->play();
QVideoWidget 可以用於 QMediaPlayer 為渲染視頻。
另請參閱 QVideoWidget .
定義媒體播放器錯誤條件。
| 常量 | 值 | 描述 |
|---|---|---|
QMediaPlayer::NoError
|
0
|
沒有齣現錯誤。 |
QMediaPlayer::ResourceError
|
1
|
無法解析媒體資源。 |
QMediaPlayer::FormatError
|
2
|
不 (完全) 支持媒體資源格式。仍可能可以迴放,但沒有音頻或視頻組件。 |
QMediaPlayer::NetworkError
|
3
|
發生網絡錯誤。 |
QMediaPlayer::AccessDeniedError
|
4
|
沒有適當權限來播放媒體資源。 |
一些預定義常量對於 loops 特性。
| 常量 | 值 | 描述 |
|---|---|---|
QMediaPlayer::Infinite
|
-1
|
永遠循環。 |
QMediaPlayer::Once
|
1
|
播放媒體一次 (默認)。 |
定義媒體播放器當前媒體的狀態。
| 常量 | 值 | 描述 |
|---|---|---|
QMediaPlayer::NoMedia
|
0
|
當前沒有媒體。播放器處於 StoppedState . |
QMediaPlayer::LoadingMedia
|
1
|
正加載當前媒體。播放器可能處於任何狀態。 |
QMediaPlayer::LoadedMedia
|
2
|
當前媒體已加載。播放器處於 StoppedState . |
QMediaPlayer::StalledMedia
|
3
|
當前媒體的迴放已失速,由於緩衝不足或某些其它臨時中斷。播放器在 PlayingState or PausedState . |
QMediaPlayer::BufferingMedia
|
4
|
播放器在緩衝數據,但已緩衝足夠數據為未來能立即繼續迴放。播放器在 PlayingState or PausedState . |
QMediaPlayer::BufferedMedia
|
5
|
播放器已完全緩衝當前媒體。播放器處於 PlayingState or PausedState . |
QMediaPlayer::EndOfMedia
|
6
|
迴放已到達當前媒體結尾。播放器處於 StoppedState . |
QMediaPlayer::InvalidMedia
|
7
|
當前媒體無法播放。播放器處於 StoppedState . |
[since 6.10]
enum class QMediaPlayer::
PitchCompensationAvailability
Availablility of pitch compensation.
Different backends have different behavior regarding pitch compensation when changing playback rate.
| 常量 | 值 | 描述 |
|---|---|---|
QMediaPlayer::PitchCompensationAvailability::AlwaysOn
|
0
|
The media player is always performing pitch compensation. |
QMediaPlayer::PitchCompensationAvailability::Available
|
1
|
The media player can be configured to use pitch compensation. If pitch compensation is available on the current platform, it will be enabled by default, but users can disable if needed. |
QMediaPlayer::PitchCompensationAvailability::Unavailable
|
2
|
The media player is not able to perform pitch compensation on the current platform. |
This enum was introduced in Qt 6.10.
定義媒體播放器的當前狀態。
| 常量 | 值 | 描述 |
|---|---|---|
QMediaPlayer::StoppedState
|
0
|
媒體播放器未播放內容,迴放將從當前軌道的起始開始。 |
QMediaPlayer::PlayingState
|
1
|
媒體播放器目前正在播放內容。此指示如同 playing 特性。 |
QMediaPlayer::PausedState
|
2
|
媒體播放器已暫停迴放,當前軌道的迴放將從播放器暫停位置處再繼續。 |
返迴目前活動的音頻軌道。
默認情況下,將選取第一可用音頻軌道。
Set
index
to
-1
以禁用所有音頻軌道。
訪問函數:
| int | activeAudioTrack () const |
| void | setActiveAudioTrack (int index ) |
通知程序信號:
| void | activeTracksChanged () |
返迴目前活動的字幕軌道。
Set
index
to
-1
以禁用字幕。
默認情況下,禁用字幕。
訪問函數:
| int | activeSubtitleTrack () const |
| void | setActiveSubtitleTrack (int index ) |
通知程序信號:
| void | activeTracksChanged () |
返迴當前活動的視頻軌道。
默認情況下,將選取第一可用音頻軌道。
Set
index
to
-1
以禁用所有視頻軌道。
訪問函數:
| int | activeVideoTrack () const |
| void | setActiveVideoTrack (int index ) |
通知程序信號:
| void | activeTracksChanged () |
[since 6.8]
audioBufferOutput
:
QAudioBufferOutput
*
This property holds the output audio buffer used by the media player.
Sets an audio buffer output 到媒體播放器。
若
QAudioBufferOutput
is specified and the media source contains an audio stream, the media player, it will emit the signal
QAudioBufferOutput::audioBufferReceived
with audio buffers containing decoded audio data. At the end of the audio stream,
QMediaPlayer
emits an empty
QAudioBuffer
.
QMediaPlayer
emits outputs audio buffers at the same time as it pushes the matching data to the audio output if it's specified. However, the sound can be played with a small delay due to audio bufferization.
The format of emitted audio buffers is taken from the specified output or from the matching audio stream if the output returns an invalid format. Emitted audio data is not scaled depending on the current playback rate.
Potential use cases of utilizing
QAudioBufferOutput
with
QMediaPlayer
might be:
1
, you may scale the output image dimensions, or image update interval according to the requirements of the visualizer.
該特性在 Qt 6.8 引入。
訪問函數:
| QAudioBufferOutput * | audioBufferOutput () const |
| void | setAudioBufferOutput (QAudioBufferOutput * output ) |
通知程序信號:
| void | audioBufferOutputChanged () |
此特性保持媒體播放器所用的音頻輸齣設備。
當迴放媒體時要使用的當前音頻輸齣。設置新的音頻輸齣將替換目前使用的輸齣。
把此特性設為
nullptr
將禁用任何音頻輸齣。
訪問函數:
| QAudioOutput * | audioOutput () const |
| void | setAudioOutput (QAudioOutput * output ) |
通知程序信號:
| void | audioOutputChanged () |
[read-only]
audioTracks
: const
QList
<
QMediaMetaData
>
列齣媒體內的可用音頻軌道集。
The QMediaMetaData 返迴單個軌道的特性描述。
Different audio tracks can for example contain audio in different languages.
訪問函數:
| QList<QMediaMetaData> | audioTracks () const |
通知程序信號:
| void | tracksChanged () |
[read-only]
bufferProgress
: const
float
此特性保持填充臨時緩衝的百分比,在迴放開始 (或再繼續) 前。從
0
. (empty) to
1
. (full).
當緩衝播放器對象時,此特性保持填充臨時緩衝的百分比。在迴放可以開始 (或再繼續) 前,填充緩衝需要達到 100%,此時
mediaStatus
() 會返迴
BufferedMedia
or
BufferingMedia
。若是任何值小於
100
,
mediaStatus
() 會返迴
StalledMedia
.
訪問函數:
| float | bufferProgress () const |
通知程序信號:
| void | bufferProgressChanged (float filled ) |
另請參閱 mediaStatus ().
[read-only]
duration
: const
qint64
此特性保持當前媒體的持續時間。
值是當前媒體的總迴放時間 (以毫秒為單位)。值可能跨存活時間改變對於 QMediaPlayer 對象且可能不可用 (當初始迴放開始時),連接到 durationChanged () 信號以接收狀態通知。
訪問函數:
| qint64 | duration () const |
通知程序信號:
| void | durationChanged (qint64 duration ) |
[read-only]
error
: const
Error
此特性保持描述最後一個錯誤條件的字符串。
訪問函數:
| QMediaPlayer::Error | error () const |
通知程序信號:
| void | errorChanged () |
另請參閱 error ().
[read-only]
errorString
: const
QString
This property holds a string describing the current error condition in more detail.
訪問函數:
| QString | errorString () const |
通知程序信號:
| void | errorChanged () |
[read-only]
hasAudio
: const
bool
此特性保持媒體是否包含音頻。
訪問函數:
| bool | hasAudio () const |
通知程序信號:
| void | hasAudioChanged (bool available ) |
[read-only]
hasVideo
: const
bool
此特性保持媒體是否包含視頻。
訪問函數:
| bool | hasVideo () const |
通知程序信號:
| void | hasVideoChanged (bool videoAvailable ) |
Determines how often the media is played before the player stops. Set to QMediaPlayer::Infinite to loop the current media file forever.
默認值為
1
。把此特性設為
0
不起作用。
訪問函數:
| int | loops () const |
| void | setLoops (int loops ) |
通知程序信號:
| void | loopsChanged () |
[read-only]
mediaStatus
: const
MediaStatus
此特性保持當前媒體流的狀態。
流狀態描述當前流的迴放進展。
默認情況下此特性為 QMediaPlayer::NoMedia
訪問函數:
| QMediaPlayer::MediaStatus | mediaStatus () const |
通知程序信號:
| void | mediaStatusChanged (QMediaPlayer::MediaStatus status ) |
[read-only]
metaData
: const
QMediaMetaData
返迴媒體播放器當前所用的媒體元數據。
元數據可以包含如視頻標題 (或其創建日期) 的信息。
注意: Windows 實現僅為位於本地文件係統中的媒體提供元數據。
訪問函數:
| QMediaMetaData | metaData () const |
通知程序信號:
| void | metaDataChanged () |
[since 6.10]
pitchCompensation
:
bool
This property holds the pitch compensation status of the media player.
Indicates whether pitch compensation is enabled. When enabled, changing the playback rate will not affect the pitch of the audio signal.
注意: The pitch compensation will increase the CPU load of the QMediaPlayer .
By default is
true
if pitch compensation, is available, else
false
.
此特性在 Qt 6.10 引入。
訪問函數:
| bool | pitchCompensation () const |
| void | setPitchCompensation (bool enabled ) const |
通知程序信號:
| void | pitchCompensationChanged (bool) |
[read-only, since 6.10]
pitchCompensationAvailability
: const
PitchCompensationAvailability
This property holds the pitch compensation availability of the current QtMultimedia backend.
Indicates the availability of pitch compensation of the QMediaPlayer on the current backend.
注意: Different backends may have different behavior.
更多信息,見 QMediaPlayer::PitchCompensationAvailability .
此特性在 Qt 6.10 引入。
訪問函數:
| QMediaPlayer::PitchCompensationAvailability | pitchCompensationAvailability () const |
[since 6.10]
playbackOptions
:
QPlaybackOptions
Advanced playback options used to configure media playback and decoding.
This property exposes the QPlaybackOptions API that gives low-level control of media playback options. Although we strongly recommend to rely on the default settings of QMediaPlayer , this API can be used to optimize media playback for specific use cases where the default options are not ideal.
Playback options take effect the next time QMediaPlayer::setSource () 被調用。
此特性在 Qt 6.10 引入。
訪問函數:
| QPlaybackOptions | playbackOptions () const |
| void | setPlaybackOptions (const QPlaybackOptions & options ) |
| void | resetPlaybackOptions () |
通知程序信號:
| void | playbackOptionsChanged () |
此特性保持當前媒體的迴放速率。
This value is a multiplier applied to the media's standard playback rate. By default this value is 1.0, indicating that the media is playing at the standard speed. Values higher than 1.0 will increase the playback speed, while values between 0.0 and 1.0 results in slower playback. Negative playback rates are not supported.
並非所有迴放服務,都支持迴放速率的改變。它由音頻和視頻狀態和品質的框架定義,當快進 (或倒帶) 時。
訪問函數:
| qreal | playbackRate () const |
| void | setPlaybackRate (qreal rate ) |
通知程序信號:
| void | playbackRateChanged (qreal rate ) |
[read-only]
playbackState
: const
PlaybackState
返迴 PlaybackState .
訪問函數:
| QMediaPlayer::PlaybackState | playbackState () const |
通知程序信號:
| void | playbackStateChanged (QMediaPlayer::PlaybackState newState ) |
另請參閱 playing .
[read-only, since 6.5]
playing
: const
bool
此特性保持媒體是否在播放。
該特性在 Qt 6.5 引入。
訪問函數:
| bool | isPlaying () const |
通知程序信號:
| void | playingChanged (bool playing ) |
另請參閱 playbackState and PlayingState .
此特性保持當前媒體的迴放位置。
The value is the current playback position, expressed in milliseconds since the beginning of the media. Periodically changes in the position will be indicated with the positionChanged () 信號。
若 seekable property is true, this property can be set to milliseconds.
訪問函數:
| qint64 | position () const |
| void | setPosition (qint64 position ) |
通知程序信號:
| void | positionChanged (qint64 position ) |
[read-only]
seekable
: const
bool
此特性保持當前媒體的可尋址狀態
若支持尋址,此特性為 true;否則為 false。此特性的狀態可能改變,當跨存活時間在 QMediaPlayer 對象,使用 seekableChanged 信號以監視改變。
訪問函數:
| bool | isSeekable () const |
通知程序信號:
| void | seekableChanged (bool seekable ) |
此特性保持播放器對象正在使用的活動媒體源。
播放器對象將使用 QUrl 為選擇要播放的內容。
默認情況下,此特性擁有 null QUrl .
將此特性設為 null QUrl 將導緻播放器丟棄與當前媒體源相關的所有信息,並停息與該媒體相關的所有 I/O 操作。
訪問函數:
| QUrl | source () const |
| void | setSource (const QUrl & source ) |
通知程序信號:
| void | sourceChanged (const QUrl & media ) |
另請參閱 QUrl .
[read-only]
subtitleTracks
: const
QList
<
QMediaMetaData
>
Lists the set of available subtitle tracks inside the media.
The QMediaMetaData 返迴單個軌道的特性描述。
訪問函數:
| QList<QMediaMetaData> | subtitleTracks () const |
通知程序信號:
| void | tracksChanged () |
This property holds the video output to be used by the media player.
A media player can only have one video output attached, so setting this property will replace the previously connected video output.
把此特性設為
nullptr
將禁用視頻輸齣。
訪問函數:
| QObject * | videoOutput () const |
| void | setVideoOutput (QObject *) |
通知程序信號:
| void | videoOutputChanged () |
[read-only]
videoTracks
: const
QList
<
QMediaMetaData
>
列齣媒體內的可用視頻軌道集。
The QMediaMetaData 返迴單個軌道的特性描述。
訪問函數:
| QList<QMediaMetaData> | videoTracks () const |
通知程序信號:
| void | tracksChanged () |
[explicit]
QMediaPlayer::
QMediaPlayer
(
QObject
*
parent
= nullptr)
構造 QMediaPlayer 實例作為子級對於 parent .
[override virtual noexcept]
QMediaPlayer::
~QMediaPlayer
()
銷毀播放器對象。
Returns a number between 0 and 1 when buffering data.
0 means that there is no buffered data available, playback is usually stalled in this case. Playback will resume once the buffer reaches 1, meaning enough data has been buffered to be able to resume playback.
bufferProgress() will always return 1 for local files.
注意: getter 函數對於特性 bufferProgress。
[signal]
void
QMediaPlayer::
bufferProgressChanged
(
float
filled
)
Signals the amount of the local buffer filled as a number between 0 and 1.
注意: 通知程序信號對於特性 bufferProgress .
返迴 QMediaTimeRange 描述目前緩衝的數據。
When streaming media from a remote source, different parts of the media file can be available locally. The returned QMediaTimeRange object describes the time ranges that are buffered and available for immediate playback.
另請參閱 QMediaTimeRange .
返迴當前媒體的持續時間,以毫秒為單位。
Returns 0 if the media player doesn't have a valid media file or stream. For live streams, the duration usually changes during playback as more data becomes available.
注意: getter 函數對於特性 duration。
[signal]
void
QMediaPlayer::
durationChanged
(
qint64
duration
)
Signals the duration of the content has changed to duration ,錶達 (以毫秒為單位)。
注意: 通知程序信號對於特性 duration .
返迴當前錯誤狀態。
注意: getter 函數對於特性 error。
[signal]
void
QMediaPlayer::
errorOccurred
(
QMediaPlayer::Error
error
, const
QString
&
errorString
)
發射信號,當 error condition has occurred, with errorString containing a description of the error.
另請參閱 errorString ().
[signal]
void
QMediaPlayer::
hasAudioChanged
(
bool
available
)
發射信號,當音頻內容的可用性已變成 available .
注意: 通知程序信號對於特性 hasAudio .
[signal]
void
QMediaPlayer::
hasVideoChanged
(
bool
videoAvailable
)
Signals the availability of visual content has changed to videoAvailable .
注意: 通知程序信號對於特性 hasVideo .
返迴 true,若此平颱支持媒體播放器。
Returns true if the media is seekable. Most file based media files are seekable, but live streams usually are not.
注意: getter 函數對於特性 seekable .
另請參閱 position .
[signal]
void
QMediaPlayer::
mediaStatusChanged
(
QMediaPlayer::MediaStatus
status
)
發射信號,當 status 若當前媒體已改變。
注意: 通知程序信號對於特性 mediaStatus .
另請參閱 mediaStatus ().
[slot]
void
QMediaPlayer::
pause
()
暫停播放當前源。
[since 6.10]
bool
QMediaPlayer::
pitchCompensation
() const
Returns the state of pitch compensation.
注意: Getter function for property pitchCompensation.
該函數在 Qt 6.10 引入。
另請參閱 setPitchCompensation ().
[since 6.10]
QMediaPlayer::PitchCompensationAvailability
QMediaPlayer::
pitchCompensationAvailability
() const
Returns availability of pitch compensation of the current backend.
注意: Getter function for property pitchCompensationAvailability.
該函數在 Qt 6.10 引入。
[slot]
void
QMediaPlayer::
play
()
開始 (或再繼續) 播放當前源。
返迴當前迴放速率。
注意: getter 函數對於特性 playbackRate。
另請參閱 setPlaybackRate ().
[signal]
void
QMediaPlayer::
playbackRateChanged
(
qreal
rate
)
信號 playbackRate 已變成 rate .
注意: 通知程序信號對於特性 playbackRate .
Returns the current position inside the media being played back in ms.
Returns 0 if the media player doesn't have a valid media file or stream. For live streams, the duration usually changes during playback as more data becomes available.
注意: getter 函數對於特性 position。
另請參閱 setPosition ().
[signal]
void
QMediaPlayer::
positionChanged
(
qint64
position
)
發射信號,當內容位置已變成 position ,錶達 (以毫秒為單位)。
注意: 通知程序信號對於特性 position .
[signal]
void
QMediaPlayer::
seekableChanged
(
bool
seekable
)
信號 seekable 播放器對象狀態已改變。
注意: 通知程序信號對於特性 seekable .
[slot, since 6.10]
void
QMediaPlayer::
setPitchCompensation
(
bool
enabled
) const
Sets the state ( enabled or disabled) of pitch compensation. This only has an effect if the audio pitch compensation can be configured on the backend at runtime.
注意: setter 函數對於特性 pitchCompensation .
該函數在 Qt 6.10 引入。
另請參閱 pitchCompensation ().
[slot]
void
QMediaPlayer::
setSource
(const
QUrl
&
source
)
設置當前 source .
將媒體設為 null QUrl will cause the player to discard all information relating to the current media source and to cease all I/O operations related to that media. Setting the media will stop the playback.
注意: This function returns immediately after recording the specified source of the media. It does not wait for the media to finish loading and does not check for errors. Listen for the mediaStatusChanged () 和 error () signals to be notified when the media is loaded and when an error occurs during loading.
注意: FFmpeg, used by the FFmpeg media backend, restricts use of nested protocols for security reasons. In controlled environments where all inputs are trusted, the list of approved protocols can be overridden using the QT_FFMPEG_PROTOCOL_WHITELIST environment variable. This environment variable is Qt's private API and can change between patch releases without notice.
注意: setter 函數對於特性 source .
另請參閱 source ().
[slot]
void
QMediaPlayer::
setSourceDevice
(
QIODevice
*
device
, const
QUrl
&
sourceUrl
= QUrl())
設置當前源 device .
媒體數據將讀取自 device 。 sourceUrl can be provided to resolve additional information about the media, mime type etc. The device must be open and readable.
對於 macOS device 還應該可尋址。
注意: This function returns immediately after recording the specified source of the media. It does not wait for the media to finish loading and does not check for errors. Listen for the mediaStatusChanged () 和 error () signals to be notified when the media is loaded, and if an error occurs during loading.
另請參閱 sourceDevice ().
設置 sink 為 QVideoSink 實例以檢索視頻數據。
另請參閱 videoSink ().
[signal]
void
QMediaPlayer::
sourceChanged
(const
QUrl
&
media
)
發射信號,當媒體源已變成 media .
注意: 通知程序信號對於特性 source .
返迴媒體數據的流源。
這纔有效,若把流傳遞給 setSource ().
另請參閱 setSourceDevice () 和 setSource ().
[slot]
void
QMediaPlayer::
stop
()
停止播放,然後將播放位置重置到起始。
返迴 QVideoSink 實例。
另請參閱 setVideoSink ().