fixing presentation modes

This commit is contained in:
Chris Cochrun 2024-09-14 06:52:25 -05:00
parent c2a56cd24b
commit c9938df714
3 changed files with 38 additions and 79 deletions

View file

@ -35,12 +35,12 @@ Item {
property var vTextAlignment: Text.AlignVCenter
//these properties are for giving video info to parents
property int mpvPosition: mpv.position
property int mpvDuration: mpv.duration
property var mpvLoop: mpv.loop
property bool mpvIsPlaying: mpv.isPlaying
property int videoPosition: video.position
property int videoDuration: video.duration
property var videoLoop: video.loops
property bool videoIsPlaying: video.playbackState
// These properties help to determine the state of the slide
// These propees help to determine the state of the slide
property string itemType
property bool preview: false
@ -52,14 +52,30 @@ Item {
anchors.fill: parent
color: "black"
Image {
id: backgroundImage
anchors.fill: parent
source: imageSource
fillMode: itemType == "song" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
clip: true
visible: webSource.length == 0
currentFrame: pdfIndex
}
Rectangle {
id: black
color: "Black"
anchors.fill: parent
visible: false
}
Video {
id: video
/* objectName: "mpv" */
anchors.fill: parent
/* useHwdec: true */
muted: preview
Component.onCompleted: mpvLoadingTimer.start()
loops: itemType == "song" ? MediaPlayer.Infinite : vidLoop ? MediaPlayer.Infinite : 1
source: videoSource
MouseArea {
id: playArea
@ -70,33 +86,6 @@ Item {
}
}
/* Timer { */
/* id: mpvLoadingTimer */
/* interval: 500 */
/* onTriggered: { */
/* /\* showPassiveNotification("YIPPEEE!") *\/ */
/* mpv.stop(); */
/* if (vidStartTime > 0 && vidStartTime < vidEndTime) { */
/* /\* mpv.seek(vidStartTime); *\/ */
/* let start = "+" + vidStartTime; */
/* let end = "+" + vidEndTime; */
/* mpv.setProperty("start", start); */
/* mpv.setProperty("end", end); */
/* Utils.dbg("Setting position to: " + mpv.position); */
/* } else { */
/* mpv.setProperty("start", "none"); */
/* mpv.setProperty("end", "none"); */
/* } */
/* mpv.loadFile(videoSource.toString()); */
/* Utils.dbg("Setting position to: " + vidStartTime + " and end is " + vidEndTime); */
/* if (editMode) { */
/* console.log("WHY AREN'T YOU PASUING!"); */
/* pauseTimer.restart(); */
/* } */
/* blackTimer.restart(); */
/* } */
/* } */
Timer {
id: pauseTimer
interval: 300
@ -111,32 +100,9 @@ Item {
}
}
Rectangle {
id: black
color: "Black"
anchors.fill: parent
visible: false
}
MediaPlayer {
id: audio
audioOutput: AudioOutput {}
/* useHwdec: true */
/* enableAudio: true */
// embeded mpv allows to set commandline propertys using the options/<name>
// syntax. This could be abstracted later, but for now this works.
/* Component.onCompleted: audio.setProperty("options/audio-display", "no"); */
}
Image {
id: backgroundImage
anchors.fill: parent
source: imageSource
fillMode: itemType == "song" ? Image.PreserveAspectCrop : Image.PreserveAspectFit
clip: true
visible: webSource.length == 0
currentFrame: pdfIndex
}
FastBlur {
@ -145,19 +111,6 @@ Item {
source: imageSource === "" ? mpv : backgroundImage
radius: blurRadius
/* Controls.Label { */
/* text: Math.max(root.width, 1000) / 1000 * Math.max(root.textSize, 50) */
/* horizontalAlignment: hTextAlignment */
/* verticalAlignment: vTextAlignment */
/* anchors.top: parent.top */
/* anchors.left: parent.left */
/* anchors.topMargin: 10 */
/* anchors.bottomMargin: 10 */
/* anchors.leftMargin: 10 */
/* anchors.rightMargin: 10 */
/* visible: RSettings.debug */
/* } */
Controls.Label {
id: lyrics
text: root.text
@ -224,6 +177,11 @@ Item {
console.log("revealPrev")
web.runJavaScript("Reveal.prev()")
}
/* function onSlideChanged() { */
/* video.stop(); */
/* video.seek(); */
/* } */
}
function changeText(text) {
@ -242,11 +200,12 @@ Item {
}
function loadVideo() {
mpvLoadingTimer.restart()
video.seek(0)
video.play()
}
function playAudio() {
audio.loadFile(audioSource.toString());
audio.play();
showPassiveNotification("Audio should change");
}
@ -255,13 +214,13 @@ Item {
}
function stopVideo() {
mpv.stop();
video.stop();
black.visible = true;
console.log("Stopped video");
}
function seek(pos) {
mpv.seek(pos);
video.seek(pos);
}
function quitMpv() {
@ -269,15 +228,15 @@ Item {
}
function pauseVideo() {
mpv.pause();
video.pause();
}
function playPauseVideo() {
mpv.playPause();
video.playbackState == MediaPlayer.PlayingState ? video.pause() : video.play()
}
function playVideo() {
mpv.play();
video.play();
}
function revealNext() {