when the video is playing on the Fullscreen.i want pressed the back button can exit the Fullscreen,i have been try to overrride the onbackPress and onKeydown but is not work.please help me
@Override
public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
System.out.println("here");
youTubePlayer.setPlayerStateChangeListener(playerStateChangeListener);
youTubePlayer.setPlaybackEventListener(playbackeventlistener);
youTubePlayer.setOnFullscreenListener(onFullscreenListener);
you = youTubePlayer;
if (b) {
youTubePlayer.cueVideo(Video_id);
}}
youTubePlayer.setShowFullscreenButton(false);
youTubePlayer.setManageAudioFocus(false);
youTubePlayer.setFullscreen(true);
youTubePlayer.setPlayerStyle(YouTubePlayer.PlayerStyle.MINIMAL);
}
@Override
public void onBackPressed() {
super.onBackPressed();
if (isFullscreen.equals(true)){
you.setFullscreenControlFlags(0);
isFullscreen = false;
you.setFullscreen(false);
}else {
super.onBackPressed();
}
}
}
Can you try this?
@Override
public void onBackPressed() {
if (isFullscreen.equals(true)){
isFullscreen = false;
you.setFullscreen(false);
}else {
super.onBackPressed();
}
}