Check if YouTube video is live or uploaded

倾然丶 夕夏残阳落幕 提交于 2019-12-19 07:43:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!