如何全屏播放YouTube视频,只需触摸播放按钮

时间:2018-11-10 08:16:17

标签: android

我的android stuido项目中有一个youtube视频视图。当我打开视频屏幕时,videoview会自动更改全屏模式。我只想在触摸播放按钮时以全屏播放视频。

这是我的代码

 public void setYoutube(final String youtube) {
    final YouTubePlayerView yotubevideo = (YouTubePlayerView) mView.findViewById(R.id.youtuber);

    onInitializedListener = new YouTubePlayer.OnInitializedListener() {
        @Override
        public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) {
            youTubePlayer.cueVideo(youtube);
            youTubePlayer.setFullscreen(true);
        }


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

        }
    };

    yotubevideo.initialize(KEY,onInitializedListener);

0 个答案:

没有答案