Do not do fast seeks when seeking to chapter

Fast seeks are always a little off from requested time. When seeking to chapter position, do it by using a normal seek and restore user selected fast seeks afterwards.
This commit is contained in:
Rafostar
2021-01-13 18:49:10 +01:00
parent df4678d930
commit 5d0876bbf7
3 changed files with 39 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ class ClapperPlayer extends PlayerBase
this.dragAllowed = false;
this.isWidgetDragging = false;
this.doneStartup = false;
this.needsFastSeekRestore = false;
this.playOnFullscreen = false;
this.quitOnStop = false;
@@ -209,9 +210,26 @@ class ClapperPlayer extends PlayerBase
super.seek(position);
}
seek_seconds(position)
seek_seconds(seconds)
{
this.seek(position * 1000000000);
this.seek(seconds * 1000000000);
}
seek_chapter(seconds)
{
if(this.seekingMode !== 'fast') {
this.seek_seconds(seconds);
return;
}
/* FIXME: Remove this check when GstPlay(er) have set_seek_mode function */
if(this.set_seek_mode) {
this.set_seek_mode(GstPlayer.PlayerSeekMode.DEFAULT);
this.seekingMode = 'normal';
this.needsFastSeekRestore = true;
}
this.seek_seconds(seconds);
}
set_volume(volume)
@@ -399,6 +417,13 @@ class ClapperPlayer extends PlayerBase
if(!this.seek_done && state !== GstPlayer.PlayerState.BUFFERING) {
clapperWidget.updateTime();
if(this.needsFastSeekRestore) {
this.set_seek_mode(GstPlayer.PlayerSeekMode.FAST);
this.seekingMode = 'fast';
this.needsFastSeekRestore = false;
}
this.seek_done = true;
debug('seeking finished');
}