Closed danielr18 closed 5 years ago
Right, this makes sense. The onSeekPreview + onSeekComplete weren't really designed to do this.
However I wonder if the best thing might be to allow onSeekComplete
to take a parameter (the seek time) so you can use it without onSeekPreview
to skip immediately. If onSeekComplete
receives a time, then it ignores the preview time in the state. You could do:
seekForward() {
const { onSeekComplete, currentTime } = playerContext;
onSeekComplete(currentTime + 5);
}
seekBackward() {
const { onSeekComplete, currentTime } = playerContext;
onSeekComplete(currentTime - 5);
}
Seems pretty straightforward and more flexible than adding extra API for that one use case. What do you think?
I made some typos the first time I wrote that comment so make sure to re-read. :) sorry.
I like it, that's how I tried to use onSeekComplete
in the beginning until I went to the source code and saw how it worked.
@danielr18 that sounds like a good sign that this is how it should work then! 😄
If you want to make a PR and update some documentation, that would be great - otherwise I can try to get to it later.
I can make the PR 👍
Hey @danielr18 any update on this? :)
I have a weird bug that isn't really related to seek, but the ProgressBar component.
Somehow when I click ~2 times over the seek buttons, red squares in the image, the player seeks to the position above of where I clicked. If you want, you can try to recreate it here: http://54.224.96.152:3001/, perhaps it's a bug we can solve in the library?
@danielr18 that's a really peculiar bug! I'm able to repro it as well when I visit your site. Without access to the source code it might be hard for me to debug it. Is it possible to either share the code, or if not, share a minimal repro that demonstrates the bug so I can mess around with it locally?
I'll try to create a minimal repro, and share it
Thanks so much! And once you do, if you could log this as a separate issue that would be much appreciated.
Yes, planning to do that, we can close this issue once the PR gets merged.
Closed by #309.
I'm sure this could be achieved with a combination of
onSeekPreview
+ timeoutonSeekComplete
(due to having to wait for state to change), but I think it would be easier to have functions forseekbackward
andseekforward
in the context, similar to the MediaSession ones.seekbackward: (seekLength) => (this.media.currentTime -= seekLength)
;seekforward: (seekLength) => (this.media.currentTime += seekLength)
;