ConnectyCube / connectycube-js-sdk-releases

Releases materials for ConnectyCube JS SDK platform https://connectycube.com
9 stars 2 forks source link

onRemoteStreamListener not triggered after joint to conference #103

Open linatan9 opened 2 years ago

linatan9 commented 2 years ago

I'm building a video chat in my mobile application and for first results I clone example project from connectycube (https://github.com/ConnectyCube/connectycube-reactnative-samples)

I didnt change anything in codebase just added my own configs and users (user ids I got from connectycube table https://admin.connectycube.com/apps/***/service/users)

So this listener didn't trigger in any case videoConference and I'm not able to get remote stream of connected user

ConnectyCube.videochatconference.onParticipantJoinedListener = this.onAcceptCallListener.bind(this);

I'm able to handle onParticipantJoinedListener but not previous one.

Not sure that is required code example since its the same as on repository.

If anyone had the same problem before please help me Thanks

linatan9 commented 2 years ago

@ccvlad I saw your a lot of activities in past topic may be you can help me. Thank you!

ccvlad commented 2 years ago

Hi @linatan9

Could you show logs from Metro?

linatan9 commented 2 years ago

@ccvlad Yes of course , here is

[VideoCaptureController] Capture will start RCTLog.js:47 [VideoCaptureController] Capture started janus.umd.js:123 Initializing library janus.umd.js:277 Library initialized: true janus.umd.js:302 Using WebSockets to contact Janus: wss://janus.connectycube.com:8989 janus.umd.js:574 [Janus][isWS] RCTLog.js:47 SocketRocket: In debug mode. Allowing connection to any root cert janus.umd.js:599 [Janus][wsHandlers][open] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:609 Created session: 6446333975491844 janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 6365877544811614 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] cubeVideoCallingConference.js:564 isOnlyAudio: false janus.umd.js:617 [Janus][wsHandlers][message] MeetRoom.js:224 undefined 'ROOM JOIONED' janus.umd.js:617 [Janus][wsHandlers][message] cubeVideoCallingConference.js:951 createOffer, inputParams: {useAudio: true, stream: EventTarget, useVideo: true} cubeVideoCallingConference.js:996 createOffer params: {stream: EventTarget} janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: EventTarget {active: true, _tracks: Array(2), id: 'BEE2DAA8-0091-4443-8410-6A61AAE98FB5', _reactTag: 'BEE2DAA8-0091-4443-8410-6A61AAE98FB5', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream janus.umd.js:1372 createOffer janus.umd.js:1723 Creating offer (iceDone=false) janus.umd.js:1741 [Janus][config.pc.createOffer] janus.umd.js:1743 [Janus][mediaConstraints][createOffer] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] MeetRoom.js:67 ConferenceSession {id: '0.19305181247099013', _clientConf: VideoConferencingClient, onSlowLinkListener: undefined, onParticipantJoinedListener: ƒ, onParticipantLeftListener: ƒ, …} 4928369 'tibakoh836@alltekia.com' 'onParticipantJoinedListener=====' janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 8148410501878822 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] 2janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: EventTarget {active: true, _tracks: Array(2), id: 'BEE2DAA8-0091-4443-8410-6A61AAE98FB5', _reactTag: 'BEE2DAA8-0091-4443-8410-6A61AAE98FB5', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream

ccvlad commented 2 years ago

Don't see any strange in the log above.

You will receive the remote stream in ConnectyCube.videochatconference.onRemoteStreamListener = this.onRemoteStreamListener

Please check the stream in the function onRemoteStreamListener: https://github.com/ConnectyCube/connectycube-reactnative-samples/blob/master/RNVideoChatConf/src/components/VideoScreen/index.js#L138

linatan9 commented 2 years ago

Yes, that was I mean that its not triggered for both users

ccvlad commented 2 years ago

Is the issue still actual if you return users and other configurations to their original state?

https://github.com/ConnectyCube/connectycube-reactnative-samples/blob/master/RNVideoChatConf/src/config.js

linatan9 commented 2 years ago

@ccvlad I have installed project and run it. Same issue but one error that I saw in stack
[createAnswer] error: peerConnection is null

[Chat] SENT: SystemNotifications161e7f755fc6d2741cc00000c72781 janus.umd.js:277 Library initialized: true janus.umd.js:302 Using WebSockets to contact Janus: wss://janus.connectycube.com:8989 janus.umd.js:574 [Janus][isWS] janus.umd.js:599 [Janus][wsHandlers][open] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:609 Created session: 7417578631464050 janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 8289826787895444 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] cubeVideoCallingConference.js:564 isOnlyAudio: false 2janus.umd.js:617 [Janus][wsHandlers][message] cubeVideoCallingConference.js:929 createOffer, inputParams: {useAudio: true, stream: MediaStream, useVideo: true} cubeVideoCallingConference.js:974 createOffer params: {stream: MediaStream} janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: MediaStream {active: true, _tracks: Array(2), id: 'feb83673-801e-4670-9e51-f7425368ae38', _reactTag: 'feb83673-801e-4670-9e51-f7425368ae38', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream janus.umd.js:1372 createOffer janus.umd.js:1723 Creating offer (iceDone=false) janus.umd.js:1741 [Janus][config.pc.createOffer] janus.umd.js:1743 [Janus][mediaConstraints][createOffer] janus.umd.js:1776 [Janus][createOffer][error] peerConnection is null 2janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 1318027201185232 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] 2janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: MediaStream {active: true, _tracks: Array(2), id: 'feb83673-801e-4670-9e51-f7425368ae38', _reactTag: 'feb83673-801e-4670-9e51-f7425368ae38', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream cubeVideoCallingConference.js:1026 [createAnswer] error: peerConnection is null

ccvlad commented 2 years ago

Are you using Android emulator or iOS simulator to test the application?

linatan9 commented 2 years ago

Ios real device and Android emulator since Android can emulate a camera instead of Ios @ccvlad

ccvlad commented 2 years ago

Hi, @linatan9

I have tried to start the RNVideoChatConf project from scratch on Android emulator and iOS device and it works.

Set the log console.log(JSON.stringify(ConnectyCube.service.sdkInstance.config)) after ConnectyCube.init(...). Also show logs from start the application where I can see the user login actions, connecting to chat and join to a conference room.

Make sure that the debug mode is on in the config like here

linatan9 commented 2 years ago

HI, @ccvlad

{"version":"3.13.0","creds":{"appId":385,"authKey":"DFBMs5-dKBBCXcd","authSecret":"SkCW-ThdnmRg9Za"},"endpoints":{"api":"api.connectycube.com","chat":"chat.connectycube.com","muc":"muc.chat.connectycube.com"},"hash":"sha1","chatProtocol":{"bosh":"https://chat.connectycube.com:5281","websocket":"wss://chat.connectycube.com:5291","active":2},"webSession":{"getSessionTimeInterval":3,"getSessionTimeout":120},"chat":{"contactList":{"subscriptionMode":{"mutual":true}},"streamManagement":{"enable":false},"ping":{"enable":false,"timeInterval":60},"reconnect":{"enable":true,"timeInterval":5}},"videochat":{"alwaysRelayCalls":false,"answerTimeInterval":60,"dialingTimeInterval":5,"disconnectTimeInterval":30,"statsReportTimeInterval":false,"iceServers":[{"urls":"stun:stun.l.google.com:19302"},{"urls":"stun:turn.connectycube.com"},{"urls":"turn:turn.connectycube.com:5349?transport=udp","username":"connectycube","credential":"4c29501ca9207b7fb9c4b4b6b04faeb1"},{"urls":"turn:turn.connectycube.com:5349?transport=tcp","username":"connectycube","credential":"4c29501ca9207b7fb9c4b4b6b04faeb1"}]},"conference":{"server":"wss://janus.connectycube.com:8989"},"whiteboard":{"server":"https://whiteboard.connectycube.com"},"urls":{"session":"session","webSession":"session/web","login":"login","users":"users","chat":"chat","blobs":"blobs","subscriptions":"subscriptions","events":"events","data":"data","addressbook":"address_book","addressbookRegistered":"address_book/registered_users","meetings":"meetings","whiteboards":"whiteboards","type":".json"},"on":{"sessionExpired":null,"xmppDataWrite":null,"xmppDataRead":null},"timeout":null,"debug":{"mode":1}}

ccvlad commented 2 years ago

Hi, @linatan9

I have tried to start the RNVideoChatConf project from scratch on Android emulator and iOS device and it works.

Set the log console.log(JSON.stringify(ConnectyCube.service.sdkInstance.config)) after ConnectyCube.init(...). Also show logs from start the application where I can see the user login actions, connecting to chat and join to a conference room.

Make sure that the debug mode is on in the config like here

logs?

linatan9 commented 2 years ago

@ccvlad Hi, sorry here is logs

Running "RNVideoChat" with {"rootTag":1} auth-service.js:11 init---> {"version":"3.13.0","creds":{"appId":385,"authKey":"DFBMs5-dKBBCXcd","authSecret":"SkCW-ThdnmRg9Za"},"endpoints":{"api":"api.connectycube.com","chat":"chat.connectycube.com","muc":"muc.chat.connectycube.com"},"hash":"sha1","chatProtocol":{"bosh":"https://chat.connectycube.com:5281","websocket":"wss://chat.connectycube.com:5291","active":2},"webSession":{"getSessionTimeInterval":3,"getSessionTimeout":120},"chat":{"contactList":{"subscriptionMode":{"mutual":true}},"streamManagement":{"enable":false},"ping":{"enable":false,"timeInterval":60},"reconnect":{"enable":true,"timeInterval":5}},"videochat":{"alwaysRelayCalls":false,"answerTimeInterval":60,"dialingTimeInterval":5,"disconnectTimeInterval":30,"statsReportTimeInterval":false,"iceServers":[{"urls":"stun:stun.l.google.com:19302"},{"urls":"stun:turn.connectycube.com"},{"urls":"turn:turn.connectycube.com:5349?transport=udp","username":"connectycube","credential":"4c29501ca9207b7fb9c4b4b6b04faeb1"},{"urls":"turn:turn.connectycube.com:5349?transport=tcp","username":"connectycube","credential":"4c29501ca9207b7fb9c4b4b6b04faeb1"}]},"conference":{"server":"wss://janus.connectycube.com:8989"},"whiteboard":{"server":"https://whiteboard.connectycube.com"},"urls":{"session":"session","webSession":"session/web","login":"login","users":"users","chat":"chat","blobs":"blobs","subscriptions":"subscriptions","events":"events","data":"data","addressbook":"address_book","addressbookRegistered":"address_book/registered_users","meetings":"meetings","whiteboards":"whiteboards","type":".json"},"on":{"sessionExpired":null,"xmppDataWrite":null,"xmppDataRead":null},"timeout":null,"debug":{"mode":1}} backend.js:32 Debugger and device times have drifted by more than 60s. Please correct this by running adb shell "date date +%m%d%H%M%Y.%S" on your debugger machine. n @ backend.js:32 registerWarning @ LogBox.js:117 warnImpl @ LogBox.js:63 console.warn @ LogBox.js:36 emitTimeDriftWarning @ JSTimers.js:459 callFunction @ MessageQueue.js:411 (anonymous) @ MessageQueue.js:109 guard @ MessageQueue.js:359 callFunctionReturnFlushedQueue @ MessageQueue.js:108 (anonymous) @ debuggerWorker.cff11639.js:4 cubeInternalUtils.js:131 [Request][1] POST https://api.connectycube.com/session.json {type: 'POST', url: 'https://api.connectycube.com/session.json', data: {…}} cubeInternalUtils.js:131 [Response][1] {session: {…}} cubeInternalUtils.js:131 [Chat] Connect with parameter: {userId: 72780, password: 'videouser1'} cubeInternalUtils.js:131 [Chat] status - connecting cubeInternalUtils.js:131 [Chat] status - connect cubeInternalUtils.js:131 [Chat] CONNECTING cubeInternalUtils.js:131 [Chat] status - opening cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] status - open {"name":"open","attrs":{"xmlns":"urn:ietf:params:xml:ns:xmpp-framing","from":"chat.connectycube.com","id":"faf2a61d-a0eb-48aa-8909-26fca98e2b72","version":"1.0","xml:lang":"en"},"children":[]} cubeInternalUtils.js:131 [Chat] RECV: PLAINANONYMOUSPLAIN_FASTzlib</stream:features> cubeInternalUtils.js:131 [Chat] SENT: ADcyNzgwLTM4NQB2aWRlb3VzZXIx cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] status - opening cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] status - open {"name":"open","attrs":{"xmlns":"urn:ietf:params:xml:ns:xmpp-framing","from":"chat.connectycube.com","id":"faf2a61d-a0eb-48aa-8909-26fca98e2b72","version":"1.0","xml:lang":"en"},"children":[]} cubeInternalUtils.js:131 [Chat] RECV: zlib</stream:features> cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] RECV: jid>72780-385@chat.connectycube.com/2039927192-chat-399414</jid cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] status - online {"_domain":"chat.connectycube.com","_local":"72780-385","_resource":"2039927192-chat-399414"} cubeInternalUtils.js:131 [Chat] ONLINE cubeInternalUtils.js:131 [Chat] CONNECTED cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] SENT: cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] RECV: cubeInternalUtils.js:131 [Chat] SENT: SystemNotifications161fa57fd72697e742c00000072781 janus.umd.js:123 Initializing library janus.umd.js:277 Library initialized: true janus.umd.js:302 Using WebSockets to contact Janus: wss://janus.connectycube.com:8989 janus.umd.js:574 [Janus][isWS] janus.umd.js:599 [Janus][wsHandlers][open] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:609 Created session: 3622071090746864 janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 7346515365461455 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] cubeVideoCallingConference.js:564 isOnlyAudio: false 2janus.umd.js:617 [Janus][wsHandlers][message] cubeVideoCallingConference.js:929 createOffer, inputParams: {useAudio: true, stream: MediaStream, useVideo: true} cubeVideoCallingConference.js:974 createOffer params: {stream: MediaStream} janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: MediaStream {active: true, _tracks: Array(2), id: 'cc301591-fbf6-46a7-b80a-ee4ec5123801', _reactTag: 'cc301591-fbf6-46a7-b80a-ee4ec5123801', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream janus.umd.js:1372 createOffer janus.umd.js:1723 Creating offer (iceDone=false) janus.umd.js:1741 [Janus][config.pc.createOffer] janus.umd.js:1743 [Janus][mediaConstraints][createOffer] janus.umd.js:1776 [Janus][createOffer][error] peerConnection is null 2janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:347 [Janus][this.attach] janus.umd.js:782 [Janus][createHandle] janus.umd.js:889 [Janus][websockets][ws] janus.umd.js:617 [Janus][wsHandlers][message] janus.umd.js:822 [Janus][websockets] janus.umd.js:823 Created handle: 7276049141857606 janus.umd.js:886 [Janus][websockets][pluginHandles[handleId]] 2janus.umd.js:617 [Janus][wsHandlers][message] cubeVideoCallingConference.js:1011 createAnswer START {remoteFeed: {…}, jsep: {…}, stream: MediaStream} janus.umd.js:1415 MediaStream provided by the application janus.umd.js:1269 streamsDone: MediaStream {active: true, _tracks: Array(2), id: 'cc301591-fbf6-46a7-b80a-ee4ec5123801', _reactTag: 'cc301591-fbf6-46a7-b80a-ee4ec5123801', Symbol(listeners): {…}} janus.umd.js:1272 [Janus][pc_config] janus.umd.js:1282 Creating PeerConnection janus.umd.js:1290 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1291 Preparing local SDP and gathering candidates (trickle=true) janus.umd.js:1332 Adding local stream cubeVideoCallingConference.js:1027 [createAnswer] error: peerConnection is null

linatan9 commented 2 years ago

@ccvlad It was tested on Android emulator + Android real device

ccvlad commented 2 years ago

Hi, @linatan9 !

Sorry, I was afk last days.

Your logs looks fine instead of "peerConnection is null" and empty space after "[Chat] SENT/RECV:" Are you debugging via Google Chrome console? Could you start app with npm run android or react-native run-android and do not open any other debuggers? Only Metro server should works.

There may be a problem with other debuggers, because they slow down the execution of application code. Thus, some parts of the code cannot await for their execution.

backend.js:32 Debugger and device times have drifted by more than 60s. Please correct this by running adb shell "date date +%m%d%H%M%Y.%S" on your debugger machine.

Also it can made the problem. Try to fix.