I am playing HTML 5 Video in activity that is working fine, but when i press back button get exit from the activity and slide(Video contains by slides) but sound is still playing in background of that particular slide until it gets finish. How can i stop that sound while pressing the back button get exit completely form the activity.
here is my code when i press back button:
@Override
protected void onPause() {
super.onPause();
mWebView.stopLoading();
}
@Override
public void onStop() {
super.onStop();
mWebView.stopLoading();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mWebView.inCustomView()) {
mWebView.hideCustomView();
mWebView.stopLoading();
return true;
}
}
return super.onKeyDown(keyCode, event);
}
@Override
public void onBackPressed() {
if (mWebView.isFocused() && mWebView.canGoBack()) {
mWebView.goBack();
} else {
super.onBackPressed();
activity.finish();
}
}
}