用於展示指定視頻的方便類型。 更多...
| import 語句: | import QtMultimedia |
| 繼承: | Item |
視頻
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.
The following is sample code to implement video playback in a scene.
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.position = video.position - 5000 Keys.onRightPressed: video.position = video.position + 5000 }
The source file,
video.avi
, plays when you click the parent of
MouseArea
. The video plays in an area of 800 by 600 pixels, and its
id
property has the value
視頻
.
Notice that because signals for the Keys have been defined pressing the:
Video supports un-transformed, stretched, and uniformly scaled video presentation. For a description of stretched uniformly scaled presentation, see the fillMode property description.
另請參閱 MediaPlayer and VideoOutput .
|
bufferProgress : real |
This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0 (full).
|
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.
|
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 |
Determines how often the media is played before stopping. Set to MediaPlayer .Infinite to loop the current media file forever.
默認值為
1
。把此特性設為
0
不起作用。
|
metaData : mediaMetaData |
This property holds the meta data for the current media.
見 MediaPlayer.metaData for details about each meta data key.
另請參閱 mediaMetaData .
|
muted : bool |
此特性保持音頻輸齣是否靜音。
|
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.
|
position : int |
此特性保持當前的迴放位置 (以毫秒為單位)。
|
seekable : bool |
This property holds whether the playback position of the video can be changed.
若 true,調用 seek () method or changing the position property will cause playback to seek to the new position.
|
source : url |
此特性保持媒體的源 URL (統一資源定位符)。
|
volume : real |
此特性保持音頻音量。
按綫性比例縮放的音量是從
0.0
(無聲) 到
1.0
(全音量)。將鉗製超齣此範圍的值。
默認音量為
1.0
.
通常,UI 音量控件應按非綫性比例縮放。例如,使用對數比例縮放將産生感知響度的綫性變化,這通常是用戶期望的音量控製。見 QAudio::convertVolume () 瞭解更多細節。
|
errorOccurred ( error , errorString ) |
此信號發射,當 error 齣現。 errorString parameter may contain more detailed information about the error.
注意:
相應處理程序是
onErrorOccurred
.
|
paused () |
此信號發射,當暫停迴放時。
注意:
相應處理程序是
onPaused
.
|
playing () |
This signal is emitted when playback is started or continued.
注意:
相應處理程序是
onPlaying
.
|
stopped () |
此信號發射,當停止迴放時。
注意:
相應處理程序是
onStopped
.
|
pause () |
暫停媒體迴放。
|
play () |
開始媒體迴放。
|
seek ( offset ) |
若 seekable property is true, seeks the current playback position to offset .
|
stop () |
停止媒體迴放。