I have a webview that is showing an embedded video. When the device is rotated, I can prevent the entire page from being reloaded with:
@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 am playing a video in this webview, the video does not continue playing. Instead, it will load the video as if it has not started playing. How can I rotate the screen but continue the video like nothing happened?
Thanks
Add this in 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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With