31 lines
563 B
QML
31 lines
563 B
QML
import QtMultimedia 6.8
|
|
|
|
pragma Singleton
|
|
|
|
MediaPlayer {
|
|
source: ""
|
|
|
|
function startPlaying(url) {
|
|
if (player.playing) {
|
|
return;
|
|
}
|
|
console.log("Starting playback from " + url);
|
|
player.source = url;
|
|
player.play();
|
|
}
|
|
|
|
function stopPlaying() {
|
|
console.log("Stopping playback...");
|
|
player.source = "";
|
|
player.stop();
|
|
}
|
|
|
|
audioOutput: AudioOutput {
|
|
volume: 0.4
|
|
}
|
|
|
|
onErrorOccurred: function(error, errorString) {
|
|
player.stopPlaying();
|
|
}
|
|
}
|