lmoor
lmoor

Reputation: 195

No remote stream using kurento docker image with kurento hello world example on host

I installed a KMS container on my server and I downloaded kurento hello world java application on my server but when I go to my java web application using my server IP adress I have to remote stream and and the following error (in firefox):

ICE failed, see about:webrtc for more details

in the about:webrtc It tells me that there is no STUN and no TURN server specified (and a lot of following output not very clear to me) The problem is that I specified a STUN server on the WebRtcEndpoint.conf.ini.

Here is my docker-compose.yml file:

kurento:
image: fiware/stream-oriented-kurento:latest
volumes:
    - ./kurento.conf.json:/etc/kurento/kurento.conf.json:ro
    - ./defaultCertificate.pem:/etc/kurento/defaultCertificate.pem:ro
    - ./WebRtcEndpoint.conf.ini:/etc/kurento/modules/kurento/WebRtcEndpoint$
ports:
    - "8888:8888"
    - "8433:8433"

here is my kurento.conf.json file:

{
"mediaServer" : {
"resources": {
//  //Resources usage limit for raising an exception when an object creatio$
//  "exceptionLimit": "0.8",
//  // Resources usage limit for restarting the server when no objects are $
//  "killLimit": "0.7",
    // Garbage collector period in seconds
    "garbageCollectorPeriod": 240
},

    "net" : {
  "websocket": {
    "port": 8888,
    "secure": {
      "port": 8433,
      "certificate": "defaultCertificate.pem",
      "password": ""
    },
    //"registrar": {
    //  "address": "ws://localhost:9090",
    //  "localAddress": "localhost"
    //},
    "path": "kurento",
    "threads": 10
      }
    }
  }
}

and my WebRtcEndpoint.conf.ini

; Only IP address are supported, not domain names for addresses
; You have to find a valid stun server. You can check if it works
; usin this tool:
;   http://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/ 
stunServerAddress=62.71.2.168
stunServerPort=3478

; turnURL gives the necessary info to configure TURN for WebRTC.
;    'address' must be an IP (not a domain).
;    'transport' is optional (UDP by default).
; turnURL=user:password@address:port(?transport=[udp|tcp|tls])

;pemCertificate is deprecated. Please use pemCertificateRSA instead
;pemCertificate=<path>
;pemCertificateRSA=<path>
;pemCertificateECDSA=<path>

and the certificate has been generated with :

certtool --generate-privkey --outfile defaultCertificate.pem
echo 'organization = your organization name' > certtool.tmpl
certtool --generate-self-signed --load-privkey defaultCertificate.pem \
--template certtool.tmpl >> defaultCertificate.pem

sudo chown kurento defaultCertificate.pem

and I went on my https://localhost:8433/kurento to validate the certificate

When I start the kurento container with docker-compose up I can see on the logs that my conf. file has been loaded:

kurento_1           |             "websocket":
kurento_1           |             {
kurento_1           |                 "port": "8888",
kurento_1           |                 "secure":
kurento_1           |                 {
kurento_1           |                     "port": "8433",
kurento_1           |                     "certificate": 
"defaultCertificate.pem",
kurento_1           |                     "password": ""
kurento_1           |                 },
kurento_1           |                 "path": "kurento",
kurento_1           |                 "threads": "10"
kurento_1           |             }

.....

kurento_1           |             "WebRtcEndpoint":
kurento_1           |             {
kurento_1           |                 "stunServerAddress": "62.71.2.168",
kurento_1           |                 "stunServerPort": "3478",
kurento_1           |                 "configPath": 
"\/etc\/kurento\/modules\/kurento"
kurento_1           |             },

and I start the hello world example with :

sudo mvn compile exec:java -Dkms.url=wss://localhost:8433/kurento

at this point everything seems to work OK, no error output.

When I try to access my web application from a client with https://:8443 the web page is loaded correctly and can start the stream. But I have no remote stream and have the error I printed at the beginning.

UPDATE 1

I changed the version of the kurento image in docker-compose.yml from

image: fiware/stream-oriented-kurento:latest

to:

image: fiware/stream-oriented-kurento:6.6.0

And now it is working sometimes. I have the same error (ICE failed, see about:webrtc for more details) but if I reload the page multiple time, it end up working after some reload. Any suggestion about what I am doing wrong?

UPDATE 2

I realized that when the web application start working (after multiple reload), the next time I access the web applicaiton, it will always work, until I restart the KMS. Then I have to reaload the page multiple time again to have the remote stream.

Now that I realized that, I tried again with image: fiware/stream-oriented-kurento:latest and it has the exact same behavior. I have to reload multiple time the page to make it work. I have no clue why is that, any idea?

Upvotes: 0

Views: 1707

Answers (1)

gtunon
gtunon

Reputation: 43

Looking into your problem I feel the ICE candidates have not been created properly on both sides.

Have you configured the STUN / TURN in the webApplication (JS)? If you haven't modify the example I believe they are not configured by default

Check into the options.configuration. Example:

var options  = {
        ........ some options here .... 
        configuration: { 
               iceServers:[{ 
                       "url": "turn:xxx.xxx.xxx:port", 
                       "username": "xxxxxx", 
                       "credential": "xxxxxx" 
              }] 
        } 
webRtcPeer = new kurentoUtils.WebRtcPeer.WebRtcPeerSendrecv(options,<callback-here>);

Can you provide logs for both the Firefox ICE candidates generation and KMS ICE generation?

In addition is KMS up and running in the same machine as the tutorial?

Upvotes: 2

Related Questions