@microsoft/teams-js 2.17.1-beta.2 → 2.18.0

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
24
24
 
25
25
  ### Production
26
26
 
27
- You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.17.0/js/MicrosoftTeams.min.js) or point your package manager at them.
27
+ You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.18.0/js/MicrosoftTeams.min.js) or point your package manager at them.
28
28
 
29
29
  ## Usage
30
30
 
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
45
45
  ```html
46
46
  <!-- Microsoft Teams JavaScript API (via CDN) -->
47
47
  <script
48
- src="https://res.cdn.office.net/teams-js/2.17.0/js/MicrosoftTeams.min.js"
49
- integrity="sha384-xp55t/129OsN192JZYLP0rGhzjCF9aYtjY0LVtXvolkDrBe4Jchylp56NrUYJ4S2"
48
+ src="https://res.cdn.office.net/teams-js/2.18.0/js/MicrosoftTeams.min.js"
49
+ integrity="sha384-g8DoRkiR0ECQ9rwKIgY8GjQ5h0d2jp1347CmU/IRlyUHPjJZiFWEOYc+hFtT9MGL"
50
50
  crossorigin="anonymous"
51
51
  ></script>
52
52
 
53
53
  <!-- Microsoft Teams JavaScript API (via npm) -->
54
- <script src="node_modules/@microsoft/teams-js@2.17.0/dist/MicrosoftTeams.min.js"></script>
54
+ <script src="node_modules/@microsoft/teams-js@2.18.0/dist/MicrosoftTeams.min.js"></script>
55
55
 
56
56
  <!-- Microsoft Teams JavaScript API (via local) -->
57
57
  <script src="MicrosoftTeams.min.js"></script>
@@ -3690,6 +3690,7 @@ export interface SdkError {
3690
3690
  */
3691
3691
  message?: string;
3692
3692
  }
3693
+ export function isSdkError(err: unknown): err is SdkError;
3693
3694
  /** Error codes used to identify different types of errors that can occur while developing apps. */
3694
3695
  export enum ErrorCode {
3695
3696
  /**
@@ -6484,6 +6485,51 @@ export namespace meeting {
6484
6485
  * @returns A promise with the updated microphone state
6485
6486
  */
6486
6487
  micMuteStateChangedCallback: (micState: MicState) => Promise<MicState>;
6488
+ /**
6489
+ * Callback for the host to tell the app to change its speaker selection
6490
+ */
6491
+ audioDeviceSelectionChangedCallback?: (selectedDevices: AudioDeviceSelection | SdkError) => void;
6492
+ }
6493
+ /**
6494
+ * Interface for AudioDeviceSelection from host selection.
6495
+ * If the speaker or the microphone is undefined or don't have a device label, you can try to find the default devices
6496
+ * by using
6497
+ * ```ts
6498
+ * const devices = await navigator.mediaDevices.enumerateDevices();
6499
+ * const defaultSpeaker = devices.find((d) => d.deviceId === 'default' && d.kind === 'audiooutput');
6500
+ * const defaultMic = devices.find((d) => d.deviceId === 'default' && d.kind === 'audioinput');
6501
+ * ```
6502
+ *
6503
+ * @hidden
6504
+ * Hide from docs.
6505
+ *
6506
+ * @internal
6507
+ * Limited to Microsoft-internal use
6508
+ *
6509
+ * @beta
6510
+ */
6511
+ interface AudioDeviceSelection {
6512
+ speaker?: AudioDeviceInfo;
6513
+ microphone?: AudioDeviceInfo;
6514
+ }
6515
+ /**
6516
+ * Interface for AudioDeviceInfo, includes a device label with the same format as {@link MediaDeviceInfo.label}
6517
+ *
6518
+ * Hosted app can use this label to compare it with the device info fetched from {@link navigator.mediaDevices.enumerateDevices()}.
6519
+ * {@link MediaDeviceInfo} has {@link MediaDeviceInfo.deviceId} as an unique identifier, but that id is also unique to the origin
6520
+ * of the calling application, so {@link MediaDeviceInfo.deviceId} cannot be used here as an identifier. Notice there are some cases
6521
+ * that devices may have the same device label, but we don't have a better way to solve this, keep this as a known limitation for now.
6522
+ *
6523
+ * @hidden
6524
+ * Hide from docs.
6525
+ *
6526
+ * @internal
6527
+ * Limited to Microsoft-internal use
6528
+ *
6529
+ * @beta
6530
+ */
6531
+ interface AudioDeviceInfo {
6532
+ deviceLabel: string;
6487
6533
  }
6488
6534
  /**
6489
6535
  * Different types of meeting reactions that can be sent/received
@@ -1371,6 +1371,9 @@ var SecondaryM365ContentIdName;
1371
1371
  /** User ID */
1372
1372
  SecondaryM365ContentIdName["UserId"] = "userId";
1373
1373
  })(SecondaryM365ContentIdName || (SecondaryM365ContentIdName = {}));
1374
+ function isSdkError(err) {
1375
+ return (err === null || err === void 0 ? void 0 : err.errorCode) !== undefined;
1376
+ }
1374
1377
  /** Error codes used to identify different types of errors that can occur while developing apps. */
1375
1378
  var ErrorCode;
1376
1379
  (function (ErrorCode) {
@@ -2428,7 +2431,7 @@ var _minRuntimeConfigToUninitialize = {
2428
2431
  * @hidden
2429
2432
  * Package version.
2430
2433
  */
2431
- var version = "2.17.1-beta.2";
2434
+ var version = "2.18.0";
2432
2435
 
2433
2436
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2434
2437
 
@@ -8362,6 +8365,11 @@ var meeting;
8362
8365
  });
8363
8366
  }); };
8364
8367
  registerHandler('meeting.micStateChanged', micStateChangedCallback);
8368
+ var audioDeviceSelectionChangedCallback = function (selectedDevicesInHost) {
8369
+ var _a;
8370
+ (_a = requestAppAudioHandlingParams.audioDeviceSelectionChangedCallback) === null || _a === void 0 ? void 0 : _a.call(requestAppAudioHandlingParams, selectedDevicesInHost);
8371
+ };
8372
+ registerHandler('meeting.audioDeviceSelectionChanged', audioDeviceSelectionChangedCallback);
8365
8373
  callback(isHostAudioless);
8366
8374
  };
8367
8375
  sendMessageToParent('meeting.requestAppAudioHandling', [requestAppAudioHandlingParams.isAppHandlingAudio], callbackInternalRequest);
@@ -8380,6 +8388,9 @@ var meeting;
8380
8388
  if (doesHandlerExist('meeting.micStateChanged')) {
8381
8389
  removeHandler('meeting.micStateChanged');
8382
8390
  }
8391
+ if (doesHandlerExist('meeting.audioDeviceSelectionChanged')) {
8392
+ removeHandler('meeting.audioDeviceSelectionChanged');
8393
+ }
8383
8394
  callback(isHostAudioless);
8384
8395
  };
8385
8396
  sendMessageToParent('meeting.requestAppAudioHandling', [requestAppAudioHandlingParams.isAppHandlingAudio], callbackInternalStop);