google / android-emulator-container-scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

can't view the emulator on the web through webrtc

crazier opened this issue · comments

I have two servers A,B. Due to the network policy, B cannot be directly accessed through port 80 on the PC, but A can access all ports of B. And the PC can access A's 80 port.To view the android in the web, So I need to deploy an Nginx on machine A and route requests to machine B. Nginx is configured as follows:

But the function of webrtc does not work properly, the android.emulation.control.Rtc/receiveJsepMessages api reponse nothing . other API functions are normal.
How to solve this?

Deploy the emulator steps in B machine:

  1. emu-docker interactive --start
  2. ./create_web_container.sh -p user1,passwd1,user2,passwd2,....

Add Nginx Config in A machine:

l`ocation /emulator {
proxy_http_version 1.1;
proxy_pass https://B_IP;
#error_page 301 302 303 = @handle_redirect;
}

location /token {
    proxy_http_version 1.1;
    proxy_pass https://B_IP/token;
}

location /android.emulation.control.EmulatorController {
    proxy_http_version 1.1;
    proxy_pass https://B_IP/android.emulation.control.EmulatorController ;
    #error_page 301 302 303 = @handle_redirect;
}

location /android.emulation.control.Rtc {
    proxy_http_version 1.1;
    proxy_pass https://B_IP/android.emulation.control.Rtc;
}

location ^~ /static/ {
    proxy_http_version 1.1;
    proxy_pass https://B_IP/static/;
}`