旋转YouTube播放器上的屏幕或全屏按钮

时间:2016-11-02 13:59:47

标签: java android eclipse android-studio youtube

我申请从YouTube运行视频,但是有一个问题 - 当我将YouTube播放器代码放在按钮内时,当我按下屏幕时按下按钮时,应用程序无法正常工作YouTube播放器。

这是我的代码:

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.watch);

    youTubePlayerView = (YouTubePlayerView) findViewById(R.id.view2);
    onInitializedListener = new YouTubePlayer.OnInitializedListener() {
        final String VedioUrl = "fWuqQkdlC58";

        public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
            youTubePlayer.loadVideo(VedioUrl);
        }

        @Override
        public void onInitializationFailure(YouTubePlayer.Provider provider, YouTubeInitializationResult youTubeInitializationResult) {

        }
    };

    Button PLAY = (Button) findViewById(R.id.play);
    PLAY.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            youTubePlayerView.initialize("AIzaSyB9U058ScB8F9zuBA-yuDlvOCAvLahxqeQ", onInitializedListener);
        }
    });
}

此图显示了我进入全屏时的问题:

Click here to see image

0 个答案:

没有答案