protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
youTubePlayerView=findViewById(R.id.youtubePlayerView);
initializedListener=new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
youTubePlayer.loadVideo("U_mfiRX7MD8&feature=youtu.be");
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {
}
};
}
@Override
protected void onStart() {
super.onStart();
youTubePlayerView.initialize(PlayerConfig.API_KEY,initializedListener);
}
我正在尝试使用Youtube Data Api查看未列出的youtube视频,但它显示的错误为400.虽然我的代码适用于任何公开视频,但它不适用于不公开的视频。 虽然在未列出的视频中我们知道如果我们有链接,视频是可见的,那么为什么我会收到错误? 不公开视频的网址为:https://www.youtube.com/watch?v=U_mfiRX7MD8&feature=youtu.be