显示来自多个频道ID的YouTube视频

时间:2019-12-06 16:07:09

标签: android youtube android-youtube-api youtube-channels

如何查询多个YouTube频道以获取他们的视频? 其实我做了这样的事情来获取视频,但是当只查询一个频道时,这是完美的。

private void getVideoResponce(String channelId)
    {

        Filters = new HashMap<>();
            Filters.put("part", "snippet");
            Filters.put("channelId",channelId));
            Filters.put("maxResults", "10");
            Filters.put("order","date");
            Filters.put("type", "video");


                final Call<VideoListResponse> getVideoResponse=CustomApplication.getYoutubeClient().getService().getVideoResponse(OAuthToken, Filters);

                getVideoResponse.enqueue(new Callback<VideoListResponse>() {
        @Override
        public void onResponse(Response<VideoListResponse> response) {


            if(response.isSuccess())
            {
String NextToken=response.body().getNextPageToken();
                    youtubeVideoFragment= new YoutubeVideoFragment(OAuthToken, "",myarr, mList);
                    getActivity().getSupportFragmentManager().beginTransaction()
                            .replace(R.id.videolistframelayout, youtubeVideoFragment, "YoutubeVideoFragment")
                            .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
                            .commit();

        }
        @Override
        public void onFailure(Throwable t) {
            Log.d(TAG, "Video failure Response -> "+ t.getMessage());
        }
    });
}

但是现在我想查询多个频道ID以获取他们的视频。我如何实现这个目标?

0 个答案:

没有答案