How to detect if an application using Azure Communication Services' SDK is active in multiple tabs of a browser

Based on best practices, your application should not connect to calls from multiple browser tabs simultaneously. Handling multiple calls on multiple tabs of a browser on mobile can cause undefined behavior due to resource allocation for microphone and camera on the device. In order to detect if an application is active in multiple tabs of a browser, a developer can use the method isCallClientActiveInAnotherTab and the event isCallClientActiveInAnotherTabChanged of a CallClient instance.

const callClient = new CallClient();
// Check if an application is active in multiple tabs of a browser
const isCallClientActiveInAnotherTab = callClient.feature(SDK.Features.DebugInfo).isCallClientActiveInAnotherTab;
...
// Subscribe to the event to listen for changes 
callClient.feature(Features.DebugInfo).on('isCallClientActiveInAnotherTabChanged', () => {
    // callback();
});
...
// Unsubscribe from the event to stop listening for changes 
callClient.feature(Features.DebugInfo).off('isCallClientActiveInAnotherTabChanged', () => {
    // callback();
});