2025-10-12 18:09:34 +02:00
|
|
|
import QtMultimedia 6.8
|
|
|
|
|
|
|
|
|
|
pragma Singleton
|
|
|
|
|
|
|
|
|
|
MediaPlayer {
|
|
|
|
|
source: ""
|
|
|
|
|
|
|
|
|
|
function startPlaying(url) {
|
2025-10-13 02:55:16 +02:00
|
|
|
if (playing) {
|
2025-10-12 18:09:34 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
console.log("Starting playback from " + url);
|
2025-10-13 02:55:16 +02:00
|
|
|
source = url;
|
|
|
|
|
play();
|
2025-10-12 18:09:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function stopPlaying() {
|
|
|
|
|
console.log("Stopping playback...");
|
2025-10-13 02:55:16 +02:00
|
|
|
source = "";
|
|
|
|
|
stop();
|
2025-10-12 18:09:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
audioOutput: AudioOutput {
|
|
|
|
|
volume: 0.4
|
|
|
|
|
}
|
2025-10-13 02:55:16 +02:00
|
|
|
|
2025-10-12 18:09:34 +02:00
|
|
|
onErrorOccurred: function(error, errorString) {
|
2025-10-13 02:55:16 +02:00
|
|
|
stopPlaying();
|
2025-10-12 18:09:34 +02:00
|
|
|
}
|
|
|
|
|
}
|