I started using the YouTube API for Android a month ago. I am trying to make an Android app that can play some videos that include my downloaded videos. He works with public videos. But with private videos, YoutubePlayerView shows: "Please Login."
I could not figure out how to subscribe and play these videos , since YoutubeAndroidPlayerAPI does not seem to support authentication.
This is what I do with "JurB9k3_Ws4", this is my personal video id.
@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, new YouTubePlayer.OnInitializedListener() {
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer,
boolean b) {
youTubePlayer.cueVideo("JurB9k3_Ws4");
}
@Override
public void onInitializationFailure(YouTubePlayer.Provider provider,
YouTubeInitializationResult youTubeInitializationResult) {
}
});
}
source
share