In my android application I want to open a webpage in a WebView. A webpage which i want to open also contains video. To achieve this functionality,I used WebChromeClient in my application. The problem is that, onBackPressed() of this activity, some videos don't get stopped and they keep playing in background, though my WebView activity is finished. I don't know why this happens. I tried various codes, but couldn't solve this problem. Some videos stop automatically, but some keeps on playing in background. How to solve this issue ?
here is my code
@Override
public void onBackPressed() {
if (myWebView.canGoBack()) {
myWebView.goBack();
} else {
super.onBackPressed();
}
}