Closed blonsky95 closed 4 years ago
There is a seekparameters class to specify the tolerance threshold that the seeking should apply to, however it says:
* Parameters that apply to seeking.
*
* <p>The predefined {@link #EXACT}, {@link #CLOSEST_SYNC}, {@link #PREVIOUS_SYNC} and {@link
* #NEXT_SYNC} parameters are suitable for most use cases. Seeking to sync points is typically
* faster but less accurate than exact seeking.
*
* <p>In the general case, an instance specifies a maximum tolerance before ({@link
* #toleranceBeforeUs}) and after ({@link #toleranceAfterUs}) a requested seek position ({@code x}).
* If one or more sync points falls within the window {@code [x - toleranceBeforeUs, x +
* toleranceAfterUs]} then the seek will be performed to the sync point within the window that's
* closest to {@code x}. If no sync point falls within the window then the seek will be performed to
* {@code x - toleranceBeforeUs}. Internally the player may need to seek to an earlier sync point
* and discard media until this position is reached.
*/
So, internally the player may need to seek to an earlier sync point, this might be happening, as previous frame usually works fine, but specially in high frame rate videos, next frame goes back to an earlier sync point instead of forward
Doing something really dirty where it checks for first time pressing NF after play and in that case jump by more than one frame, still have to compute how much frames it has to jump (60 fps has to jump 3) but unsure about the 30 fps ( check it out and see if there is a plausible relationship to account for it)
for now doing this weird shit
val newPosition: Long
if (firstTimeAfterPlay) {
//todo test with 30 and 60 and modify the 3 below to something more reasonable
val correctionNextFrameForward = floor(videoFrameRate/15).toLong()
newPosition = exoPlayer.currentPosition + frameJumpInMs * correctionNextFrameForward
firstTimeAfterPlay = false
} else {
newPosition = exoPlayer.currentPosition + frameJumpInMs
}
With this next frame doesnt go back, some times it stays in its frame or forward, but not back I might post a new issue in exoplayer in a few days after the other thing is done
Remainder - when seeking to next point in timeline it jumps frames, seekbar moves but video doesn't, only on the first time pressing next frame after a pause. When you check the seek type which is exact it says Internally the player may need to seek to an earlier sync point and discard media until this position is reached.
even though tolerance is 0,0
With 60 fps, speed 1.0x - first next frame takes you 2 frames back, so its like its 3 frames behind. If you are in frame 10 pause, and press next frame it takes you to 8, instead of 11. - previous frame though works (it doesnt depend on preloaded buffered stuff maybe?)