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 #2030

Merged
merged 32 commits into from
Nov 30, 2023

Conversation

bingliang-zh
Copy link
Contributor

@bingliang-zh bingliang-zh commented Nov 7, 2023

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.

Copy link
Contributor

@shrshindeMSFT shrshindeMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM just two minor comments.

packages/teams-js/src/public/meeting.ts Outdated Show resolved Hide resolved
packages/teams-js/test/utils.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@AE-MS AE-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕐

Copy link
Contributor

@AE-MS AE-MS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved pending tests being fixed/passing

@shrshindeMSFT
Copy link
Contributor

Will approve once the tests are passing

@bingliang-zh
Copy link
Contributor Author

@shrshindeMSFT @KangxuanYe The PR for meta-os has been merged. All checks have passed. Mind take a look at this again? Thanks!

Copy link
Contributor

@shrshindeMSFT shrshindeMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@bingliang-zh bingliang-zh merged commit 6f23f92 into main Nov 30, 2023
20 checks passed
@bingliang-zh bingliang-zh deleted the bingliang/audio-device-selection-sync branch November 30, 2023 02:02
AE-MS added a commit that referenced this pull request Nov 30, 2023
@AE-MS AE-MS restored the bingliang/audio-device-selection-sync branch November 30, 2023 22:00
erinha pushed a commit that referenced this pull request Nov 30, 2023
#2069)

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

This reverts commit 6f23f92.

* Change files
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.

6 participants