Added seek() function to QML Video item and updated documentation.
The Video item inline example was wrong, changing read-only properties. Task-number: QTBUG-28741 Change-Id: Ia1f6c1110a301a96743e7ebfec51731fcaf6a862 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@gmail.com>
This commit is contained in:
committed by
The Qt Project
parent
da55ada028
commit
304fdbeeb1
@@ -73,9 +73,9 @@ import QtMultimedia 5.0
|
|||||||
}
|
}
|
||||||
|
|
||||||
focus: true
|
focus: true
|
||||||
Keys.onSpacePressed: video.paused = !video.paused
|
Keys.onSpacePressed: video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
|
||||||
Keys.onLeftPressed: video.position -= 5000
|
Keys.onLeftPressed: video.seek(video.position - 5000)
|
||||||
Keys.onRightPressed: video.position += 5000
|
Keys.onRightPressed: video.seek(video.position + 5000)
|
||||||
}
|
}
|
||||||
\endqml
|
\endqml
|
||||||
|
|
||||||
@@ -265,6 +265,10 @@ Item {
|
|||||||
\qmlproperty int Video::position
|
\qmlproperty int Video::position
|
||||||
|
|
||||||
This property holds the current playback position in milliseconds.
|
This property holds the current playback position in milliseconds.
|
||||||
|
|
||||||
|
To change this position, use the \l seek() method.
|
||||||
|
|
||||||
|
\sa seek()
|
||||||
*/
|
*/
|
||||||
property alias position: player.position
|
property alias position: player.position
|
||||||
|
|
||||||
@@ -273,6 +277,8 @@ Item {
|
|||||||
|
|
||||||
This property holds whether the playback position of the video can be
|
This property holds whether the playback position of the video can be
|
||||||
changed.
|
changed.
|
||||||
|
|
||||||
|
If true, calling the \l seek() method will cause playback to seek to the new position.
|
||||||
*/
|
*/
|
||||||
property alias seekable: player.seekable
|
property alias seekable: player.seekable
|
||||||
|
|
||||||
@@ -313,6 +319,8 @@ Item {
|
|||||||
\qmlproperty bool Video::autoPlay
|
\qmlproperty bool Video::autoPlay
|
||||||
|
|
||||||
This property determines whether the media should begin playback automatically.
|
This property determines whether the media should begin playback automatically.
|
||||||
|
|
||||||
|
Setting to \c true also sets \l autoLoad to \c true. The default is \c false.
|
||||||
*/
|
*/
|
||||||
property alias autoPlay: player.autoPlay
|
property alias autoPlay: player.autoPlay
|
||||||
|
|
||||||
@@ -377,6 +385,21 @@ Item {
|
|||||||
player.stop();
|
player.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\qmlmethod Video::seek(offset)
|
||||||
|
|
||||||
|
If the \l seekable property is true, seeks the current
|
||||||
|
playback position to \a offset.
|
||||||
|
|
||||||
|
Seeking may be asynchronous, so the \l position property
|
||||||
|
may not be updated immediately.
|
||||||
|
|
||||||
|
\sa seekable, position
|
||||||
|
*/
|
||||||
|
function seek(offset) {
|
||||||
|
player.seek(offset);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***************************************
|
// ***************************************
|
||||||
|
|||||||
Reference in New Issue
Block a user