Hi.
We are developing React web app and faced one issue witch is stable reproducible.
So in according to docs when page is loaded then new connection to openvidu is created and listener is created like:
session.on('publisherStartSpeaking', (event) => {
console.log('User ' + event.connection.connectionId + ' start speaking');
});
When page is unloaded there is closing session in componentWillUnmount and also by “beforeunload” window listener.
So when we refresh page (via F5 for example) everything works as expected, i.e. connection is closed and the created again, BUT speech detection does not work after refresh (video and audio streaming work as expected).
I looked at console logs and see there:
Remote 'Connection' with 'connectionId' [con_KAIfjHb2qy] is now configured for receiving Streams with options
'Connection' created (remote) with 'connectionId' [con_KAIfjHb2qy]
Subscribing to con_KAIfjHb2qy
'Subscriber' (str_MIC_LxHt_con_KAIfjHb2qy) successfully subscribed
The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page. https://goo.gl/7K7WLu
Subscribed correctly to con_KAIfjHb2qy
IceConnectionState of RTCPeerConnection 2179994c-e743-40c8-83ce-f40e3c97d5e1 (str_MIC_LxHt_con_KAIfjHb2qy) change to "checking"
Remote 'Stream' with id [str_MIC_LxHt_con_KAIfjHb2qy] video is now playing
IceConnectionState of RTCPeerConnection 2179994c-e743-40c8-83ce-f40e3c97d5e1 (str_MIC_LxHt_con_KAIfjHb2qy) change to "connected"
'Publisher' (str_CAM_EPiE_con_KCmzV9HJRO) successfully published to session
IceConnectionState of RTCPeerConnection b6b58803-2dd6-4e9e-aac5-a8e541d5cc12 (publisher of con_KCmzV9HJRO) change to "checking"
IceConnectionState of RTCPeerConnection b6b58803-2dd6-4e9e-aac5-a8e541d5cc12 (publisher of con_KCmzV9HJRO) change to "connected"
Event 'streamDestroyed' triggered by 'Session'
Event 'connectionDestroyed' triggered by 'Session'
'Connection' created (remote) with 'connectionId' [con_MAC96dKdxC]
Event 'connectionCreated' triggered by 'Session'
Remote 'Connection' with 'connectionId' [con_MAC96dKdxC] is now configured for receiving Streams with options:
Event 'streamCreated' triggered by 'Session'
Subscribing to con_MAC96dKdxC
'Subscriber' (str_MIC_OXtA_con_MAC96dKdxC) successfully subscribed
Subscribed correctly to con_MAC96dKdxC
IceConnectionState of RTCPeerConnection 15ae6cf5-e5b4-426b-8ada-b9983c6a9cf3 (str_MIC_OXtA_con_MAC96dKdxC) change to "checking"
IceConnectionState of RTCPeerConnection 15ae6cf5-e5b4-426b-8ada-b9983c6a9cf3 (str_MIC_OXtA_con_MAC96dKdxC) change to "connected"
Remote 'Stream' with id [str_MIC_OXtA_con_MAC96dKdxC] video is now playing
IceConnectionState of RTCPeerConnection 2179994c-e743-40c8-83ce-f40e3c97d5e1 (str_MIC_LxHt_con_KAIfjHb2qy) change to "disconnected". Possible network disconnection
I’m not sure exactly but it seems to me that there is next timeline:
After pressing Refresh button this.session.disconnect(); is called. Then page is loaded again and connection is created BUT old connection is not destroyed yet. It’s destroyed after some time only.
May it cause such behavior that speech detection does not work after that?
Version of OpenVidu which we use is 2.17.0.