react-native-peerjs icon indicating copy to clipboard operation
react-native-peerjs copied to clipboard

is this lib still alive ? on stream not fireing at all . no event after calling

Open veeyka opened this issue 2 years ago • 7 comments

is this lib still working correct ? im using it . every thing is ok . just call.on("stream is not fireing at all . my code is simple like docs every where .

React.useEffect(()=>{ socket.clientSocket.on("connect", ()=>{ console.log("----- - - --- - - socket connection") });

const start = async () => {
    let s;
    try {
      s = await mediaDevices.getUserMedia({ video: true});

      peer.peerServer.on("open" , (peerId)=>{
        socket.clientSocket.emit("join-room" , {peerId , userId: pageStates.userId , roomId: pageStates.roomId});
      });

      // user entered
      socket.clientSocket.on("a-user-entered" , ({newUserPeerId , newUserId})=>{
            const call = peer.peerServer.call(newUserPeerId, s);
             call.on("stream" , (remoteVideoStream)=>{
                  if(remoteVideoStream){
                         console.log("stream" , remoteVideoStream)
                  }
            });
      });

      peer.peerServer.on("call" , (call)=>{
    
        call.answer(s);
        call.on("stream" , (remoteS)=>{
          console.log("and we got " + remoteS)
        });
      });
     
    } 
};
start();

},[])

veeyka avatar Feb 04 '23 19:02 veeyka

@veeyka did you manage to get it working? I've built a couple of demos last year where this still worked, but now I'm having no luck anymore. I think this package is just not compatible with later versions of react-native-webrtc anymore.

I'd love to fork this and maintain a package for RN that works with the latest versions or peerjs and react-native-webrtc, but would probably need some help. I've tried a couple of times in the past but without success. If anyone wants to team up, I'm all down for it.

matallui avatar Apr 29 '23 00:04 matallui

What I ended up doing was to copy peerjs's .ts source files into my RN app (which contains react-native-webrtc) and then made some small adjustments to the code to get it working and that worked for me.

I just needed a quick win cause I have a demo in a few days, but once I find the time I'd love to figure out a better way of maintaining a React Native PeerJS package.

matallui avatar Apr 29 '23 17:04 matallui

@matallui Do you have open source repo where you imlemented peerjs with react-native webtrc? I am interested to implement in my learning project.

alihaxan020 avatar May 03 '23 05:05 alihaxan020

@alihaxan020 I don't right now, but once I find some time I'll try to put something together to share.

matallui avatar May 03 '23 12:05 matallui

@alihaxan020 I don't right now, but once I find some time I'll try to put something together to share.

Hey mate, I'm also learning and if you made any advancement than please let me know

savaliyap avatar Apr 09 '24 04:04 savaliyap

@savaliyap @alihaxan020 Check out my new project Artico. It works both in web and React Native and has working examples for both apps in Github. It provides the same functionality as PeerJS and more. If you find any bugs or that anything is missing, feel free to open an Issue and I'll work on it. Cheers!

matallui avatar Apr 09 '24 14:04 matallui

@matallui Thank you so much for your effort. It is working . Waiting for expo react native documentation for absolute beginner

alihaxan020 avatar Jun 04 '24 10:06 alihaxan020