Commit 22afc8cb authored by Carlos Jose Mazieri's avatar Carlos Jose Mazieri Committed by Kempe
Browse files

[FEATURE] Set a delay before starting playback

navigation using buttons 'next' and 'prev' adds a delay before playback is started.
To be able to switch stations to de desired one before before stoping the current station
parent 7e39f930
......@@ -28,6 +28,17 @@ DockedPanel {
}
}
// This timer is used when pushing 'next' or 'prev' buttons,
// it does not try to play immediately, instead wait some time to allow the user
// keep pushing, it is good for Bluetooth navigation inside cars
Timer {
id: navigation_timer
interval: 1400
running: false
repeat: false
onTriggered: playCurrentStation();
}
Component.onCompleted: {
updateDockedAudioPlayerSource()
}
......@@ -42,18 +53,28 @@ DockedPanel {
open = true
app.stationData = JSON.parse(JSON.stringify(station));
AudioPlayer.loadUrl(app.stationData.url)
AudioPlayer.setStation(app.stationData.name);
AudioPlayer.setTitle("");
if (navigation_timer.running == false) {
playCurrentStation();
}
}
function playNext() {
var nextStation = FavoritesUtils.getNextFavorite(app.stationData);
console.debug("Playing next favorite", JSON.stringify(nextStation));
console.debug("Playing next favorite", JSON.stringify(nextStation));
navigation_timer.restart(); // allows keep pushing
play(nextStation);
}
function playPrev() {
var prevStation = FavoritesUtils.getPrevFavorite(app.stationData);
console.debug("Playing prev favorite", JSON.stringify(prevStation));
navigation_timer.restart(); // allows keep pushing
play(prevStation);
}
function playCurrentStation() {
AudioPlayer.loadUrl(app.stationData.url);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment