Fix AudioDelegate playback

(cherry picked from commit b909cb2db8)
This commit is contained in:
Tobias Fella
2024-02-09 22:22:05 +01:00
parent ce448bd027
commit 0cf19d21f2

View File

@@ -42,7 +42,8 @@ MessageDelegate {
bubbleContent: ColumnLayout { bubbleContent: ColumnLayout {
MediaPlayer { MediaPlayer {
id: audio id: audio
source: root.progressInfo.localPath onErrorOccurred: (error, errorString) => console.warn("Audio playback error:" + error + errorString)
audioOutput: AudioOutput {}
} }
states: [ states: [
@@ -73,18 +74,19 @@ MessageDelegate {
}, },
State { State {
name: "paused" name: "paused"
when: root.progressInfo.completed && (audio.playbackState === Audio.StoppedState || audio.playbackState === Audio.PausedState) when: root.progressInfo.completed && (audio.playbackState === MediaPlayer.StoppedState || audio.playbackState === MediaPlayer.PausedState)
PropertyChanges { PropertyChanges {
target: playButton target: playButton
icon.name: "media-playback-start" icon.name: "media-playback-start"
onClicked: { onClicked: {
audio.play() audio.source = root.progressInfo.localPath;
audio.play();
} }
} }
}, },
State { State {
name: "playing" name: "playing"
when: root.progressInfo.completed && audio.playbackState === Audio.PlayingState when: root.progressInfo.completed && audio.playbackState === MediaPlayer.PlayingState
PropertyChanges { PropertyChanges {
target: playButton target: playButton