sampotts / plyr

A simple HTML5, YouTube and Vimeo player
https://plyr.io
MIT License
26.33k stars 2.92k forks source link

Cannot set currentTime in onReady handler with html5 provider #1978

Open btamas opened 3 years ago

btamas commented 3 years ago

Expected behaviour

Video should be seeked to the provided time, when I call player.currentTime in onReady handler.

Actual behaviour

No effect. BTW, the ready function is called 2 times. I tried to call currentTime in the second ready, but still doesn't have effect.

Steps to reproduce

Environment

Console errors (if any)

Link to where the bug is happening

https://codepen.io/btamax/pen/vYKNqNO

MacMaru commented 3 years ago

For vimeo: this does not work, even with a timeout: the player apparently needs to be playing for currentTime to be set. Calling .play() first, then setting currentTime in a timeout (~500ms) works most of the time, but seems to depend on the timing of the embedded player response/connection speed.

Triggering play first is undesired from a UX perspective (similar to autoplay) and fails anyway on page load/refresh because in that case the user didn't interact with the document first.

joaorulff commented 3 years ago

Same problem here. Any update?