feross/simple-peer

Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11

mgmburia opened this issue · 0 comments

What version of this package are you using?
Version 9.11.1

What operating system, Node.js, and npm version?
Using Linux (Ubuntu), pnpm package manager

What happened?
I am using the Chrome browser and on clicking 'Call' button on my web app, I get the error logged on the Chrome browser console.

Screenshot from 2023-12-29 21-05-53

<button
    className="bg-[#ffffff] text-[#000000] p-2 m-2 rounded-md"
// Options.jsx:47 (Line below)
    onClick={() => callUser(idToCall)}
>
    Call
</button>
    const callUser = (id) => {
        if (!stream) {
            console.log("Stream is undefined");
            return;
        }
// SocketContext.jsx:67 (Line below)
        const peer = new Peer({ initiator: true, trickle: false, stream });

        peer.on("signal", (data) => {
            socket.emit("callUser", {
                userToCall: id,
                signalData: data,
                from: me,
                name,
            });
        });

        peer.on("stream", (currentStream) => {
            if (userVideo.current) {
                userVideo.current.srcObject = currentStream;
            }
        });

        socket.on("callAccepted", (signal) => {
            setCallAccepted(true);

            peer.signal(signal);
        });

        connectionRef.current = peer;
    };