Improve focus switch logging (#2153)
Signed-off-by: Timo K <toger5@hotmail.de> Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
@@ -30,13 +30,6 @@ function getActiveFocus(
|
|||||||
const oldestMembership = rtcSession.getOldestMembership();
|
const oldestMembership = rtcSession.getOldestMembership();
|
||||||
const focus = oldestMembership?.getActiveFoci()[0] as LivekitFocus;
|
const focus = oldestMembership?.getActiveFoci()[0] as LivekitFocus;
|
||||||
|
|
||||||
if (focus) {
|
|
||||||
logger.info(
|
|
||||||
`Got active focus for call from ${oldestMembership?.sender}/${oldestMembership?.deviceId}`,
|
|
||||||
focus,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return focus;
|
return focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,6 +49,11 @@ export function useActiveFocus(
|
|||||||
const newActiveFocus = getActiveFocus(rtcSession);
|
const newActiveFocus = getActiveFocus(rtcSession);
|
||||||
|
|
||||||
if (!deepCompare(activeFocus, newActiveFocus)) {
|
if (!deepCompare(activeFocus, newActiveFocus)) {
|
||||||
|
const oldestMembership = rtcSession.getOldestMembership();
|
||||||
|
logger.warn(
|
||||||
|
`Got new active focus from membership: ${oldestMembership?.sender}/${oldestMembership?.deviceId}.
|
||||||
|
Updating focus (focus switch) from ${activeFocus} to ${newActiveFocus}`,
|
||||||
|
);
|
||||||
setActiveFocus(newActiveFocus);
|
setActiveFocus(newActiveFocus);
|
||||||
}
|
}
|
||||||
}, [activeFocus, rtcSession]);
|
}, [activeFocus, rtcSession]);
|
||||||
|
|||||||
Reference in New Issue
Block a user