@microsoft/teams-js 2.11.0 → 2.12.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2075,7 +2075,7 @@ export namespace videoEx {
2075
2075
  * @internal
2076
2076
  * Limited to Microsoft-internal use
2077
2077
  */
2078
- interface VideoFrame extends video.VideoFrame {
2078
+ interface VideoBufferData extends video.VideoBufferData {
2079
2079
  /**
2080
2080
  * @hidden
2081
2081
  * The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel}
@@ -2094,7 +2094,24 @@ export namespace videoEx {
2094
2094
  * @internal
2095
2095
  * Limited to Microsoft-internal use
2096
2096
  */
2097
- type VideoFrameCallback = (frame: VideoFrame, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
2097
+ type VideoBufferHandler = (videoBufferData: VideoBufferData, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
2098
+ /**
2099
+ * @hidden
2100
+ * @beta
2101
+ * Callbacks and configuration supplied to the host to process the video frames.
2102
+ * @internal
2103
+ * Limited to Microsoft-internal use
2104
+ */
2105
+ type RegisterForVideoFrameParameters = {
2106
+ /**
2107
+ * Callback function to process the video frames shared by the host.
2108
+ */
2109
+ videoBufferHandler: VideoBufferHandler;
2110
+ /**
2111
+ * Video frame configuration supplied to the host to customize the generated video frame parameters, like format
2112
+ */
2113
+ config: VideoFrameConfig;
2114
+ };
2098
2115
  /**
2099
2116
  * @hidden
2100
2117
  * Register to process video frames
@@ -2106,7 +2123,7 @@ export namespace videoEx {
2106
2123
  * @internal
2107
2124
  * Limited to Microsoft-internal use
2108
2125
  */
2109
- function registerForVideoFrame(frameCallback: VideoFrameCallback, config: VideoFrameConfig): void;
2126
+ function registerForVideoFrame(parameters: RegisterForVideoFrameParameters): void;
2110
2127
  /**
2111
2128
  * @hidden
2112
2129
  * Video extension should call this to notify host that the current selected effect parameter changed.
@@ -2121,15 +2138,6 @@ export namespace videoEx {
2121
2138
  * Limited to Microsoft-internal use
2122
2139
  */
2123
2140
  function notifySelectedVideoEffectChanged(effectChangeType: video.EffectChangeType, effectId: string | undefined, effectParam?: string): void;
2124
- /**
2125
- * @hidden
2126
- * Video effect change call back function definition
2127
- * @beta
2128
- *
2129
- * @internal
2130
- * Limited to Microsoft-internal use
2131
- */
2132
- type VideoEffectCallBack = (effectId: string | undefined, effectParam?: string) => void;
2133
2141
  /**
2134
2142
  * @hidden
2135
2143
  * Register the video effect callback, host uses this to notify the video extension the new video effect will by applied
@@ -2760,6 +2768,12 @@ export const errorNotSupportedOnPlatform: SdkError;
2760
2768
  * Minimum Adaptive Card version supported by the host.
2761
2769
  */
2762
2770
  export const minAdaptiveCardVersion: AdaptiveCardVersion;
2771
+ /**
2772
+ * @hidden
2773
+ *
2774
+ * Adaptive Card version supported by the Teams v1 client.
2775
+ */
2776
+ export const teamsMinAdaptiveCardVersion: HostVersionsInfo;
2763
2777
 
2764
2778
  /**
2765
2779
  * Represents information about tabs for an app
@@ -4629,38 +4643,6 @@ export namespace dialog {
4629
4643
  */
4630
4644
  function isSupported(): boolean;
4631
4645
  }
4632
- /**
4633
- * @hidden
4634
- * Hide from docs
4635
- * --------
4636
- * Convert AdaptiveCardDialogInfo to DialogInfo to send the information to host in {@linkcode adaptiveCard.open} API.
4637
- *
4638
- * @internal
4639
- */
4640
- function getDialogInfoFromAdaptiveCardDialogInfo(adaptiveCardDialogInfo: AdaptiveCardDialogInfo): DialogInfo;
4641
- /**
4642
- * @hidden
4643
- * Hide from docs
4644
- * --------
4645
- * Convert BotAdaptiveCardDialogInfo to DialogInfo to send the information to host in {@linkcode adaptiveCard.open} API.
4646
- *
4647
- * @internal
4648
- */
4649
- function getDialogInfoFromBotAdaptiveCardDialogInfo(botAdaptiveCardDialogInfo: BotAdaptiveCardDialogInfo): DialogInfo;
4650
- /**
4651
- * @hidden
4652
- * Converts {@link TaskInfo} to {@link AdaptiveCardDialogInfo}
4653
- * @param taskInfo - TaskInfo object to convert
4654
- * @returns - converted AdaptiveCardDialogInfo
4655
- */
4656
- function getAdaptiveCardDialogInfoFromTaskInfo(taskInfo: TaskInfo): AdaptiveCardDialogInfo;
4657
- /**
4658
- * @hidden
4659
- * Converts {@link TaskInfo} to {@link BotAdaptiveCardDialogInfo}
4660
- * @param taskInfo - TaskInfo object to convert
4661
- * @returns - converted BotAdaptiveCardDialogInfo
4662
- */
4663
- function getBotAdaptiveCardDialogInfoFromTaskInfo(taskInfo: TaskInfo): BotAdaptiveCardDialogInfo;
4664
4646
  }
4665
4647
  }
4666
4648
 
@@ -5884,6 +5866,35 @@ export namespace media {
5884
5866
  export {};
5885
5867
  }
5886
5868
 
5869
+ /**
5870
+ * Namespace to power up the in-app browser experiences in the Host App.
5871
+ * For e.g., opening a URL in the Host App inside a browser
5872
+ *
5873
+ * @beta
5874
+ */
5875
+ export namespace secondaryBrowser {
5876
+ /**
5877
+ * Open a URL in the secondary browser aka in-app browser
5878
+ *
5879
+ * @param url Url to open in the browser
5880
+ * @returns Promise that successfully resolves if the URL opens in the secondaryBrowser
5881
+ * or throws an error {@link SdkError} incase of failure before starting navigation
5882
+ *
5883
+ * @remarks Any error that happens after navigation begins is handled by the platform browser component and not returned from this function.
5884
+ * @beta
5885
+ */
5886
+ function open(url: URL): Promise<void>;
5887
+ /**
5888
+ * Checks if secondaryBrowser capability is supported by the host
5889
+ * @returns boolean to represent whether secondaryBrowser is supported
5890
+ *
5891
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
5892
+ *
5893
+ * @beta
5894
+ */
5895
+ function isSupported(): boolean;
5896
+ }
5897
+
5887
5898
  /**
5888
5899
  * @deprecated
5889
5900
  * As of 2.1.0, please use geoLocation namespace.
@@ -7014,7 +7025,7 @@ export namespace video {
7014
7025
  * Represents a video frame
7015
7026
  * @beta
7016
7027
  */
7017
- export interface VideoFrame {
7028
+ export interface VideoBufferData {
7018
7029
  /**
7019
7030
  * Video frame width
7020
7031
  */
@@ -7026,7 +7037,7 @@ export namespace video {
7026
7037
  /**
7027
7038
  * Video frame buffer
7028
7039
  */
7029
- data: Uint8ClampedArray;
7040
+ videoFrameBuffer: Uint8ClampedArray;
7030
7041
  /**
7031
7042
  * NV12 luma stride, valid only when video frame format is NV12
7032
7043
  */
@@ -7050,7 +7061,7 @@ export namespace video {
7050
7061
  */
7051
7062
  export enum VideoFrameFormat {
7052
7063
  /** Video format used for encoding and decoding YUV color data in video streaming and storage applications. */
7053
- NV12 = 0
7064
+ NV12 = "NV12"
7054
7065
  }
7055
7066
  /**
7056
7067
  * Video frame configuration supplied to the host to customize the generated video frame parameters, like format
@@ -7070,17 +7081,12 @@ export namespace video {
7070
7081
  /**
7071
7082
  * Current video effect changed
7072
7083
  */
7073
- EffectChanged = 0,
7084
+ EffectChanged = "EffectChanged",
7074
7085
  /**
7075
7086
  * Disable the video effect
7076
7087
  */
7077
- EffectDisabled = 1
7088
+ EffectDisabled = "EffectDisabled"
7078
7089
  }
7079
- /**
7080
- * Video frame call back function definition
7081
- * @beta
7082
- */
7083
- export type VideoFrameCallback = (frame: VideoFrame, notifyVideoFrameProcessed: notifyVideoFrameProcessedFunctionType, notifyError: notifyErrorFunctionType) => void;
7084
7090
  /**
7085
7091
  * Predefined failure reasons for preparing the selected video effect
7086
7092
  * @beta
@@ -7103,12 +7109,97 @@ export namespace video {
7103
7109
  */
7104
7110
  export type VideoEffectCallback = (effectId: string | undefined) => Promise<void>;
7105
7111
  /**
7106
- * Register to read the video frames in Permissions section
7107
7112
  * @beta
7108
- * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
7109
- * @param config - VideoFrameConfig to customize generated video frame parameters
7113
+ * Video frame call back function definition
7114
+ * The callback will be called on every frame when running on the supported host.
7115
+ * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely.
7116
+ * The video app should call `notifyVideoFrameProcessed` to notify a successfully processed video frame.
7117
+ * The video app should call `notifyError` to notify a failure. When the failures accumulate to a certain number, the host will see the app is "frozen" and ask the user to close it or not.
7110
7118
  */
7111
- export function registerForVideoFrame(frameCallback: VideoFrameCallback, config: VideoFrameConfig): void;
7119
+ export type VideoBufferHandler = (videoBufferData: VideoBufferData, notifyVideoFrameProcessed: notifyVideoFrameProcessedFunctionType, notifyError: notifyErrorFunctionType) => void;
7120
+ /**
7121
+ * @beta
7122
+ * VideoFrame definition, align with the W3C spec: https://www.w3.org/TR/webcodecs/#videoframe-interface.
7123
+ * The current version of typescript doesn't have the definition of VideoFrame so we have to define it here.
7124
+ * At runtime it can be cast to VideoFrame directly: `(videoFrame as VideoFrame)`.
7125
+ */
7126
+ export interface VideoFrame {
7127
+ }
7128
+ /**
7129
+ * @beta
7130
+ * Video frame data extracted from the media stream. More properties may be added in the future.
7131
+ */
7132
+ export type VideoFrameData = {
7133
+ /**
7134
+ * The video frame from the media stream.
7135
+ */
7136
+ videoFrame: VideoFrame;
7137
+ };
7138
+ /**
7139
+ * @beta
7140
+ * Video frame call back function definition.
7141
+ * The callback will be called on every frame when running on the supported host.
7142
+ * We require the frame rate of the video to be at least 22fps for 720p, thus the callback should process a frame timely.
7143
+ * The video app should resolve the promise to notify a successfully processed video frame.
7144
+ * The video app should reject the promise to notify a failure. When the failures accumulate to a certain number, the host will see the app is "frozen" and ask the user to close it or not.
7145
+ */
7146
+ export type VideoFrameHandler = (receivedVideoFrame: VideoFrameData) => Promise<VideoFrame>;
7147
+ /**
7148
+ * @beta
7149
+ * Callbacks and configuration supplied to the host to process the video frames.
7150
+ */
7151
+ export type RegisterForVideoFrameParameters = {
7152
+ /**
7153
+ * Callback function to process the video frames extracted from a media stream.
7154
+ */
7155
+ videoFrameHandler: VideoFrameHandler;
7156
+ /**
7157
+ * Callback function to process the video frames shared by the host.
7158
+ */
7159
+ videoBufferHandler: VideoBufferHandler;
7160
+ /**
7161
+ * Video frame configuration supplied to the host to customize the generated video frame parameters, like format
7162
+ */
7163
+ config: VideoFrameConfig;
7164
+ };
7165
+ /**
7166
+ * Register callbacks to process the video frames if the host supports it.
7167
+ * @beta
7168
+ * @param parameters - Callbacks and configuration to process the video frames. A host may support either {@link VideoFrameHandler} or {@link VideoBufferHandler}, but not both.
7169
+ * To ensure the video effect works on all supported hosts, the video app must provide both {@link VideoFrameHandler} and {@link VideoBufferHandler}.
7170
+ * The host will choose the appropriate callback based on the host's capability.
7171
+ *
7172
+ * @example
7173
+ * ```typescript
7174
+ * video.registerForVideoFrame({
7175
+ * videoFrameHandler: async (videoFrameData) => {
7176
+ * const originalFrame = videoFrameData.videoFrame as VideoFrame;
7177
+ * try {
7178
+ * const processedFrame = await processFrame(originalFrame);
7179
+ * return processedFrame;
7180
+ * } catch (e) {
7181
+ * throw e;
7182
+ * }
7183
+ * },
7184
+ * videoBufferHandler: (
7185
+ * bufferData: VideoBufferData,
7186
+ * notifyVideoFrameProcessed: notifyVideoFrameProcessedFunctionType,
7187
+ * notifyError: notifyErrorFunctionType
7188
+ * ) => {
7189
+ * try {
7190
+ * processFrameInplace(bufferData);
7191
+ * notifyVideoFrameProcessed();
7192
+ * } catch (e) {
7193
+ * notifyError(e);
7194
+ * }
7195
+ * },
7196
+ * config: {
7197
+ * format: video.VideoPixelFormat.NV12,
7198
+ * }
7199
+ * });
7200
+ * ```
7201
+ */
7202
+ export function registerForVideoFrame(parameters: RegisterForVideoFrameParameters): void;
7112
7203
  /**
7113
7204
  * Video extension should call this to notify host that the current selected effect parameter changed.
7114
7205
  * If it's pre-meeting, host will call videoEffectCallback immediately then use the videoEffect.
@@ -7125,7 +7216,7 @@ export namespace video {
7125
7216
  */
7126
7217
  export function registerForVideoEffect(callback: VideoEffectCallback): void;
7127
7218
  /**
7128
- * Checks if video capability is supported by the host
7219
+ * Checks if video capability is supported by the host.
7129
7220
  * @beta
7130
7221
  * @returns boolean to represent whether the video capability is supported
7131
7222
  *
@@ -8134,3 +8225,23 @@ export class LiveShareHost {
8134
8225
  */
8135
8226
  export function isSupported(): boolean;
8136
8227
 
8228
+ /**
8229
+ * @hidden
8230
+ * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
8231
+ */
8232
+ export function processMediaStream(streamId: string, videoFrameHandler: video.VideoFrameHandler, notifyError: (string: any) => void): Promise<MediaStreamTrack>;
8233
+ /**
8234
+ * @hidden
8235
+ * Video effect change call back function definition
8236
+ * @beta
8237
+ *
8238
+ * @internal
8239
+ * Limited to Microsoft-internal use
8240
+ */
8241
+ type VideoEffectCallBack = (effectId: string | undefined, effectParam?: string) => Promise<void>;
8242
+ /**
8243
+ * @hidden
8244
+ */
8245
+ export function createEffectParameterChangeCallback(callback: VideoEffectCallBack): (effectId: string | undefined, effectParam?: string) => void;
8246
+ export { VideoEffectCallBack as DefaultVideoEffectCallBack };
8247
+