我正在尝试使用WebView播放HTML 5视频,但我一直收到此错误:
“无法将CustomViewCallback解析为类型”
以下是代码:
myWebView.setWebChromeClient(new WebChromeClient() {
public void onShowCustomView(View view, CustomViewCallback callback) {
super.onShowCustomView(view, callback);
if (view instanceof FrameLayout){
FrameLayout frame = (FrameLayout) view;
if (frame.getFocusedChild() instanceof VideoView){
VideoView video = (VideoView) frame.getFocusedChild();
frame.removeView(video);
setContentView(video);
video.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.stop();
setContentView(R.layout.mnwv_main);
}
});
video.setOnErrorListener(new OnErrorListener() {
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
return false;
}
});
video.start();
}
}
}
}); // new WebChromeClient() ends...
myWebView.loadUrl("http://www.meanwhileinwv.com");
}
任何人都知道我能做什么?
答案 0 :(得分:0)
WebChromeClient.CustomViewCallback
。所以我的猜测你的测试设备(或模拟器)的API水平较低。