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: {
|
onPlaybackStateChanged: {
|
||||||
if (playbackState == MediaPlayer.PlayingState) {
|
if (playbackState == MediaPlayer.PlayingState) {
|
||||||
if (seekAfterPlay) {
|
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 {
|
|
||||||
player.playedFrom = position;
|
player.playedFrom = position;
|
||||||
}
|
}
|
||||||
} else {
|
} 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) {
|
function sendPositionToCore(positionToSend) {
|
||||||
if (episode != 0 && !inhibitPositionEvents) {
|
if (episode != 0 && !inhibitPositionEvents) {
|
||||||
var begin = playedFrom / 1000;
|
var begin = playedFrom / 1000;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue