Duplicate Webview (streaming video)

38
March 16, 2019, at 10:40 AM

I'm struggling with problem that I can't figure out by myself. First of all, I'm trying to stream video from local server. I'm planning to use VR Googles so I made two separate webviews and it's working but both views are loading separately and this is a problem because sometimes one is faster than other. My question is how can I duplicate one webview to second in order to avoid loading two videos? Here is some code Activity:

public class SecondActivity extends Activity {
    private WebView webView = null;
    private WebView webView1 = null;
    Bundle bundle;
    String ip,full;
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
            bundle = getIntent().getExtras();
            ip = bundle.getString("ip");
            full = "http://" +ip +"/video";

        webView = (WebView) findViewById(R.id.webview);
        webView1 = (WebView) findViewById(R.id.webview1);
        WebSettings webSettings = webView.getSettings();
        WebSettings webSettings1 = webView1.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings1.setJavaScriptEnabled(true);
        WebViewClientImpl webViewClient = new WebViewClientImpl(this);
        webViewClient.Name(full);
        webView.setWebViewClient(webViewClient);
        webView.loadUrl(full);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
        webView.setScaleY(scaley);
        webView.setScaleX(scalex);
        webView1.setWebViewClient(webViewClient);
        webView1.loadUrl(full);
        webView1.getSettings().setLoadWithOverviewMode(true);
        webView1.getSettings().setUseWideViewPort(true);
        webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
        webView1.setScaleY(scaley);
        webView1.setScaleX(scalex);
    }

}
READ ALSO
Notification in Oreo working sometimes and sometimes not

Notification in Oreo working sometimes and sometimes not

I am working with notification in Android app

38
How to adjust the text auto-resize & when it moves to the 2nd line

How to adjust the text auto-resize & when it moves to the 2nd line

I am building a meme generatorThe issue that I'm having is with the texts that are drawn on the Canvas

22
How can get android.developer site offline? [on hold]

How can get android.developer site offline? [on hold]

I want to download all documentation of this site: https://developerandroid

16