FirebaseRTC icon indicating copy to clipboard operation
FirebaseRTC copied to clipboard

unable to connect different device

Open konu112233 opened this issue 5 years ago • 8 comments
trafficstars

i have hosted app in firebase but i can make video call of deifferent device mobile to pc or pc to bomile or other different pc you can see the link here

https://fir-rtc-6fb57.web.app/

konu112233 avatar Apr 18 '20 15:04 konu112233

Can you share the App.js code?

rahulchhabra07 avatar Apr 19 '20 13:04 rahulchhabra07

Can you share the App.js code?

FirebaseRTC.zip

please find the file as peer connection work in local server within same browser but same code hosted in firebabetween different device is not possible

konu112233 avatar Apr 20 '20 03:04 konu112233

I'm having the same issue. From desktop to mobile device the two streams on desktop display correctly, the receiver video on mobile does not display.

powerspowers avatar Apr 20 '20 10:04 powerspowers

Because Safari seems to have an issue with the addTrack calls in WebRTC you have to change the peerConnection event listener to add the stream instead. To go further it would probably be good to check for the Safari browser and leave the addTrack calls in there for non-Safari browsers.

Here is the fix - it has to be added to both createRoom and joinRoomById :

peerConnection.addEventListener('track', event => { console.log('Got remote track:', event.streams[0]); document.querySelector('#remoteVideo').srcObject = event.streams[0]; console.log(event.streams[0]); remoteStream = event.streams[0]; console.log('new remoteVideo'); });

powerspowers avatar Apr 23 '20 01:04 powerspowers

can you give me the solution code in zip file

konu112233 avatar Apr 25 '20 00:04 konu112233

I can't do that as I've heavily modified the original solution code for my purposes. I should make a pull request and submit the changes. Its a quick change though. Just search for peerConnection.addEventListener in its two locations. Then replace each of them with my above code.

powerspowers avatar Apr 25 '20 00:04 powerspowers

unable to connect with device can you give me app.js file

konu112233 avatar Apr 25 '20 00:04 konu112233

Are you running local or did you deploy this to firebase. I double checked the code lines above and they are correct in my version of app.js.

Just make sure you replaced the track setting and not another peerConnection call. If you want to post your createRoom function and your joinRoombyID I can double check that they are correct.

these are the event listeners you want to replace: peerConnection.addEventListener('track', event => {

powerspowers avatar Apr 25 '20 00:04 powerspowers