0

I have tried this code and i want to remove or disable these next and previous video button from iframe youtube for android. I am using android java code for implementing the iframe youtube. I found the solution for java script. One solution is available for same issue but that is in java script which is not helpful for android How can we remove/hide the next and previous arrow icons from YouTube iframe?

public class MainActivity extends AppCompatActivity  {


    private WebView webView;
    String youTubeUrl = "https://www.youtube.com/embed/47yJ2XCRLZs";
   
    String frameVideo = "<html><body>Video From YouTube<br><iframe width=\"420\" height=\"315\" " +
            "src='" + youTubeUrl + "' frameborder=\"0\" allowfullscreen>" +
            "</iframe></body></html>";


    @SuppressLint("SetJavaScriptEnabled")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        webView = (WebView) findViewById(R.id.webView);

        String regexYoutUbe = "^(http(s)?:\\/\\/)?((w){3}.)?youtu(be|.be)?(\\.com)?\\/.+";
        if (youTubeUrl.matches(regexYoutUbe)) {

            //setting web client
            webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    return false;
                }
            });
          
            WebSettings webSettings = webView.getSettings();
            webSettings.setJavaScriptEnabled(true);
            webSettings.setDomStorageEnabled(true);
            webView.loadData(frameVideo, "text/html", "utf-8");


        } else {
            Toast.makeText(MainActivity.this, "This is other video",
                    Toast.LENGTH_SHORT).show();
        }
    }
}

0 Answers0