3

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 2

1

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 the seekTo 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.

1

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

2
  • 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.
    – Venryx
    Oct 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 the startSeconds property passed into loadVideoById/cueVideoById to never get applied!
    – Venryx
    Oct 2, 2020 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.