i used YoutubePlayerFragment for playing videos , but when i click on Full screen control option , the screen rotates to landscape mode and it gives view not found exception.
**i am using the following logic:**
Fragment fragment = new YouTubePlayerFragment();
FragmentManager fm = getActivity().getFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.youtubeplayerview, fragment);
ft.commit();
YouTubePlayerFragment youtubeFrag = (YouTubePlayerFragment) fragment;
youtubeFrag.initialize(API_KEY, this);
@Override
public void onInitializationFailure(Provider arg0,
YouTubeInitializationResult arg1) {
// TODO Auto-generated method stub
}
@Override
public void onInitializationSuccess(Provider arg0, YouTubePlayer player,
boolean wasRestored) {
if (!wasRestored) {
this.playe=player;
playe.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS);
playe.loadVideo(videoid,starttime);
}
}
So, please guide me how to achieve this. Thank you
Tap your profile icon in the top-right corner. Select “Settings” from the menu. Now go to the “General” section. Toggle the switch on for “Zoom to Fill Screen.”
Sometimes a YouTube page will load incorrectly, causing graphical issues in the process. If this is the reason you're encountering a full-screen error, pressing the F5 key or clicking the "Refresh" button will reload the YouTube page and fix the problem. Try using full-screen mode while Chrome isn't maximized.
Go to the video you'd like to watch. At the bottom-right of the video player, click full screen .
You can do manual configChanges in AndroidManifest.xml for youtube activity, something like this:
android:configChanges="orientation|keyboardHidden|screenSize"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With