Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:11:19+00:00 2026-05-30T18:11:19+00:00

I am succeeded to play streamed Youtube video from HTML5 content in Webview in

  • 0

I am succeeded to play streamed Youtube video from HTML5 content in Webview in Android but now problem is that video plays only first time. After that VideoView only goes to end of the video file.

I tried clearing cache as suggested here but no luck.

What could be the possible solution for this problem?

Please try following code to run Video, this has been using some suggestions given on stackoverflow.com

WebView webView = (WebView) findViewById(R.id.product_details_webview);
WebSettings webSettings = webView.getSettings();
webSettings.setPluginState(WebSettings.PluginState.ON);
webSettings.setJavaScriptEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webView.setWebChromeClient(new chromeClient());
webView.setWebViewClient(new WebViewClient(){

});
webView.loadUrl(url);

public class chromeClient extends WebChromeClient implements OnCompletionListener,  
OnErrorListener{
    private WebView wv;
    private VideoView mVideoView;
    private LinearLayout mContentView;
    private FrameLayout mCustomViewContainer;
    private WebChromeClient.CustomViewCallback mCustomViewCallback;
    FrameLayout.LayoutParams COVER_SCREEN_GRAVITY_CENTER = new   
FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.CENTER);

    @Override
    public void onShowCustomView(View view, CustomViewCallback callback) {
        if (view instanceof FrameLayout) {
            wv = (WebView)findViewById(R.id.product_details_webview);
            mCustomViewContainer = (FrameLayout) view;
            mCustomViewCallback = callback;
            mContentView = (LinearLayout)findViewById(R.id.linearlayout1);
            if (mCustomViewContainer.getFocusedChild() instanceof VideoView) {
                mVideoView = (VideoView) mCustomViewContainer.getFocusedChild();
                // frame.removeView(video);
                mContentView.setVisibility(View.GONE);
                mCustomViewContainer.setVisibility(View.VISIBLE);
                setContentView(mCustomViewContainer);
                mVideoView.setOnCompletionListener(this);
                mVideoView.setOnErrorListener(this);
                mVideoView.start();

            }
        }
    }

    public void onHideCustomView() {
        if (mVideoView == null){
            return;
        }else{
        // Hide the custom view.
        mVideoView.setVisibility(View.GONE);
        // Remove the custom view from its container.
        mCustomViewContainer.removeView(mVideoView);
        mVideoView = null;
        mCustomViewContainer.setVisibility(View.GONE);
        mCustomViewCallback.onCustomViewHidden();
        // Show the content view.
        mContentView.setVisibility(View.VISIBLE);
        }
    }


    public void onCompletion(MediaPlayer mp) {
        mp.stop();
        mCustomViewContainer.setVisibility(View.GONE);
        onHideCustomView();
        setContentView(mContentView);
    }

    public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
        setContentView(mContentView);
        return true;
    }
  }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:11:21+00:00Added an answer on May 30, 2026 at 6:11 pm

    Add in your chrome client :

            @Override public void onPrepared(MediaPlayer mp) {
    
            customViewCallback.onCustomViewHidden();
        }
    

    where customViewCallback = callback;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to this question I succeeded to create upload image, but now I need
I have succeeded in generating a sqlite3 database in my android app from an
I finally succeeded in building my first iPhone app but now I am pulling
Has anyone succeeded in using Squeryl's externalTransactionManagementAdapter with play framework 2.0?: object Global extends
I succeeded to create a register form, and now users can register my site.
Has anybody succeeded in customizing the Places Bar for VS 2008? My customizations from
Is there any provisions in rails that would allow all AJAX POST requests from
I want to use Qt to create a simple GUI application that can play
I want to take a video file and encrypt it using java. For now
I'm trying to record sound using Android Emulator. I know that this question is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.