I have an Activity
which is a WebView
. I have a WebChromeClient
inside it. Inside that, there are several callbacks which are meant t
There is no way to access the MediaPlayer without reflection - the WebViewClient and WebChromeClient do not intentionally expose it. And you are correct in saying that using reflection could cause you to break your app or the WebView as the code can vary across Android versions, and even across OEMs.
If you would like to do this, you will have to locate the instance of HTML5VideoView that corresponds to your video element. This object creates and maintains an instance to the MediaPlayer as "mPlayer". Please see https://github.com/android/platform_frameworks_base/blob/jb-mr2-release/core/java/android/webkit/HTML5VideoView.java.
in your class
private class MyWebChromeClient extends WebChromeClient
implements ..... MediaPlayer.onCompletion {
}
adding
@Override
public void onCompletion(MediaPlayer mp) {
// TODO Auto-generated method stub
mp.release();
}
gets rid of the error messages for me after the webview closes.
Now if only I could get the webview to play/stream vimeo videos :(