Closed hnq90 closed 5 years ago
You could have look at the event conn.on(‘close’,function(){});
On 24 Jun 2014, at 13:18, Huy Nguyen Quang notifications@github.com wrote:
Hello, I'm implementing 2-way sharing video connection, but I don't know how to know when MediaStream stopped.
Currently, I can't not use mediaConnection.close() because it will close the stream to other peers. So I just use stream.stop() to end the stream. But peerjs don't have any api like peer.call.on("close").
Thanks in advance.
— Reply to this email directly or view it on GitHub.
Conn.on('close') is used with DataConnection, isn't it? On Jun 24, 2014 9:45 PM, "NGUYEN VAN LUONG" notifications@github.com wrote:
You could have look at the event conn.on(‘close’,function(){});
On 24 Jun 2014, at 13:18, Huy Nguyen Quang notifications@github.com wrote:
Hello, I'm implementing 2-way sharing video connection, but I don't know how to know when MediaStream stopped.
Currently, I can't not use mediaConnection.close() because it will close the stream to other peers. So I just use stream.stop() to end the stream. But peerjs don't have any api like peer.call.on("close").
Thanks in advance.
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub https://github.com/peers/peerjs/issues/212#issuecomment-46980221.
MediaConnection also, here for you: http://peerjs.com/docs/#mediaconnection-on-close On 24 Jun 2014, at 17:25, Huy Nguyen Quang notifications@github.com wrote:
Conn.on('close') is used with DataConnection, isn't it? On Jun 24, 2014 9:45 PM, "NGUYEN VAN LUONG" notifications@github.com wrote:
You could have look at the event conn.on(‘close’,function(){});
On 24 Jun 2014, at 13:18, Huy Nguyen Quang notifications@github.com wrote:
Hello, I'm implementing 2-way sharing video connection, but I don't know how to know when MediaStream stopped.
Currently, I can't not use mediaConnection.close() because it will close the stream to other peers. So I just use stream.stop() to end the stream. But peerjs don't have any api like peer.call.on("close").
Thanks in advance.
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub https://github.com/peers/peerjs/issues/212#issuecomment-46980221.
— Reply to this email directly or view it on GitHub.
As I said on the first post, I can't close the mediaConnection because my system is two ways sharing. And when close the mediaconnection, both sides will be terminated. So I need to use API MediaStream.stop() to stop the stream and catch the event when remoteStream is closed. On Jun 24, 2014 11:13 PM, "NGUYEN VAN LUONG" notifications@github.com wrote:
MediaConnection also, here for you: http://peerjs.com/docs/#mediaconnection-on-close On 24 Jun 2014, at 17:25, Huy Nguyen Quang notifications@github.com wrote:
Conn.on('close') is used with DataConnection, isn't it? On Jun 24, 2014 9:45 PM, "NGUYEN VAN LUONG" notifications@github.com wrote:
You could have look at the event conn.on(‘close’,function(){});
On 24 Jun 2014, at 13:18, Huy Nguyen Quang notifications@github.com wrote:
Hello, I'm implementing 2-way sharing video connection, but I don't know how to know when MediaStream stopped.
Currently, I can't not use mediaConnection.close() because it will close the stream to other peers. So I just use stream.stop() to end the stream. But peerjs don't have any api like peer.call.on("close").
Thanks in advance.
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub https://github.com/peers/peerjs/issues/212#issuecomment-46980221.
— Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHub https://github.com/peers/peerjs/issues/212#issuecomment-46992788.
Hello, Could anyone help me?
Consider using 2 media streams, one for each direction. Then when answering, answer with a null stream.
Hope it helps ;)
Thank you for response. Because currently, if the system has 3 users, each user will have 2 opened connections for receive or send stream from/to others. Example: User A will have two connection, one for receive/send to User B, one for receive/send to User C. User B and C are same.
As you said, now each user has four connections to peer server. I think it's acceptable but could you have any effective idea for me?
In fact, I think in your case - 3 peers connect together, it doesn't mean that each peer has 4 connections to peer server. I think that each peer has 2 connections with other peer (one for sending, one for receiving - you can check peer.connections ). Could you explain more detail about your system if it is possible? I still do not understand why you need to stop sharing media stream.
I don't think the overhead to separate the media streams from bidirectional to unidirectional will be large, since the bandwidth sent/received should be the same in total. But ive not tested if that is absolutely true.
@luongnv89 Yeah, I'm making a system where people share their screen and their webcam in a private room. But only person who is chosen by the sender can receive the webcam/screen stream. Each person can both receive and sent at once.
Example: A room have User A, User B, User C. User A can receive webcam from User B and User C and sent webcam stream to User B at once. At that time, User B is sending stream to User A and sending stream to User C. And User C is receive stream from user B and sending stream to User A.
In shortly: User A: receive 2 stream and send 1 stream at once. User B: send 2 stream at once. User C: receive 1 stream and send 1 stream at one.
On User A's side, I can't use peer.call.close() to stop sending the stream because it will close the stream which is receiving too. So I use mediastream.stop() to stop the current strea. It worked and other stream of user is still live. But I can't handle that event to let the receiver know stream are stopped (to close the video popup automatically).
@khankuan Thank you. I will try it.
conn.on(‘close’,function(){}); is working as said by luongnv89 but to create that event ourselves? i've used cut.addEventListener('click',peer.close(stream)); but close is taking as keyword by cordova.js
http://cdn.peerjs.com/demo/chat.html
Why does this seem to have firefox detecting and firing leaving the 'close' event, yet i cant get it to work, nor anyone here ?
They using the same peer.js, and doing it the same way ?
Hello, I'm implementing 2-way sharing video connection, but I don't know how to know when MediaStream stopped.
Currently, I can't not use mediaConnection.close() because it will close the stream to other peers. So I just use stream.stop() to end the stream. But peerjs don't have any api like peer.call.on("close").
Thanks in advance.