Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

unable to connect different device #16

Open
konu112233 opened this issue Apr 18, 2020 · 8 comments
Open

unable to connect different device #16

konu112233 opened this issue Apr 18, 2020 · 8 comments

Comments

@konu112233
Copy link

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/

@rahulchhabra07
Copy link

Can you share the App.js code?

@konu112233
Copy link
Author

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

@powerspowers
Copy link

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
Copy link

powerspowers commented Apr 23, 2020

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');
});

@konu112233
Copy link
Author

can you give me the solution code in zip file

@powerspowers
Copy link

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.

@konu112233
Copy link
Author

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

@powerspowers
Copy link

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 => {

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants