video-player-sdk::setCurrentTime function is imprecise

Hello.
I am building a web video editor allowing users to trim their videos.
Users have a custom player controls timeline (controls: false on the embedded player), where they can either navigate in the video or trim/cut the video.

When a user drags the timeline cursor, I call setCurrentTime() passing it a precise timestamp (5 decimals Float) calculated on the timeline cursor position.

But when the setCurrentTime() promise is resolved, the cursor always moves a little, so the user cannot chose a specific timestamp to trim his video, as it is reset by the function.

Would there be anything I could do to prevent this and be as precise as I would like to? (down to tenth of a second at least)

Thank you!

I’m joining a screenshot of the feature (in development) right after I dragged the begin trim handle. The blue horizontal line is the timeline cursor, and I would like it to be precisely positioned on the left side of the blue inner timeline, and the player to be precisely set at the timestamp represented by the cursor’s position on the timeline.

Hello Paul!

Your project sounds great, we’ll be happy to help you make it happen!

I tried to reproduce the problem you are talking about but I didn’t succeed.

I created this example page: Player timeline slider - JSFiddle - Code Playground . It’s pretty basic, but in idea I think it’s similar to what you describe.

Do you see anything different in your way of doing things that could explain the problem?

Olivier

1 Like

Hello Olivier.
Thanks for the feedback!

Thanks a lot for your fiddle, it helped me find the origin of the imprecision in my feature.
It was my fault as I had some function to round at 1 decimal the player’s current time… I feel completely silly.

Sorry for the useless ticket and thank you very much!

No problem Paul!

Glad your problem is solved :slight_smile:

Olivier

1 Like