视频正在Android中播放全屏模式

时间:2013-04-17 05:55:36

标签: android android-webview mediacontroller

我希望在全屏模式下播放网页视频...

如果我的视频开始播放意味着它的显示和全屏模式播放..我怎样才能开发这些?给我任何想法???

如果必须单击“播放”按钮,则表示视频正在播放全屏模式。

我使用了以下代码:

content.setWebChromeClient(new WebChromeClient());
final Activity activity = this;
content.setWebChromeClient(new WebChromeClient(){
public void onProgressChanged ( WebView view , int progress ){
    activity.setProgress(progress * 1000);
}       
 });

content.setWebViewClient(new WebViewClient(){
public void onReceivedError ( WebView view , int errorCode , String description , String failingUrl ){
    Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show();
}

 });

content.setWebChromeClient(new WebChromeClient());

 content.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
content.getSettings().setJavaScriptEnabled(true);
content.getSettings().setDomStorageEnabled(true);
content.getSettings().setPluginState(PluginState.ON);
content.loadDataWithBaseURL(null, full_content, "text/html", "utf-8", null);

    content.setWebChromeClient(new WebChromeClient()
     {
        public void onProgressChanged ( WebView view , int progress )
        {

            activity.setProgress(progress * 1000);
        }

            public void onShowCustomView(View view, int requestedOrientation,   WebChromeClient.CustomViewCallback callback){
            super.onShowCustomView(view, callback);   
            if(Build.VERSION.SDK_INT >=14) {
                if (view instanceof FrameLayout) {                  
                    content.addView(view, new FrameLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    Gravity.CENTER));                   
                    content.setVisibility(View.VISIBLE);

                }
            }
        } 


            }); 

请给我任何关于在全屏播放视频的建议???

在这些代码中,视频显示特定的宽度和高度......我怎样才能播放全屏模式???

1 个答案:

答案 0 :(得分:0)

我是通过youtube播放器API实现的...这对于android developer.it来说很容易在全屏模式下播放。