The start
parameter of YouTube URLs requires a whole number of seconds. Is there some other way to start play in the middle of a second?
2 Answers
According to the documentation:
[
start
] causes the player to begin playing the video at the given number of seconds from the start of the video. The parameter value is a positive integer. Note that similar to theseekTo
function, the player will look for the closest keyframe to the time you specify. This means that sometimes the play head may seek to just before the requested time, usually no more than around two seconds.
Even if there was a method to specify half-seconds, it'd still play from the nearest keyframe. So no, what you want to do is not possible.
You can use seekTo javascript method to go to a float, you'll just need to issue it after the video loads, and it's more involved: https://stackoverflow.com/questions/14461176/youtube-api-seekto-in-float-seconds
-
Yes, and determining when the video has finished loading is kind of a pain. My solution: call play, wait till state changed to "playing", then immediately pause it. There's probably a better way, but it's the only reliable way I know atm.– VenryxOct 2, 2020 at 5:33
-
Also note that if you call
seekTo
too early, not only does the call not get applied, but it can also cause thestartSeconds
property passed intoloadVideoById
/cueVideoById
to never get applied!– VenryxOct 2, 2020 at 5:36