NO_STREAM_PLAYING_EVENT when Browser on different Machine than Server

Hi, we have a setup working with openvidu-server-kms - if the browser is running on the same machine as the server.
However, as soon as we point a browser from another machine to the server, we get NO_STREAM_PLAYING_EVENT.
There are no network issues logged in the browser console, using “verbose” log and omitting enableProdMode().
We also tried a full CE install (on-premises) and here the same issues occur.
OpenVidu Client “getActiveSessions()” shows proper “IPCAM” connection and “WEBRTC” connection.

One difference we noticed between “embedded” install (openvidu-server-kms) and CE install:

  1. “embedded” install does not show “RTCPeerConnection …connected” at all
  2. with CE install the browser shows a log message along the lines:
    IceConnectionState of RTCPeerConnection f73c8820-7855-4f7d-9c6e-8456a9ba2e90 (str_IPC_UxYw_ipc_IPCAM_rtsp_YPPI_10_232_4_80_554_h264Preview_01_main) change to "connected" (yet, still getting NO_STREAM_PLAYING_EVENT)

Any help would be greatly appreciated since we don’t really know how to dig into this any further.

PS I intended to attach the verbose log from the browser console but the post got too big.

This is a working log - Browser on the same machine as the Server.

openvidu-browser version: 2.19.0
OpenViduLogger.js:246 openvidu-server version: 2.19.0
OpenViduLogger.js:246 'Connection' created (local)
OpenViduLogger.js:246 Remote 'Connection' with 'connectionId' [ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main] is now configured for receiving Streams with options:  Object
OpenViduLogger.js:246 'Connection' created (remote) with 'connectionId' [ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main]
OpenViduLogger.js:246 Event 'streamCreated' triggered by 'Session' StreamEventcancelable: falsehasBeenPrevented: falsereason: ""stream: Stream {isSubscribeToRemote: false, isLocalStreamReadyToPublish: false, isLocalStreamPublished: false, publishedOnce: false, harkSpeakingEnabled: false, …}target: Session {userHandlerArrowHandler: WeakMap, ee: EventEmitter, streamManagers: Array(1), remoteStreamsCreated: Map(1), remoteConnections: Map(1), …}type: "streamCreated"[[Prototype]]: Event
open-vidu-session-manager.service.ts:98 streamCreated StreamEvent
OpenViduLogger.js:246 Subscribing to ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main
OpenViduLogger.js:246 New video element associated to  Subscriber
OpenViduLogger.js:219 IceConnectionState of RTCPeerConnection 97cdb1f4-0dbd-47ad-81c4-e3ceb10013a9 (str_IPC_VYGB_ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main) change to "checking"
OpenViduLogger.js:246 'Subscriber' (str_IPC_VYGB_ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main) successfully subscribed
OpenViduLogger.js:246 Subscribed correctly to ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main
OpenViduLogger.js:219 IceConnectionState of RTCPeerConnection 97cdb1f4-0dbd-47ad-81c4-e3ceb10013a9 (str_IPC_VYGB_ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main) change to "connected"
OpenViduLogger.js:246 Remote 'Stream' with id [str_IPC_VYGB_ipc_IPCAM_rtsp_AY68_10_232_4_80_554_h264Preview_01_main] video is now playing

This is a non-working log, Browser on a different Machine than the Server.
######################

openvidu-browser version: 2.19.0
main-es2015.8f3d93404a6063b9f714.js:1 openvidu-server version: 2.19.0
main-es2015.8f3d93404a6063b9f714.js:1 'Connection' created (local)
main-es2015.8f3d93404a6063b9f714.js:1 Remote 'Connection' with 'connectionId' [ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main] is now configured for receiving Streams with options:  {id: 'str_IPC_G0UH_ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main', createdAt: 1636472643014, connection: e, hasAudio: true, hasVideo: true, …}
main-es2015.8f3d93404a6063b9f714.js:1 'Connection' created (remote) with 'connectionId' [ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main]
main-es2015.8f3d93404a6063b9f714.js:1 Event 'streamCreated' triggered by 'Session' t {hasBeenPrevented: false, cancelable: false, target: t, type: 'streamCreated', stream: e, …}cancelable: falsehasBeenPrevented: falsereason: ""stream: e {isSubscribeToRemote: false, isLocalStreamReadyToPublish: false, isLocalStreamPublished: false, publishedOnce: false, harkSpeakingEnabled: false, …}target: t {userHandlerArrowHandler: WeakMap, ee: l, streamManagers: Array(1), remoteStreamsCreated: Map(1), remoteConnections: Map(1), …}type: "streamCreated"[[Prototype]]: e
main-es2015.8f3d93404a6063b9f714.js:1 streamCreated t {hasBeenPrevented: false, cancelable: false, target: t, type: 'streamCreated', stream: e, …}
main-es2015.8f3d93404a6063b9f714.js:1 Subscribing to ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main
main-es2015.8f3d93404a6063b9f714.js:1 New video element associated to  t {userHandlerArrowHandler: WeakMap, ee: l, videos: Array(1), lazyLaunchVideoElementCreatedEvent: false, stream: e, …}
main-es2015.8f3d93404a6063b9f714.js:1 'Subscriber' (str_IPC_G0UH_ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main) successfully subscribed
main-es2015.8f3d93404a6063b9f714.js:1 Subscribed correctly to ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main
main-es2015.8f3d93404a6063b9f714.js:1 IceConnectionState of RTCPeerConnection 51d960e1-f8cf-46e5-a670-e898e0ab4560 (str_IPC_G0UH_ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main) change to "checking"
main-es2015.8f3d93404a6063b9f714.js:1 StreamManager of Stream str_IPC_G0UH_ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main (Subscriber) did not trigger "streamPlaying" event in 20000 ms
main-es2015.8f3d93404a6063b9f714.js:1 Event 'exception' triggered by 'Session' t {hasBeenPrevented: false, cancelable: false, target: t, type: 'exception', name: 'NO_STREAM_PLAYING_EVENT', …}
main-es2015.8f3d93404a6063b9f714.js:1 clientSession exception t {hasBeenPrevented: false, cancelable: false, target: t, type: 'exception', name: 'NO_STREAM_PLAYING_EVENT', …}
main-es2015.8f3d93404a6063b9f714.js:1 IceConnectionState of RTCPeerConnection 51d960e1-f8cf-46e5-a670-e898e0ab4560 (str_IPC_G0UH_ipc_IPCAM_rtsp_DMZT_10_232_4_80_554_h264Preview_01_main) change to "disconnected". Possible network disconnection
main-es2015.8f3d93404a6063b9f714.js:1 Event 'exception' triggered by 'Session' t {hasBeenPrevented: false, cancelable: false, target: t, type: 'exception', name: 'ICE_CONNECTION_DISCONNECTED', …}
main-es2015.8f3d93404a6063b9f714.js:1 clientSession exception t {hasBeenPrevented: false, cancelable: false, target: t, type: 'exception', name: 'ICE_CONNECTION_DISCONNECTED', …}

openvidu-server-kms is designed for development, not for production usage.

Please deploy OpenVidu for production using the provided guides:

https://docs.openvidu.io/en/stable/deployment/

As I stated:

We als went by this guide:
https://docs.openvidu.io/en/stable/deployment/ce/on-premises/
what I did not quite understand is why would we have to open all the non-http ports because I thought we could do video-streaming via https only? And if we did not open the ports, why did the browser not complain about any network problems? Is the browser actually using udp?

Sorry if this may sound ignorant, we thought html5-compliant viewing would be possibly using https/wss only.

Thank you in advance for your help!

I dug a bit deeper and found this: Browser APIs and Protocols: WebRTC - High Performance Browser Networking (O'Reilly)

Using chrome://webrtc-internals/ I was able to see that I cannot reach any STUN due to local network restrictions?

url: stun:stun.schlund.de:3478
address: [0:0:0:x:x:x:x:x]
port: 64663
host_candidate: [0:0:0:x:x:x:x:x]:64663
error_text: STUN host lookup received error.
error_code: 701

going by: WebRTC on isolated LAN without ice/stun/turn server - Stack Overflow - is it possible to run OpenVidu without STUN?
Looking at /t/external-stun-turn-server/2374/2 now

OpenVidu has a built in Stun and Turn servers.

Are you opened ports indicated in the OpenVidu deployment documentation? They are needed.

If the client is located in a firewall restricted networks where only 80 and 443 ports are open, then you need to deploy an additional turn server following these instructions:

Thank you for your great support. Would it possible to empty iceServers to [] like suggested here?

Just found the code, an empty Array will also revert to “freeice”

        this.configuration = {
            ...configuration,
            iceServers:
                !!configuration.iceServers &&
                    configuration.iceServers.length > 0
                    ? configuration.iceServers
                    : freeice(),
            mediaStream:
                configuration.mediaStream !== undefined
                    ? configuration.mediaStream
                    : null,
            mode: !!configuration.mode ? configuration.mode : "sendrecv",
            id: !!configuration.id ? configuration.id : this.generateUniqueId(),
        };

I’ve set up the external coturn on the internet, and I can follow all this negotiation according to this diagram.

After a couple of Ice Candidates received I now get “connected” quite quickly, yet no video stream arriving.
@micael.gallego Any hints where I could look into?

SDP answer received, setting remote description
OpenViduLogger.js:246 'Subscriber' (str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main) successfully subscribed
OpenViduLogger.js:234 Peer remote stream MediaStream {id: 'bab91aff-bd2d-4060-8f5c-9265ad499e4d', active: true, onaddtrack: null, onremovetrack: null, onactive: null, …}
OpenViduLogger.js:234 Video srcObject [[object MediaStream]] updated in stream [str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main]
OpenViduLogger.js:234 WebRtc stats not enabled
OpenViduLogger.js:246 Subscribed correctly to ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main
2OpenViduLogger.js:234 Response: {"sessionId":"usdt85qn513ih0hm53iemuqusi"}
OpenViduLogger.js:234 Remotecandidate foripc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main RTCIceCandidate {candidate: 'candidate:842163049 1 udp 1677729535 87.130.58.70 … rport 0 generation 0 ufrag m8Kb network-cost 999', sdpMid: '0', sdpMLineIndex: 0, foundation: '842163049', component: 'rtp', …}
OpenViduLogger.js:234 Sending request: {method:"onIceCandidate", params: {"endpointName":"ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main","candidate":"candidate:842163049 1 udp 1677729535 87.130.58.70 61680 typ srflx raddr 0.0.0.0 rport 0 generation 0 ufrag m8Kb network-cost 999","sdpMid":"0","sdpMLineIndex":0}}
OpenViduLogger.js:234 Received request: {"method":"iceCandidate","params":{"senderConnectionId":"ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main","endpointName":"con_CEcGKfVMvD_str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main","sdpMLineIndex":1,"sdpMid":"1","candidate":"candidate:2 1 TCP 1015021823 194.163.142.157 9 typ host tcptype active"}}

<receiving some more “Remote ICE candidate” log shortended>

Remote ICE candidate received {candidate: 'candidate:4 1 UDP 2015363583 fe80::250:56ff:fe87:4770 50558 typ host', sdpMid: '1', sdpMLineIndex: 1, component: null, foundation: null, …}
OpenViduLogger.js:234 Response: {"sessionId":"usdt85qn513ih0hm53iemuqusi"}
OpenViduLogger.js:219 IceConnectionState of RTCPeerConnection 278cb290-93cb-4077-a8b7-c439fa35161b (str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main) change to "checking"
OpenViduLogger.js:219 IceConnectionState of RTCPeerConnection 278cb290-93cb-4077-a8b7-c439fa35161b (str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main) change to "connected"
OpenViduLogger.js:261 StreamManager of Stream str_IPC_RiJu_ipc_IPCAM_rtsp_CEEP_10_232_4_80_554_h264Preview_01_main (Subscriber) did not trigger "streamPlaying" event in 30000 ms

Hi, I see that you are using IP cameras.

Does WebRTC connections works? It is only the IP Camera what it is not working?

Thank you for interest in helping us, @cruizba

we don’t have TURN Port 3478 open for example so we are trying to go with external COTURN server, telling OpenVidu’s KMS to use a certain TURN url via Environment variable KMS_TURN_URL. We are yet to complete the network setup. On the OpenVidu Client side, we now use “iceServers” AdvancedConfiguration to inject the same TURN Urls.
Running Server and Browser on the same machine (without external TURN) works since we don’t have any network problems there.

Please test OpenVidu deployment exactly how it is described in the documentation and open all specified ports.

Then, test if the deployment is working.

Only when the official deployment is working start experimenting with other TURN services and closing ports.

Best regards

Ok, so far we reverted to another site in order to be able to make a “vanilla” install and to make sure it works.
We experimented with an external COTURN (also as you documented, also using “iceServers” advanced confguration) but we haven’t found a way to “force” relay. Apparently the partners try to to go via peer-to-peer and fail if the firewall is more restrictive.
Also we are still trying to learn how to “read” chrome://webrtc-internals/ output with all these ICE candidates.
Also what seemed to help in general (also when not using external COTURN):

  1. turn off IPv6 on the server (behind a NAT) since the machine is accesible (over NAT) over IPv4 only
  2. set for “kms” KMS_EXTERNAL_IPV4=auto to propagate external IPv4 instead of internal IPv4

It is easier to see candidates in about:webrtc from firefox. There is multiple information there, for example:

You should see there your external coturn configured in the “iceServers” section and the candidates generated.

When using relay you should be able to see the public IP of the Coturn server in “Local candidates” and the public IP of the Media Server in “Remote Candidates”.

You can also force the use of relay in firefox by enabling this parameter, but this will only ensure that relay candidates works in your network condition:

Also test that your External Coturn is correctly setup in Trickle ICE: Trickle ICE

Regards