Do not reload video in view mode

I have a web view that shows an embedded video. When the device is rotated, I can prevent the entire page from reloading:

@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); webView.saveState(outState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); webView.restoreState(savedInstanceState); } 

However, since I play the video in this webview, the video does not continue to play. Instead, he will upload the video as if he had not started playing. How can I rotate the screen, but continue the video, how did nothing happen?

thanks

+4
source share
2 answers

Add this to manifest.xml

  upto API level 12 <activity android:label="@string/app_name" android:name="Activity" android:configChanges="keyboardHidden|orientation"> </activity> after apl level 12, <activity android:label="@string/app_name" android:name="Activity" android:configChanges="keyboardHidden|orientation|screenSize"> </activity> 
+8
source

Add

 android:configChanges="keyboardHidden|orientation" 

for your activities in your AndroidManifest.xml

eg.

 <activity android:label="@string/app_name" android:name="Activity" android:configChanges="keyboardHidden|orientation"> </activity> 
0
source

Source: https://habr.com/ru/post/1432760/


All Articles