Skip to content

Commit

Permalink
Fix unpublish in p2p (#1236)
Browse files Browse the repository at this point in the history
  • Loading branch information
kekkokk authored and jcague committed Jun 7, 2018
1 parent 601195c commit 3083b5f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion erizo_controller/erizoClient/src/Stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const Stream = (altConnectionHelpers, specInput) => {
that.desktopStreamId = spec.desktopStreamId;
that.audioMuted = false;
that.videoMuted = false;
that.p2p = false;
that.ConnectionHelpers =
altConnectionHelpers === undefined ? ConnectionHelpers : altConnectionHelpers;

Expand Down Expand Up @@ -111,6 +112,7 @@ const Stream = (altConnectionHelpers, specInput) => {

that.addPC = (pc, p2pKey = undefined) => {
if (p2pKey) {
that.p2p = true;
if (that.pc === undefined) {
that.pc = ErizoMap();
}
Expand Down Expand Up @@ -229,10 +231,16 @@ const Stream = (altConnectionHelpers, specInput) => {
}
that.stream = undefined;
}
if (that.pc) {
if (that.pc && !that.p2p) {
that.pc.off('add-stream', spec.onStreamAddedToPC);
that.pc.off('remove-stream', spec.onStreamRemovedFroPC);
that.pc.off('ice-state-change', spec.onICEConnectionStateChange);
} else if (that.pc && that.p2p) {
that.pc.forEach((pc) => {
pc.off('add-stream', spec.onStreamAddedToPC);
pc.off('remove-stream', spec.onStreamRemovedFroPC);
pc.off('ice-state-change', spec.onICEConnectionStateChange);
});
}
};

Expand Down

0 comments on commit 3083b5f

Please sign in to comment.