I have a YouTube Live Event. I am able to play the video using the YouTube IFrame Player API. I want to know if there is any way that I can find if the video is a Live event video or a regular uploaded video. I need this information for designing my controls.
Asked
Active
Viewed 4,243 times
9
-
1Use [player.getDuration()](https://developers.google.com/youtube/iframe_api_reference#Retrieving_video_information). If it is live stream, it will return 0 [Demo](http://jsbin.com/zuzogofoje/edit?html,console,output) – Vuong Jan 07 '16 at 04:01
-
1Thank you. But, If I try getDuration() before the video even starts playing. Here, isn't there a chance that getDuration() returns 0 for an uploaded video? "Note that getDuration() will return 0 until the video's metadata is loaded, which normally happens just after the video starts playing" – Moni Jan 07 '16 at 05:08
-
Hey Moni, any updates? Did my answer help you? – JAL Jan 21 '16 at 20:50
2 Answers
6
The only way you can do this (currently) is with youtube backend api.
Get data about the video based on its id and in the response you have a property snippet.liveBroadcastContent
which is either live, none, or upcoming.

J.D.
- 1,145
- 2
- 15
- 29
1
The IFrame API provides a Playback quality function which returns a string representation of the current video quality.
From my tests, this function will return an undocumented string auto
for live events.
Related discussion can be found in this issue on YouTube's iOS Player Helper Library's GitHub page.

JAL
- 41,701
- 23
- 172
- 300
-
-
The 'Playback quality' isn't working for me. I tried with some youtube videos and getPlaybackQuality() returns 'unknown' for some of the uploaded and live events and it didn't return 'auto' for any of the samples i tried. Sorry for delayed update, was busy with another project. – Moni Jan 29 '16 at 05:59
-
Unfortunately, I don't think this works any more. I'm just getting 'large'. – Daniel Glynn Goodwin Mar 12 '21 at 14:31