OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
426 stars 194 forks source link

501 Unsupported Error when using requestAppAudioHandling #2488

Open Tryptophan opened 3 weeks ago

Tryptophan commented 3 weeks ago

Hi teams dev team,

I am trying to make use of the requestAppAudioHandling method in the meeting namespace, but no matter what I try when running it I get this error:

Error: [requestAppAudioHandling] Callback response - SDK error 501 API is not supported in current context
    at meeting.ts:1199:1
    at xr (communication.ts:700:1)
    at communication.ts:452:1

Here's the code I used to reproduce this in a side panel app:

if (teamsContext?.page.frameContext === teams.FrameContexts.sidePanel) {
      teams.meeting.requestAppAudioHandling(
        {
          isAppHandlingAudio: true,
          micMuteStateChangedCallback: async (micState) => {
            console.log("got mic state", micState);
            return micState;
          },
        },
        () => {}
      );
}

Is there any way I can get this to work? It would be very beneficial to sync mic and device state between teams and my app.

sayali-MSFT commented 3 weeks ago

Thanks for reporting your issue. We will check this at our end and will get back to you.

sayali-MSFT commented 2 weeks ago

@Tryptophan - It looks like you're encountering the SDK error 501 API is not supported in current context error when trying to use the requestAppAudioHandling method in the meeting namespace. This error typically indicates that the API you're trying to use is not supported in the current context of your application.

Ensure that the API is available and supported in the context you're using. Some APIs might only be available in specific contexts or environments. Make sure you're using the latest version of the Microsoft Teams JavaScript SDK. Sometimes, updating to the latest version can resolve issues related to API support.

Also refer this sample-https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/meetings-audio-state/nodejs

AE-MS commented 2 weeks ago

Hi teams dev team,

I am trying to make use of the requestAppAudioHandling method in the meeting namespace, but no matter what I try when running it I get this error:

Error: [requestAppAudioHandling] Callback response - SDK error 501 API is not supported in current context
    at meeting.ts:1199:1
    at xr (communication.ts:700:1)
    at communication.ts:452:1

Here's the code I used to reproduce this in a side panel app:

if (teamsContext?.page.frameContext === teams.FrameContexts.sidePanel) {
      teams.meeting.requestAppAudioHandling(
        {
          isAppHandlingAudio: true,
          micMuteStateChangedCallback: async (micState) => {
            console.log("got mic state", micState);
            return micState;
          },
        },
        () => {}
      );
}

Is there any way I can get this to work? It would be very beneficial to sync mic and device state between teams and my app.

Hi @Tryptophan! Based on the sample code you provided, I assume you are trying to call requestAppAudioHandling from the FrameContexts.sidePanel frame context, is that right?

What host (e.g., Teams, Outlook, etc.) are you trying this code out in and on what platform (web, iOS, etc.)?

Are you able to gather logs from your app when reproducing the problem (https://github.com/OfficeDev/microsoft-teams-library-js/wiki/TeamsJS-Logging)?

Thanks!

Tryptophan commented 2 weeks ago

I am testing this in the teams web client (chrome) with the following versions:

    "@microsoft/teams-js": "^2.22.0",
    "@microsoft/teamsfx": "^2.2.0",
    "@microsoft/teamsfx-react": "^3.0.0",

This code is run in a teams tab app in the meeting side panel during a meeting.

Is this code meant to be unsupported? I will test the teams native app on Mac OS at some point and let you know my findings, please let me know if you're able to reproduce in this environment or in the native app.

AE-MS commented 2 weeks ago

I am testing this in the teams web client (chrome) with the following versions:

    "@microsoft/teams-js": "^2.22.0",
    "@microsoft/teamsfx": "^2.2.0",
    "@microsoft/teamsfx-react": "^3.0.0",

This code is run in a teams tab app in the meeting side panel during a meeting.

Is this code meant to be unsupported? I will test the teams native app on Mac OS at some point and let you know my findings, please let me know if you're able to reproduce in this environment or in the native app.

Thanks for the extra details! Were you able to gather client logs when reproducing the problem?

Tryptophan commented 2 weeks ago

Enabling debug logging did not get me any information outside of the error that is sent (same message). I tried on the native client on Mac OS and got a different error though:

SDK error 1000 App doesn’t have sufficient permission to use this API

Is there a set of permissions required to be added to the manifest for this API? I dont see it documented anywhere.

AE-MS commented 2 weeks ago

Thanks for providing the extra information on the scenario in Mac OS. Are you able to share the client logs? That will help me understand whether the right messages are making it from teamsjs to the host or whether the error is coming from the teamsjs side.