问题
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.
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/34646559/check-if-youtube-video-is-live-or-uploaded