Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend RequestAppAudioHandling to support for audio device selection sync #2070

Merged
merged 5 commits into from
Nov 30, 2023

Conversation

AE-MS
Copy link
Contributor

@AE-MS AE-MS commented Nov 30, 2023

This change was originally committed with PR #2030. It had to be reverted with PR #2069. This PR fixes the problem (adds version constraint to two new tests added in meeting.json). Other than that change, everything in this PR is identical to #2030. You can verify this by running git diff 6f23f92877165e7909c202d039aa0db6fa481248 origin/bingliang/audio-device-selection-sync which will compare the commit of the original PR with this branch

Description

This is a continuous PR of the original PR by shilcare. There is another outdated PR from a fork here, change to this branch PR because of security issues.

Purpose

Give Teams apps the ability to use Teams' audio devices settings, like play audio on the device that user selected in Teams.

Details

Add a callback method to RequestAppAudioHandling.

  • When App first call RequestAppAudioHandling with this callback, the callback will be called immediately with Teams' current audio device labels. The app can use this info to initialize and select the corresponding audio devices.
  • This callback will also be called when user changes audio devices in Teams, app can update its audio devices accordingly.

Main changes in the PR:

  1. add optional audioDeviceSelectionChangedCallback to RequestAppAudioHandlingParams which is used in meeting.requestAppAudioHandling
  2. register event handler in startAppAudioHandling
  3. unregister event handler in stopAppAudioHandling

Validation

Validation performed:

To make this work properly, we also need code changes in some internal repos. We have built a Teams container with those changes.

  1. Use Teams 2.1 with the custom container
  2. Create a test Teams app, add some test code like
  meeting.requestAppAudioHandling(
    {
      //...
      audioDeviceSelectionChangedCallback: (selectedDevices) => {
        console.log('audioDeviceSelectionChangedCallback');
        console.log(selectedDevices);
        return Promise.resolve();
      },
    },
   //...
  );
  1. Replace an existing meeting app, redirect to the local test app
  2. Open the modified meeting app.
  3. The callback will be called after meeting.requestAppAudioHandling is called. And also get called after device is changed in Teams settings. The payload is correct too.

Unit Tests added:

Yes

End-to-end tests added:

requestAppAudioHandling API Call - register audioDeviceSelectionChanged Handler

Additional Requirements

Change file added:

No. pnpm changefile says No change files are needed.

Related PRs:

Next/remaining steps:

Close original PR because duplicated and outdated.
Close fork PR because duplicated and outdated.

@AE-MS AE-MS requested a review from a team as a code owner November 30, 2023 22:27
@AE-MS AE-MS enabled auto-merge (squash) November 30, 2023 22:45
@jadahiya-MSFT jadahiya-MSFT mentioned this pull request Nov 30, 2023
@AE-MS AE-MS merged commit 62b397c into main Nov 30, 2023
20 checks passed
@AE-MS AE-MS deleted the bingliang/audio-device-selection-sync branch November 30, 2023 23:20
jadahiya-MSFT added a commit that referenced this pull request Dec 1, 2023
* Releasing2.18.0

* Update packages/teams-js/CHANGELOG.md

Co-authored-by: Trevor Harris <trharris@microsoft.com>

* Update packages/teams-js/CHANGELOG.md

Co-authored-by: Trevor Harris <trharris@microsoft.com>

* Removed revert from changelog, since this was re-added

* Revert "Extend RequestAppAudioHandling to support for audio device se… (#2069)

* Revert "Extend RequestAppAudioHandling to support for audio device selection sync (#2030)"

This reverts commit 6f23f92.

* Change files

* Change files

* Extend RequestAppAudioHandling to support for audio device selection sync (#2070)

* extend RequestAppAudioHandlingParams by adding audioDeviceSelectionChangedCallback

* Remove old changefile

* Change files

* Updated changefile

* Update contact info in changefile

---------

Co-authored-by: Xukai Wu <xuwu@microsoft.com>

* Updated hash values and changelog due to changes merged in from main

---------

Co-authored-by: jadahiya-MSFT <jadahiya-MSFT@users.noreply.github.com>
Co-authored-by: Trevor Harris <trharris@microsoft.com>
Co-authored-by: AE ( ͡ಠ ʖ̯ ͡ಠ) <36546967+AE-MS@users.noreply.github.com>
Co-authored-by: Xukai Wu <xuwu@microsoft.com>
jadahiya-MSFT added a commit that referenced this pull request Dec 6, 2023
* Releasing 2.18.0 (#2068)

* Releasing2.18.0

* Update packages/teams-js/CHANGELOG.md

Co-authored-by: Trevor Harris <trharris@microsoft.com>

* Update packages/teams-js/CHANGELOG.md

Co-authored-by: Trevor Harris <trharris@microsoft.com>

* Removed revert from changelog, since this was re-added

* Revert "Extend RequestAppAudioHandling to support for audio device se… (#2069)

* Revert "Extend RequestAppAudioHandling to support for audio device selection sync (#2030)"

This reverts commit 6f23f92.

* Change files

* Change files

* Extend RequestAppAudioHandling to support for audio device selection sync (#2070)

* extend RequestAppAudioHandlingParams by adding audioDeviceSelectionChangedCallback

* Remove old changefile

* Change files

* Updated changefile

* Update contact info in changefile

---------

Co-authored-by: Xukai Wu <xuwu@microsoft.com>

* Updated hash values and changelog due to changes merged in from main

---------

Co-authored-by: jadahiya-MSFT <jadahiya-MSFT@users.noreply.github.com>
Co-authored-by: Trevor Harris <trharris@microsoft.com>
Co-authored-by: AE ( ͡ಠ ʖ̯ ͡ಠ) <36546967+AE-MS@users.noreply.github.com>
Co-authored-by: Xukai Wu <xuwu@microsoft.com>

* Change files

---------

Co-authored-by: jadahiya-MSFT <jadahiya-MSFT@users.noreply.github.com>
Co-authored-by: Trevor Harris <trharris@microsoft.com>
Co-authored-by: AE ( ͡ಠ ʖ̯ ͡ಠ) <36546967+AE-MS@users.noreply.github.com>
Co-authored-by: Xukai Wu <xuwu@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants