Leo
Leo

Reputation: 4428

YouTube JavaScript player starts to play the video when seekTo is called

Accordring to the YouTube IFrame Player API the seekTo method should start to play the video unless the player state is "paused". That would be OK if there was any way to put the player in this state. Here is a fiddle that calls pauseVideo to put the player in the "paused" state. Then it calls seekTo. The video starts playing.

Do I read the docs wrong in any way? Or is this a bug in the YouTube player?

http://jsfiddle.net/lborgman/r46ofyz0/6/

Upvotes: 1

Views: 844

Answers (1)

Albin
Albin

Reputation: 2558

With youtube it seems paused means that you have requested the video to pause, unlike HTML5 video where paused simply means "not playing"

You can check the state with instance.getPlayerState(). Anything except 2 (paused) should trigger playing. In this case it seems to be video cued (5).

I created an issue for what I think is the real problem (pauseVideo doesn't do anything), using a fork of your jsfiddle. It may not be considered to be a bug though. We'll see.

Upvotes: 2

Related Questions