Black screen when returning to video playback activity in Android

前端 未结 7 1313
星月不相逢
星月不相逢 2021-02-04 07:13

I\'m currently developing the android application ServeStream and I\'ve encountered and problem that I can\'t fix. My application will stream music and video using the android M

7条回答
  •  臣服心动
    2021-02-04 07:37

    I think I know the cause of the problem. It seems that mediaplayer initializes its surface ONLY when you call prepare/Async(). If you will change the surface after that, you will get what you`ve got. So the solution would be to disable standard lifecycle of activity via android:configChanges="orientation|keyboardHidden". This will prevent your activity from recreations. Otherwise you should call for prepare each time you recreate holder.

提交回复
热议问题