如何在 Youtubeplayer - API 中播放多个视频?

How to play multiple videos in Youtubeplayer - API?

我正在尝试在 Android Studio 中使用 YouTube 播放器 API 播放 YouTube 中的一些视频。我有每个视频的视频 ID。现在我希望播放器在单击每个按钮时播放视频。

        @Override
        public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {

            youTubePlayer.loadVideo("video_id");

        }

        @Override
        public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
      }

当我使用这种方法时,我不知道如何'change the video id'单击第二个按钮以在同一播放器中播放第二个视频。

非常感谢任何答案!

         YouTubePlayer  player;//Inilize this in before oncreate method

        videos_listview.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               String selectedurl=videoslist.get(position);  //videolist is the list of all video view ids             
               player.pause();
               player.cueVideo(selectedurl);
               }

            @Override
             public void onInitializationSuccess(Provider provider, YouTubePlayer player, boolean wasRestored)
               {
                 this.player=player;
                 if (!wasRestored) {
                  player.cueVideo(videoslist.get(0)); // Plays https://www.youtube.com/watch?v=videoid
               }