VideoView Online Buffer android旋转句柄

时间:2017-05-23 08:50:53

标签: java android video-streaming android-videoview screen-orientation

显示在线视频我的问题是: 当旋转屏幕视频从头开始再次缓冲视频

  @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putInt("POSITION", myVideo.getCurrentPosition());
        super.onSaveInstanceState(outState);

    }

    @Override
    protected void onRestoreInstanceState(Bundle savedInstanceState) {
        myVideo.seekTo(savedInstanceState.getInt("POSITION"));
        super.onRestoreInstanceState(savedInstanceState);
    }

1 个答案:

答案 0 :(得分:0)

这可能对您有所帮助

您必须在 AndroidManifest.java 文件中写下android:configChanges="orientation|screenSize"

<activity android:name=".MainActivity" android:configChanges="orientation|screenSize"/>