-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can seek in milliseconds #1028
Can seek in milliseconds #1028
Conversation
Thanks for submitting this. I'm a bit worried about merging this as precise seeking can result in delays while seeking. From the Apple docs:
I tested seeking with the current code and if I input a fraction like 35.5, the onSeek method shows I'm at exactly 35.5 when it completes. Are you wanting to be able to specify seek times in milliseconds (e.g. 35500ms rather than 35.5s) or finding that the seeking is not accurate enough? |
@cobarx Seek in milliseconds looks correct in the onseek method, but it is incorrect in the actual video display. Therefore, I made this fix and sent it. When using it, if you want to see, for example, 3.5 seconds, it is assumed not to use like seek (3500), but to use like seek (3.5). I noticed this bug when stopping the video with the pause method and then seek. I am not good English Speaker. Sorry for Unclear sentences... |
@keenjoe007 Got it, I understand what you're saying. I guess it depends on how the video is encoded if the existing seek will go to the right spot. What I'd suggest is we add an optional second argument to see for when you need an exact seek: What do you think? This would provide exact seeking for people like you who need it, and keep the high performance version for people who don't. If you're happy with this approach would you mind updating the PR. I can take care of updating the docs. |
@cobarx |
Great progress! Looking forward to getting this merged when it's all done. |
This reverts commit 327a25b.
@cobarx I attempted to divide the setSeek method in ios / RCTVideo.m by the number of arguments, but it did not work. For example as follows.
The seek method to be called with javascript executed only How do I fix it? From javascript, |
@keenjoe007 I don't believe that React Native supports passing in more than one argument when setting a prop, so we'll need to use multiple props. Looking at:
and add the appropriate native prop at the bottom. Now on the iOS side, when JS seek gets called, we need to make sure both seek & seekTolerance are set. So what you can do is create a setSeekTolerance function and whenever setSeek or setSeekTolerance is called, you set Let me know if that makes sense or you need further help. |
ummmmm... |
What's the ummm for? Is it all ready? |
Sorry, my local environment is broken yesterday . |
I thought of an idea how to do this where we can pass everything in at once. I'll test it and send you sample code shortly. |
Ok it works. Here are the changes needed to get the data passed in in Video.js:
also:
in RCTVideoManager.m:
in RCTVideo.m:
That should be enough to get the data you need. You'll need to update setCurrentTime and the setSeek functions. |
@keenjoe007 Thanks for your work on this, I adapted it and got it working with the dictionary method. Since I don't have access to your repo, I created a new PR #1076. I appreciate you suggesting and getting this started. |
Sorry... Thanks for take over this issue and advise me about . |
The seek method was able to seek only in seconds, so we could seek in milliseconds.