3

I want to stream to WebView inside a Anrdoid App.

My code is:

WebView cam = (WebView) findViewById(R.id.Cam);
        cam.getSettings().setLoadWithOverviewMode(true);
        cam.getSettings().setUseWideViewPort(true);
        cam.getSettings().setBuiltInZoomControls(true);
        cam.getSettings().setPluginState(WebSettings.PluginState.ON);
        cam.getSettings().setPluginState(WebSettings.PluginState.ON);
        cam.loadUrl("http://192.168.0.10");

It works in emulator but if I install the App at smartphone it doesnt work. I get an error

Header fields are too long for the server to interpret

How do get rid of this error?

Bharathi
  • 1,025
  • 13
  • 40
Rachid Id
  • 31
  • 1
  • 3

2 Answers2

5

Edit sdkconfig and increase CONFIG_HTTPD_MAX_REQ_HDR_LEN e.g. like this:

CONFIG_HTTPD_MAX_REQ_HDR_LEN=2048
rustyx
  • 73,455
  • 21
  • 176
  • 240
1

I had the same problem but with Unity. In my app, I was struggling with

Header fields are too long for the server to interpret

but Chrome browser in android was showing it right. I changed ESP32 code but not worked. When I try opening it in desktop mode it worked. You had to change your "User Agent" setting.

 String newUA= "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0";
 mWebView.getSettings().setUserAgentString(newUA);

like in: Setting WebView to view Desktop Site and Not Mobile Site