ExoPlayer Restore State when Resumed

前端 未结 2 1278
时光说笑
时光说笑 2020-12-09 06:49

I have implemented the Player and now there is a problem. When the video is playing and if the app is closed and resumed, the video screen freezes. I even saw the ExoPlayer

2条回答
  •  情歌与酒
    2020-12-09 07:13

    I know this is an old thread but, here is my fix

     protected void onPause() {
        player.setPlayWhenReady(false);
        super.onPause();
    }
    
    protected void onResume() {
        player.setPlayWhenReady(true);
        super.onResume();
    }
    

    this will pause the video on activity pause and resume on activity resume.

提交回复
热议问题