How to Detect Which Participant is Speaking in Real-Time in a Teams Meeting Using Azure Communication Services?

Tiến Đạt Dương 0 Reputation points
2024-12-24T13:21:01.9266667+00:00

Hi everyone!
I am developing an application using JavaScript with the libraries @azure/communication-calling and @azure/communication-identity. My goal is to capture real-time voice data each time a participant speaks during a Teams meeting using Azure Communication Services (ACS). Additionally, I need to retrieve and associate the user_id for each participant speaking.

Could guidance be provided on how to:

  1. Capture voice data for each participant whenever they speak in the meeting?
  2. Retrieve and associate the user_id with the captured voice data in real-time?

Any relevant documentation or examples would be greatly appreciated.

Thank you!

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
959 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Shree Hima Bindu Maganti 1,620 Reputation points Microsoft Vendor
    2024-12-24T20:17:54.4766667+00:00

    Hi Tiến Đạt Dương
    Welcome to the Microsoft Q&A Platform!
    To detect which participant is speaking in real-time in a Teams meeting using Azure Communication Services (ACS),
    Install ACS libraries for calling and identity management.
    npm install @azure/communication-calling @azure/communication-identity
    Use a connection string to create a CallClient and authenticate users.

    import { CallClient } from '@azure/communication-calling';
    import { AzureCommunicationTokenCredential } from '@azure/communication-common';
    const callClient = new CallClient();
    const tokenCredential = new AzureCommunicationTokenCredential('<YOUR_ACS_TOKEN>');
    const callAgent = await callClient.createCallAgent(tokenCredential);
    

    Join the meeting using the meeting link.

    const teamsMeetingLink = '<YOUR_TEAMS_MEETING_LINK>';
    const call = await callAgent.join({
        meetingLink: teamsMeetingLink
    });
    

    Access and subscribe to the dominant speaker feature for real-time updates.
    const dominantSpeakerFeature = call.feature(Features.DominantSpeakers);

    dominantSpeakerFeature.on('dominantSpeakersChanged', () => {
        const dominantSpeakers = dominantSpeakerFeature.dominantSpeakers;
        console.log('Current dominant speakers:', dominantSpeakers);
    });
    

    Access each participant’s unique identifier to associate with the dominant speaker.

    call.remoteParticipants.forEach((participant) => {
        console.log('Participant:', participant.identifier.communicationUserId);
    });
    

    Cross-reference the communicationUserId with the dominant speaker ID.
    Using the dominantSpeakersChanged event combined with the participant list allows you to detect who is speaking in real-time in a Teams meeting.For raw audio data, additional SDK support or integration with external media processing pipelines is required.
    ref:https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-with-voice-video-calling-custom-teams-client?tabs=uwp&pivots=platform-web
    https://learn.microsoft.com/en-us/azure/communication-services/concepts/voice-video-calling/calling-sdk-features
    https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/voice-video-calling/get-started-teams-interop?pivots=platform-web
    https://learn.microsoft.com/en-us/azure/communication-services/concepts/call-flows
    If the answer is helpful, please click ACCEPT ANSWER and kindly upvote it so that other people who faces similar issue may get benefitted from it.

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.