GPodderPlayback: Try harder to resume playback position
This commit is contained in:
parent
69c803ab5c
commit
9023235f07
1 changed files with 20 additions and 7 deletions
|
@ -86,13 +86,7 @@ MediaPlayer {
|
|||
|
||||
onPlaybackStateChanged: {
|
||||
if (playbackState == MediaPlayer.PlayingState) {
|
||||
if (seekAfterPlay) {
|
||||
// A seek was scheduled, execute now that we're playing
|
||||
player.inhibitPositionEvents = false;
|
||||
player.seek(seekTargetSeconds * 1000);
|
||||
player.playedFrom = seekTargetSeconds * 1000;
|
||||
seekAfterPlay = false;
|
||||
} else {
|
||||
if (!seekAfterPlay) {
|
||||
player.playedFrom = position;
|
||||
}
|
||||
} else {
|
||||
|
@ -100,6 +94,25 @@ MediaPlayer {
|
|||
}
|
||||
}
|
||||
|
||||
property var seekAfterPlayTimer: Timer {
|
||||
interval: 100
|
||||
repeat: true
|
||||
running: player.isPlaying && player.seekAfterPlay
|
||||
|
||||
onTriggered: {
|
||||
var targetPosition = player.seekTargetSeconds * 1000;
|
||||
if (Math.abs(player.position - targetPosition) < 10 * interval) {
|
||||
// We have seeked properly
|
||||
player.inhibitPositionEvents = false;
|
||||
player.seekAfterPlay = false;
|
||||
} else {
|
||||
// Try to seek to the target position
|
||||
player.seek(targetPosition);
|
||||
player.playedFrom = targetPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sendPositionToCore(positionToSend) {
|
||||
if (episode != 0 && !inhibitPositionEvents) {
|
||||
var begin = playedFrom / 1000;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue