danijel3 / KaldiWebrtcServer

Python server for communicating with Kaldi from the browser using WebRTC
Apache License 2.0
67 stars 37 forks source link

Always connecting... #3

Open cjjjy opened 4 years ago

cjjjy commented 4 years ago

Hi ,I install this project follow your steps on the linux server, (1)docker-compose up -d (2)docker-compose logs -f and it has no error and running sucessfully,LOG AS FOLLOWS: ....... kaldi_1 | LOG (online2-tcp-nnet3-decode-faster[5.5.259~1-25269]:Accept():online2-tcp-nnet3-decode-faster.cc:345) Waiting for client...

Then I test on my computer , the computer and server in same local area network. when i print the url as http://myipaddress:8080/ ,the browser shows webpage sucessfully. and press "Start button",it shows tip text Connecting... all the time.

how can i solve the problem?

danijel3 commented 4 years ago

Are you trying to connect to a remove service? Where is the server located? Is it in the same network or behind NAT? You can read about making a service running on a remote server in issue #1

takeofuture commented 4 years ago

@danijel3 Thank you for this, this isgreat. @cjjjy Regarding this issue, if you do http://localhost:8080, it works fine and browser should prompt if you allow to let this page use mic. If you do remotely, you need to use https: You can do R-Proxy if you use Ubuntu by installing apache2 or NGINX I did with Nginx

server {
  # ...
  listen 443 ssl;
  server_name servername;

  # self-sgned SSL Certicate
  ssl_certificate /etc/nginx/ssl/mycert.crt;
  # self-signed Secret key
  ssl_certificate_key /etc/nginx/ssl/mykey.key;
  location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_redirect http:// https://;
  }
}

Then you simple access https://servername

danijel3 commented 4 years ago

Hmm, you think I could create a docker-compose config that includes nginx and a self-signed certificate for testing purposes?

Still people will keep asking why it doesn't work if they run it under their own domain...

takeofuture commented 4 years ago

In my case, http://localhost:8080 (works fine, prompted to allow to use mic and I allowed then status changed to listening, and you see mic icon on the browser) http://remote:8080 (Nothing, issue exactly reported on this thread) https://remote (works fine, prompted to allow to use mic and I allowed then status changed to listening, and you see mic icon on the browser)

If http, (not https) Only localhost or 127.0.0.1 work, But same domain and different server does not work due to the browser restriction as far as my case.

As far as I see, it is more like Broswer Security restriction. Web Browser requires to use local PC mic device. But recently released browsers (FF, Google Chrome etc) do not allow to access local PC mic device if you use http:// on remote server.

You could try to create 8443 port with self-signed SSL on docker_web_1 if you like which ever easier, but I think just commenting README would be good enough and people can figured out workaround solution (this is juts my opinion) (I did use nginx since it is just easier and I am more interested in real-time decoding part rather than ssl configuration and did not want to spend too much time on this browser security matter)

Also I guess the users can try developer option instead of regular browsers to test without this kind of security restriction issue Example: https://www.mozilla.org/en-US/firefox/developer/

xbsdsongnan commented 4 years ago

how can i solve the problem?Always connecting