Wednesday, May 2, 2012

[YouTube-API] player.getDuration() and player.getPlayTime() seems to be broken when the video hasn't started playing

Hi guys,

I'm using Youtube IFRAME API to embed a video into my site. I just found out a strange thing this evening that I'm not able to get anything return from `player.getCurrentTime()` or `player.getDuration()` unless the player has started. (It returned `undefined`.) The code I'm using were working just fine before 6pm EST, so I'm not sure if there's some change to it that breaks it or not.

The code snippet I used to test was something like this:

// Get called from YT.Player onReady event
function onPlayerReady(event) {
  console
.debug(event.target.getDuration(); // this returns undefined
}

Thank you,

Prem S.

--
You received this message because you are subscribed to the Google Groups "YouTube APIs Developer Forum" group.
To view this discussion on the web visit https://groups.google.com/d/msg/youtube-api-gdata/-/l5eRTeGuvzcJ.
To post to this group, send email to youtube-api-gdata@googlegroups.com.
To unsubscribe from this group, send email to youtube-api-gdata+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/youtube-api-gdata?hl=en.

No comments:

Post a Comment