如何使用Youtube的api在列表或数组视图中提示多个视频?

时间:2014-09-28 16:14:44

标签: android api listview youtube

我一直在试验youtube api并且已经决定使用simle播放器视图,因为它对我想要的效率最高。但是我希望在列表中显示多个视频,以便用户在滚动后点击他们想要的任何一个

public class PlayerViewDemoActivity extends YouTubeFailureRecoveryActivity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.playerview_demo);

YouTubePlayerView youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.initialize(DeveloperKey.DEVELOPER_KEY, this);
}

@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer player,
  boolean wasRestored) {
if (!wasRestored) {
  player.cueVideo("wKJ9KzGQq0w");
}
}

@Override
protected YouTubePlayer.Provider getYouTubePlayerProvider() {
return (YouTubePlayerView) findViewById(R.id.youtube_view);
}

}

0 个答案:

没有答案