Skip to content

Commit

Permalink
Do not count streamIdInUseCounter in case of reconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaboleken committed Jan 6, 2025
1 parent 1f3cd13 commit 89f2e84
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions react/src/pages/AntMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ function AntMedia(props) {
});

//just run once when component is mounted
}, []); //eslint-disable-line
}, []); //eslint-disable-line

useEffect(() => {
if (devices.length > 0) {
Expand Down Expand Up @@ -1786,13 +1786,16 @@ function AntMedia(props) {
} else if (error.indexOf("no_stream_exist") !== -1) {
setIsNoSreamExist(true);
} else if (error.indexOf("streamIdInUse") !== -1) {
streamIdInUseCounter++;
if (streamIdInUseCounter > 3) {
console.log("This stream id is already in use. You may be logged in on another device.");
setLeaveRoomWithError("Streaming is already active with your username. Please check that you're not using it in another browser tab.");
setLeftTheRoom(true);
setIsJoining(false);
setIsReconnectionInProgress(false);
// if the stream id is in use when reconnection, don't display the error
if (!reconnecting) {
streamIdInUseCounter++;
if (streamIdInUseCounter > 3) {
console.log("This stream id is already in use. You may be logged in on another device.");
setLeaveRoomWithError("Streaming is already active with your username. Please check that you're not using it in another browser tab.");
setLeftTheRoom(true);
setIsJoining(false);
setIsReconnectionInProgress(false);
}
}
} else if (error.indexOf("data_channel_error") !== -1) {
errorMessage = "There was a error during data channel communication";
Expand Down Expand Up @@ -3176,7 +3179,8 @@ function AntMedia(props) {
speedTestCounter,
setRoomName,
setPublishStreamId,
settings
settings,
setReconnectingForUnitTests
}}
>
{props.children}
Expand Down

0 comments on commit 89f2e84

Please sign in to comment.