I am trying to play a video using the YouTube video API.
When I set static identifiers, I declare the ID in the file, the code is working at this time.
But when I try to get the id from getIntent (), I also got the id, but the video is not playing.
I am having a network problem.
Below is my code. His work is in this state.
public String VIDEO = "QqnBjKnwCwE";
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, Videosshow.this);
@Override
public void onInitializationFailure(Provider provider,
YouTubeInitializationResult error) {
Toast.makeText(this, "Oh no! " + error.toString(), Toast.LENGTH_LONG)
.show();
}
@Override
public void onInitializationSuccess(Provider provider,
YouTubePlayer player, boolean wasRestored) {
player.loadVideo(String.valueOf( VIDEO));
}
Now that i used
Bundle data = getIntent().getExtras();
VIDEO=data.getString("videourl");
youTubeView = (YouTubePlayerView) findViewById(R.id.youtube_view);
youTubeView.initialize(DEVELOPER_KEY, Videosshow.this);
not working I got a 400 network error
source
share