G
G
genadiy772019-12-19 11:34:30
Java
genadiy77, 2019-12-19 11:34:30

Why does the full screen mode button on the player not work in the Webview Android application?

Newbie question. I am creating an app for a website. The site has a YouTube player. The application consists of a WebView into which the site is loaded. So the button does not work in the player (full screen mode), the rest of the buttons work. How can I fix this in my code example? Thanks in advance!

public class MainActivity extends AppCompatActivity {

    private WebView view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.view = (WebView) findViewById(R.id.webView);
        view = findViewById(R.id.webView);
        WebSettings webSettings = view.getSettings();
        webSettings.setJavaScriptEnabled(true);
        view.getSettings().setJavaScriptEnabled(true);
        view.setWebViewClient(new WebViewClient());
        view.setWebChromeClient(new WebChromeClient(){} );
        view.loadUrl("https://www.youtube.com/");
    }
    //метод обрабатывать нажатие кнопки BACK
    @Override
    public void onBackPressed() {
        if (view.canGoBack()) {
            view.goBack();
        } else {
            super.onBackPressed();
        }
    }
    //метод запрещает перезагрузку при повороте экрана
    @Override
    public void onConfigurationChanged(Configuration newConfig){
        super.onConfigurationChanged(newConfig);
    }

}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question