Android WebView Playing HTML5/h.264/mp4 Video, How to get at the MediaPlayer

前端 未结 2 410
我寻月下人不归
我寻月下人不归 2020-12-17 10:19

I have an Activity which is a WebView. I have a WebChromeClient inside it. Inside that, there are several callbacks which are meant t

2条回答
  •  一生所求
    2020-12-17 10:47

    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 :(

提交回复
热议问题