Zemke / react-native-peerjs

PeerJS for React Native
55 stars 36 forks source link

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

Open veeyka opened 1 year ago

veeyka commented 1 year ago

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();

},[])

matallui commented 1 year ago

@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 commented 1 year ago

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.

alihaxan020 commented 1 year ago

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

matallui commented 1 year ago

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

savaliyap commented 5 months ago

@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

matallui commented 5 months ago

@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!

alihaxan020 commented 3 months ago

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