私の懸念として、 WebChromeClient は iframe タグをサポートしています。私の場合、次の方法で iframe タグを webview に指定しました。
<iframe width=\"480\" height=\"270\" src=\"http://staging.snagfilms.com/modules/html5player.jsp?filmId=ed9195a0-a748-11e0-a92a-0026bb61d036&w=500\" frameborder=\"0\" allowfullscreen></iframe>
上記は iframe タグです。サーバーから取得しています
myWebView = (CustomFacedWebView) findViewById(R.id.web_wrap_browser);
myWebView.getSettings().setPluginsEnabled(true);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setPluginState(PluginState.ON);
chromeClient = new MyChromeClient();
myWebView.setWebChromeClient(chromeClient);
myWebView.loadUrl(URL)
webRoot = (ViewGroup) findViewById(R.id.web_root_view);
systemRoot = (ViewGroup) webRoot.getParent();
private final class MyChromeClient extends WebChromeClient implements OnCompletionListener, OnErrorListener {
CustomViewCallback fullscreenCallback;
VideoView htmlVideoView;
@Override
public void onShowCustomView(final View view, final CustomViewCallback callback) {
super.onShowCustomView(view, callback);
fullscreenCallback = callback;
systemRoot.removeAllViews();
setContentView(view);
fullScreen = true;
............
}
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
@Override
public void onShowCustomView(final View view, final int requestedOrientation,
final CustomViewCallback callback) {
super.onShowCustomView(view, requestedOrientation, callback);
systemRoot.removeAllViews();
setContentView(view);
setRequestedOrientation(requestedOrientation);
fullscreenCallback = callback;
}
@Override
public void onHideCustomView() {
super.onHideCustomView();
if(htmlVideoView != null) {
htmlVideoView.stopPlayback();
}
if(webRoot != null) {
systemRoot.removeAllViews();
setContentView(webRoot);
}
try{
if(fullscreenCallback != null)
fullscreenCallback.onCustomViewHidden();
} catch(Exception e) {
e.printStackTrace();
}
fullScreen = false;
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
onHideCustomView();
return false;
}
@Override
public void onCompletion(MediaPlayer mp) {
onHideCustomView();
}
}