Using Android Youtube API to play Live streams

懵懂的女人 提交于 2019-11-30 02:10:49

It seems like YouTube fixed their SDK and live videos are now working again.

abielita

Based from this thread, there is no difference in playing any videos from YouTube and playing a live stream. Latest version of YouTube app must also play live stream.

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);   

  YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
  youTubeView.initialize(DEVELOPER_KEY, this);
}
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider,
        YouTubePlayer player, boolean wasRestored) {

    player.loadVideo("UT86BH2LVUU"); //live vid

}

Make sure that you integrated broadcasts and streams properly based from this documentation. The stream provides the content that will be broadcast to YouTube users. Once created, a liveStream resource can be bound to one or more liveBroadcast resources.

Here are examples using YouTube Live Streaming API.

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