0

In the youtube iframe API documentation it mentions briefly that player.getDuration() returns elapsed time (instead of total time) for live events. It however does not mention how one would determine if the video is a live event or not. This seems like a pretty basic thing so I'm surprised there is almost no resource for this information.

How would one go about determining if the loaded video is a live event or not?

Shiboe
  • 787
  • 6
  • 8
  • 4
    Duplicate [here](http://stackoverflow.com/q/34646559/2415822), but I can't flag it as a dupe since it doesn't have an upvoted or accepted answer. – JAL Jan 21 '16 at 14:45
  • The `.getDuration()` hack seems outdated, since youtube iframe API now states the function will return elapsed time since stream began for live event, not 0. The playback quality hack may still work, but looks unreliable given the findings of the iOS library PR linked in the comments: `This pull request adds a constant to account for cases when "Auto" quality is returned from YouTube. I've found this happens mostly when watching YouTube Live Events with the YTPlayerView` "Mostly" isn't a solution unfortunately. I suppose I could try periodically check `getDuration()` for changes... – Shiboe Jan 21 '16 at 16:35
  • I'm not using `.getDuration()`. Check my answer to that question, I'm using the playback quality function to determine if a video is a live event. – JAL Jan 21 '16 at 16:37
  • @JAL I had checked your answer, that's where I found the quote concerning the playback quality auto happening "mostly" on live events, which concerns me. Thank you for the link though, as it's the only information I've seen, hacky or otherwise. – Shiboe Jan 21 '16 at 16:54
  • Sorry, this is the best I can do without an official response/interface from Google. If you figure something out, post an answer. – JAL Jan 21 '16 at 20:50

0 Answers0