exoplayer上的全屏模式

时间:2019-09-10 22:36:18

标签: android exoplayer exoplayer2.x

我正在开发一个包含exoplayer的应用,我需要使其以全屏模式播放。

视频全屏显示时,用户可以纵向或横向观看视频。

到目前为止,我已经创建了一个按钮以全屏显示视频。

 holder.simpleExoPlayer = ExoPlayerFactory.newSimpleInstance(context);

            // Bind the player to the view.
            holder.videoCtn.setPlayer(holder.simpleExoPlayer);

            holder.videoUri = Uri.parse(mensagem.getVideo());

            // Produces DataSource instances through which media data is loaded.
            DataSource.Factory dataSourceFactory = new DefaultDataSourceFactory(context,
                    Util.getUserAgent(context, context.getString( R.string.app_name)));
            // This is the MediaSource representing the media to be played.
            MediaSource videoSource = new ProgressiveMediaSource.Factory(dataSourceFactory)
                    .createMediaSource(holder.videoUri);
            // Prepare the player with the source.
            holder.simpleExoPlayer.prepare(videoSource);

            //botao full screen video
            holder.exo_fullscreen_icon.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                   //Make the video come fullscreen ...
            });

我该如何实现? 预先感谢。

1 个答案:

答案 0 :(得分:0)

您可以使用setResizeMode方法 Check this