adding a playpause ability in videos
This commit is contained in:
parent
8b7cd23f8b
commit
9a180f7df0
5 changed files with 73 additions and 6 deletions
|
@ -119,7 +119,7 @@ Item {
|
|||
visible: itemType === "video";
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
onPressed: print("pressed play/plause");
|
||||
onPressed: SlideObject.playPause();
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
}
|
||||
}
|
||||
|
@ -149,6 +149,22 @@ Item {
|
|||
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: SlideObject
|
||||
onVideoBackgroundChanged: {
|
||||
loadVideo();
|
||||
}
|
||||
onIsPlayingChanged: {
|
||||
if(SlideObject.isPlaying)
|
||||
previewSlide.playVideo();
|
||||
pauseVideo();
|
||||
}
|
||||
}
|
||||
|
||||
function pauseVideo() {
|
||||
previewSlide.pauseVideo();
|
||||
}
|
||||
|
||||
function loadVideo() {
|
||||
previewSlide.loadVideo();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ Window {
|
|||
width: maximumWidth
|
||||
screen: presentationScreen
|
||||
/* flags: Qt.X11BypassWindowManagerHint */
|
||||
onClosing: presenting = false
|
||||
onClosing: close()
|
||||
|
||||
Component.onCompleted: {
|
||||
presentationWindow.showFullScreen();
|
||||
|
@ -34,6 +34,11 @@ Window {
|
|||
onVideoBackgroundChanged: {
|
||||
loadVideo();
|
||||
}
|
||||
onIsPlayingChanged: {
|
||||
if(SlideObject.isPlaying)
|
||||
presentationSlide.playVideo();
|
||||
pauseVideo();
|
||||
}
|
||||
}
|
||||
|
||||
function loadVideo() {
|
||||
|
@ -43,4 +48,14 @@ Window {
|
|||
function stopVideo() {
|
||||
presentationSlide.stopVideo()
|
||||
}
|
||||
|
||||
function pauseVideo() {
|
||||
presentationSlide.pauseVideo();
|
||||
}
|
||||
|
||||
function close() {
|
||||
presentationSlide.stopVideo();
|
||||
SlideObject.pause();
|
||||
presenting = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ Item {
|
|||
|
||||
MpvObject {
|
||||
id: mpv
|
||||
objectName: "mpv"
|
||||
/* objectName: "mpv" */
|
||||
anchors.fill: parent
|
||||
useHwdec: true
|
||||
enableAudio: !preview
|
||||
|
@ -178,4 +178,8 @@ Item {
|
|||
function playPauseVideo() {
|
||||
mpv.playPause();
|
||||
}
|
||||
|
||||
function playVideo() {
|
||||
mpv.play();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue