Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'close' for incoming call never fires #1084

Closed
neilyoung opened this issue May 2, 2023 · 4 comments
Closed

'close' for incoming call never fires #1084

neilyoung opened this issue May 2, 2023 · 4 comments

Comments

@neilyoung
Copy link

neilyoung commented May 2, 2023

Hi,

nice project, indeed.

However, I'm having an issue, already raised here and never answered.

#390

I cannot disconnect a video call to the remote end. My remote end does answer the call w/o sending video (maybe that's why?)

My producer code:

if (this.peerOpen) {
            navigator.getUserMedia({ video: true, audio: false }, (stream) => {
                const event = { type: WebRTC.MEDIATYPE.video, producerId: this.peer.name, stream: stream }
                this.addLocalVideoToDOM(event)

                
                this.videoCall = this.peer.call(this.getPartner(), stream)
                this.videoCall.on('close', () => {
                    const event = { publisherId: this.peer.name, appData: { name: this.peer.name } }
                    this.removeLocalVideoFromDOM(event)
                })
                

            }, (error) => {
                this.toast(`red`, `P2P failed to get local video, error ${error}`)
            })
        }

This one works.

My consumer at the remote end end is waiting for a call:

this.peer.on('call', (call) => {
                call.answer()
                call.on('stream', (remoteStream) => {
                    const event = { consumerId: call.peer, stream: remoteStream, appData: { name: call.peer, stream: "1" } }
                    this.addRemoteVideoToDOM(event)
                })
                call.on('close', () => {
                    debugger
                    const event = { consumerId: call.peer, stream: remoteStream, appData: { name: call.peer, stream: "1" } }
                    this.removeRemoteVideoFromDOM(event)
                })
                call.on('error', (error) => {
                    console.error("call on error", error)
                })

When I release a connection on the producer side I'm doing this:

  if (this.peerOpen) {
            if (this.videoCall) {
                this.videoCall.close()
            }
        }

My producer console log shows:

peerjs.min.js:48 PeerJS:  Cleaning up PeerConnection to young

(I have two parties: neil and young :))

But on the remote end the video just freezes and after some seconds this is traced:

PeerJS:  iceConnectionState changed to disconnected on the connection with neil

No 'close', no 'error'...

@neilyoung
Copy link
Author

In addition: There is no activity towards the signaling server in case of videoCall.close(). I would have expected to see a new OFFER, which removes the video stream to remote and an ANSWER, which confirms the removal.

Datachannel disconnection works.

@neilyoung
Copy link
Author

Oh. Sh…ce. This seems to be an old bug with no solution

#636

Not a good sign

@neilyoung
Copy link
Author

neilyoung commented May 2, 2023

1.4.8-rc.1 https://github.com/peers/peerjs/releases/tag/v1.4.8-rc.1 "fixes" this problem by adopting the idea of using an auxilliary data channel for communicating the stop. Not the best solution IMHO.

@neilyoung
Copy link
Author

Disregard

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

No branches or pull requests

1 participant