Skip to content

Commit

Permalink
fix(video): fix error on repeated acceptRequest calls (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur-push authored Jun 8, 2023
1 parent 76691c0 commit 4936d1f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/restapi/src/lib/video/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,12 @@ export class Video {
this.data.local.stream
);

// if peerInstance is not null -> acceptRequest/request was called before
if (this.peerInstance !== null) {
// to prevent connection error we stop the exec of acceptRequest
return;
}

this.peerInstance = new Peer({
initiator: false,
trickle: false,
Expand Down Expand Up @@ -517,8 +523,7 @@ export class Video {
if (this.data.local.stream) {
if (state) {
restartVideoStream(this.data.local.stream);
}
else {
} else {
stopVideoStream(this.data.local.stream);
}
this.setData((oldData) => {
Expand Down Expand Up @@ -552,8 +557,7 @@ export class Video {
if (this.data.local.stream) {
if (state) {
restartAudioStream(this.data.local.stream);
}
else {
} else {
stopAudioStream(this.data.local.stream);
}
this.setData((oldData) => {
Expand Down

0 comments on commit 4936d1f

Please sign in to comment.