用于展示指定视频的方便类型。 更多...
| import 语句: | import QtMultimedia 5.15 |
| 继承: |
视频
is a convenience type combining the functionality of a
MediaPlayer
和
VideoOutput
into one. It provides simple video playback functionality without having to declare multiple types.
Video { id: video width : 800 height : 600 source: "video.avi" MouseArea { anchors.fill: parent onClicked: { video.play() } } focus: true Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play() Keys.onLeftPressed: video.seek(video.position - 5000) Keys.onRightPressed: video.seek(video.position + 5000) }
视频
supports untransformed, stretched, and uniformly scaled video presentation. For a description of stretched uniformly scaled presentation, see the
fillMode
property description.
另请参阅 MediaPlayer and VideoOutput .
|
audioRole : enumeration |
This property holds the role of the audio stream. It can be set to specify the type of audio being played, allowing the system to make appropriate decisions when it comes to volume, routing or post-processing.
The audio role must be set before setting the source property.
可以检索支持的值,采用 supportedAudioRoles() .
值可以是之一:
customAudioRole is cleared when this property is set to anything other than CustomRole.
该特性在 Qt 5.6 引入。
|
autoLoad : bool |
This property indicates if loading of media should begin immediately.
Defaults to true, if false media will not be loaded until playback is started.
|
autoPlay : bool |
This property determines whether the media should begin playback automatically.
Setting to
true
also sets
autoLoad
to
true
。默认为
false
.
|
availability : enumeration |
Returns the availability state of the video instance.
This is one of:
| 值 | 描述 |
|---|---|
| MediaPlayer .Available | The video player is available to use. |
| MediaPlayer .Busy | The video player is usually available, but some other process is utilizing the hardware necessary to play media. |
| MediaPlayer .Unavailable | There are no supported video playback facilities. |
| MediaPlayer .ResourceMissing | There is one or more resources missing, so the video player cannot be used. It may be possible to try again at a later time. |
|
bufferProgress : real |
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 (full).
|
customAudioRole : string |
This property holds the role of the audio stream when the backend supports audio roles unknown to Qt. It can be set to specify the type of audio being played, allowing the system to make appropriate decisions when it comes to volume, routing or post-processing.
The audio role must be set before setting the source property.
audioRole is set to CustomRole when this property is set.
该特性在 Qt 5.11 引入。
|
duration : int |
This property holds the duration of the media in milliseconds.
If the media doesn't have a fixed duration (a live stream for example) this will be 0.
|
error : enumeration |
This property holds the error state of the video. It can be one of:
|
errorString : string |
This property holds a string describing the current error condition in more detail.
|
fillMode : enumeration |
Set this property to define how the video is scaled to fit the target area.
Because this type is for convenience in QML, it does not support enumerations directly, so enumerations from
VideoOutput
are used to access the available fill modes.
The default fill mode is preserveAspectFit.
|
flushMode : enumeration |
Set this property to define what
视频
should show when playback is finished or stopped.
The default flush mode is EmptyFrame.
该特性在 Qt 5.15 引入。
|
hasAudio : bool |
This property holds whether the current media has audio content.
|
hasVideo : bool |
This property holds whether the current media has video content.
|
loops : int |
This property holds the number of times the media is played. A value of
0
or
1
means the media will be played only once; set to
MediaPlayer.Infinite
以启用无限循环。
The value can be changed while the media is playing, in which case it will update the remaining loops to the new value.
默认为
1
.
该特性在 Qt 5.9 引入。
This property holds the meta data for the current media.
见 MediaPlayer.metaData for details about each meta data key.
另请参阅 QMediaMetaData .
|
muted : bool |
此特性保持音频输出是否静音。
|
notifyInterval : int |
The interval at which notifiable properties will update.
须申报特性是 position and bufferProgress .
The interval is expressed in milliseconds, the default value is 1000.
该特性在 Qt 5.9 引入。
|
orientation : int |
The orientation of the
视频
in degrees. Only multiples of 90 degrees is supported, that is 0, 90, 180, 270, 360, etc.
|
playbackRate : real |
This property holds the rate at which video is played at as a multiple of the normal rate.
|
playbackState : enumeration |
This read only property indicates the playback state of the media.
The default state is MediaPlayer .StoppedState.
|
playlist : Playlist |
此特性保持用于媒体播放器的播放列表。
设置播放列表特性重置 source 成空字符串。
该特性在 Qt 5.6 引入。
|
position : int |
此特性保持当前的回放位置 (以毫秒为单位)。
要改变此位置,使用 seek() 方法。
另请参阅 seek() .
|
seekable : bool |
This property holds whether the playback position of the video can be changed.
若 true,调用 seek() method will cause playback to seek to the new position.
|
source : url |
此特性保持媒体的源 URL (统一资源定位符)。
Setting the source property clears the current playlist ,若有的话。
|
status : enumeration |
This property holds the status of media loading. It can be one of:
|
volume : real |
此特性保持音频音量。
按线性比例缩放的音量是从
0.0
(无声) 到
1.0
(全音量)。将钳制超出此范围的值。
默认音量为
1.0
.
通常,UI 音量控件应按非线性比例缩放。例如,使用对数比例缩放将产生感知响度的线性变化,这通常是用户期望的音量控制。见 QtMultimedia.convertVolume() 了解更多细节。
此信号发射,当暂停回放时。
相应处理程序是
onPaused
.
注意:
相应处理程序是
onPaused
.
This signal is emitted when playback is started or continued.
相应处理程序是
onPlaying
.
注意:
相应处理程序是
onPlaying
.
此信号发射,当停止回放时。
相应处理程序是
onStopped
.
注意:
相应处理程序是
onStopped
.
暂停媒体回放。
开始媒体回放。
若 seekable property is true, seeks the current playback position to offset .
Seeking may be asynchronous, so the position property may not be updated immediately.
停止媒体回放。
返回支持的音频角色列表。
若不支持设置的音频角色,返回空列表。
该方法在 Qt 5.6 引入。
另请参阅 audioRole .