gave up on qt and using mpv for audio too

This commit is contained in:
Chris Cochrun 2022-09-25 07:31:58 -05:00
parent 7f94cc37e7
commit 48514667cf
2 changed files with 23 additions and 6 deletions

View file

@ -163,6 +163,10 @@ Item {
previewSlide.playVideo(); previewSlide.playVideo();
pauseVideo(); pauseVideo();
} }
function onAudioChanged() {
showPassiveNotification("Audio should change");
previewSlide.playAudio();
}
} }
function pauseVideo() { function pauseVideo() {

View file

@ -23,6 +23,7 @@ Item {
property int pdfIndex property int pdfIndex
property string chosenFont: "Quicksand" property string chosenFont: "Quicksand"
property string text: "This is demo text" property string text: "This is demo text"
property string audioError
property color backgroundColor property color backgroundColor
property var hTextAlignment: Text.AlignHCenter property var hTextAlignment: Text.AlignHCenter
property var vTextAlignment: Text.AlignVCenter property var vTextAlignment: Text.AlignVCenter
@ -107,12 +108,15 @@ Item {
visible: false visible: false
} }
MediaPlayer { MpvObject {
id: audio id: mpvAudio
audioRole: MusicRole useHwdec: true
autoLoad: true enableAudio: true
autoPlay: true }
source: audioSource.toString()
Controls.Label {
id: error
text: audio.errorString
} }
Image { Image {
@ -171,7 +175,16 @@ Item {
} }
function playAudio() { function playAudio() {
audio.stop();
audio.source = audioSource;
mpvAudio.loadFile(audioSource.toString());
audio.play(); audio.play();
showPassiveNotification("We should be playing: " + audio.source)
showPassiveNotification(audio.status)
showPassiveNotification(audio.hasAudio)
showPassiveNotification(audio.duration)
showPassiveNotification(audio.errors)
showPassiveNotification(audio.errorString)
} }
function stopVideo() { function stopVideo() {