@microsoft/teams-js 2.13.0-beta.1 → 2.14.0-beta.0

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.
@@ -845,6 +845,7 @@ __webpack_require__.d(__webpack_exports__, {
845
845
  "location": () => (/* reexport */ location_location),
846
846
  "logs": () => (/* reexport */ logs),
847
847
  "mail": () => (/* reexport */ mail),
848
+ "marketplace": () => (/* reexport */ marketplace),
848
849
  "media": () => (/* reexport */ media),
849
850
  "meeting": () => (/* reexport */ meeting),
850
851
  "meetingRoom": () => (/* reexport */ meetingRoom),
@@ -2088,7 +2089,7 @@ var _minRuntimeConfigToUninitialize = {
2088
2089
  * @hidden
2089
2090
  * Package version.
2090
2091
  */
2091
- var version = "2.13.0-beta.1";
2092
+ var version = "2.14.0-beta.0";
2092
2093
 
2093
2094
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2094
2095
 
@@ -5789,6 +5790,50 @@ var media;
5789
5790
  sendMessageToParent('captureImage', callback);
5790
5791
  }
5791
5792
  media.captureImage = captureImage;
5793
+ /**
5794
+ * Checks whether or not media has user permission
5795
+ *
5796
+ * @returns Promise that will resolve with true if the user had granted the app permission to media information, or with false otherwise,
5797
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5798
+ */
5799
+ function hasPermission() {
5800
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
5801
+ if (!isSupported()) {
5802
+ throw errorNotSupportedOnPlatform;
5803
+ }
5804
+ var permissions = DevicePermission.Media;
5805
+ return new Promise(function (resolve) {
5806
+ resolve(sendAndHandleSdkError('permissions.has', permissions));
5807
+ });
5808
+ }
5809
+ media.hasPermission = hasPermission;
5810
+ /**
5811
+ * Requests user permission for media
5812
+ *
5813
+ * @returns Promise that will resolve with true if the user consented permission for media, or with false otherwise,
5814
+ * In case of an error, promise will reject with the error. Function can also throw a NOT_SUPPORTED_ON_PLATFORM error
5815
+ */
5816
+ function requestPermission() {
5817
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
5818
+ if (!isSupported()) {
5819
+ throw errorNotSupportedOnPlatform;
5820
+ }
5821
+ var permissions = DevicePermission.Media;
5822
+ return new Promise(function (resolve) {
5823
+ resolve(sendAndHandleSdkError('permissions.request', permissions));
5824
+ });
5825
+ }
5826
+ media.requestPermission = requestPermission;
5827
+ /**
5828
+ * Checks if media capability is supported by the host
5829
+ * @returns boolean to represent whether media is supported
5830
+ *
5831
+ * @throws Error if {@linkcode app.initialize} has not successfully completed
5832
+ */
5833
+ function isSupported() {
5834
+ return ensureInitialized(runtime) && runtime.supports.media && runtime.supports.permissions ? true : false;
5835
+ }
5836
+ media.isSupported = isSupported;
5792
5837
  /**
5793
5838
  * Media object returned by the select Media API
5794
5839
  */
@@ -7884,6 +7929,7 @@ var videoUtils_generator = (undefined && undefined.__generator) || function (thi
7884
7929
 
7885
7930
 
7886
7931
 
7932
+
7887
7933
  /**
7888
7934
  * @hidden
7889
7935
  * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
@@ -7896,8 +7942,28 @@ function processMediaStream(streamId, videoFrameHandler, notifyError) {
7896
7942
  case 0:
7897
7943
  _a = createProcessedStreamGenerator;
7898
7944
  return [4 /*yield*/, getInputVideoTrack(streamId, notifyError)];
7899
- case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), videoFrameHandler,
7900
- notifyError])];
7945
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), new DefaultTransformer(notifyError, videoFrameHandler)])];
7946
+ }
7947
+ });
7948
+ });
7949
+ }
7950
+ /**
7951
+ * @hidden
7952
+ * Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
7953
+ * The videoFrameHandler will receive metadata of the video frame.
7954
+ *
7955
+ * @internal
7956
+ * Limited to Microsoft-internal use
7957
+ */
7958
+ function processMediaStreamWithMetadata(streamId, videoFrameHandler, notifyError) {
7959
+ return videoUtils_awaiter(this, void 0, void 0, function () {
7960
+ var _a;
7961
+ return videoUtils_generator(this, function (_b) {
7962
+ switch (_b.label) {
7963
+ case 0:
7964
+ _a = createProcessedStreamGenerator;
7965
+ return [4 /*yield*/, getInputVideoTrack(streamId, notifyError)];
7966
+ case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), new TransformerWithMetadata(notifyError, videoFrameHandler)])];
7901
7967
  }
7902
7968
  });
7903
7969
  });
@@ -7942,7 +8008,7 @@ function getInputVideoTrack(streamId, notifyError) {
7942
8008
  * The processed frames are then enqueued to the generator.
7943
8009
  * The generator can be registered back to the media stream so that the host can get the processed frames.
7944
8010
  */
7945
- function createProcessedStreamGenerator(videoTrack, videoFrameHandler, notifyError) {
8011
+ function createProcessedStreamGenerator(videoTrack, transformer) {
7946
8012
  if (inServerSideRenderingEnvironment()) {
7947
8013
  throw errorNotSupportedOnPlatform;
7948
8014
  }
@@ -7952,48 +8018,301 @@ function createProcessedStreamGenerator(videoTrack, videoFrameHandler, notifyErr
7952
8018
  var MediaStreamTrackGenerator = window['MediaStreamTrackGenerator'];
7953
8019
  var generator = new MediaStreamTrackGenerator({ kind: 'video' });
7954
8020
  var sink = generator.writable;
7955
- source
7956
- .pipeThrough(new TransformStream({
7957
- transform: function (originalFrame, controller) {
7958
- return videoUtils_awaiter(this, void 0, void 0, function () {
7959
- var timestamp, frameProcessedByApp, processedFrame, error_2;
7960
- return videoUtils_generator(this, function (_a) {
7961
- switch (_a.label) {
7962
- case 0:
7963
- timestamp = originalFrame.timestamp;
7964
- if (!(timestamp !== null)) return [3 /*break*/, 5];
7965
- _a.label = 1;
7966
- case 1:
7967
- _a.trys.push([1, 3, , 4]);
7968
- return [4 /*yield*/, videoFrameHandler({ videoFrame: originalFrame })];
7969
- case 2:
7970
- frameProcessedByApp = _a.sent();
7971
- processedFrame = new VideoFrame(frameProcessedByApp, {
7972
- // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
7973
- timestamp: timestamp,
7974
- });
7975
- controller.enqueue(processedFrame);
7976
- originalFrame.close();
7977
- frameProcessedByApp.close();
7978
- return [3 /*break*/, 4];
7979
- case 3:
7980
- error_2 = _a.sent();
7981
- originalFrame.close();
7982
- notifyError(error_2);
7983
- return [3 /*break*/, 4];
7984
- case 4: return [3 /*break*/, 6];
7985
- case 5:
7986
- notifyError('timestamp of the original video frame is null');
7987
- _a.label = 6;
7988
- case 6: return [2 /*return*/];
7989
- }
7990
- });
7991
- });
7992
- },
7993
- }))
7994
- .pipeTo(sink);
8021
+ source.pipeThrough(new TransformStream(transformer)).pipeTo(sink);
7995
8022
  return generator;
7996
8023
  }
8024
+ /**
8025
+ * @hidden
8026
+ * Error messages during video frame transformation.
8027
+ */
8028
+ var VideoFrameTransformErrors;
8029
+ (function (VideoFrameTransformErrors) {
8030
+ VideoFrameTransformErrors["TimestampIsNull"] = "timestamp of the original video frame is null";
8031
+ VideoFrameTransformErrors["UnsupportedVideoFramePixelFormat"] = "Unsupported video frame pixel format";
8032
+ })(VideoFrameTransformErrors || (VideoFrameTransformErrors = {}));
8033
+ var DefaultTransformer = /** @class */ (function () {
8034
+ function DefaultTransformer(notifyError, videoFrameHandler) {
8035
+ var _this = this;
8036
+ this.notifyError = notifyError;
8037
+ this.videoFrameHandler = videoFrameHandler;
8038
+ this.transform = function (originalFrame, controller) { return videoUtils_awaiter(_this, void 0, void 0, function () {
8039
+ var timestamp, frameProcessedByApp, processedFrame, error_2;
8040
+ return videoUtils_generator(this, function (_a) {
8041
+ switch (_a.label) {
8042
+ case 0:
8043
+ timestamp = originalFrame.timestamp;
8044
+ if (!(timestamp !== null)) return [3 /*break*/, 5];
8045
+ _a.label = 1;
8046
+ case 1:
8047
+ _a.trys.push([1, 3, , 4]);
8048
+ return [4 /*yield*/, this.videoFrameHandler({ videoFrame: originalFrame })];
8049
+ case 2:
8050
+ frameProcessedByApp = _a.sent();
8051
+ processedFrame = new VideoFrame(frameProcessedByApp, {
8052
+ // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
8053
+ timestamp: timestamp,
8054
+ });
8055
+ controller.enqueue(processedFrame);
8056
+ originalFrame.close();
8057
+ frameProcessedByApp.close();
8058
+ return [3 /*break*/, 4];
8059
+ case 3:
8060
+ error_2 = _a.sent();
8061
+ originalFrame.close();
8062
+ this.notifyError(error_2);
8063
+ return [3 /*break*/, 4];
8064
+ case 4: return [3 /*break*/, 6];
8065
+ case 5:
8066
+ this.notifyError(VideoFrameTransformErrors.TimestampIsNull);
8067
+ _a.label = 6;
8068
+ case 6: return [2 /*return*/];
8069
+ }
8070
+ });
8071
+ }); };
8072
+ }
8073
+ return DefaultTransformer;
8074
+ }());
8075
+ /**
8076
+ * @hidden
8077
+ * Utility class to parse the header of a one-texture-input texture.
8078
+ */
8079
+ var OneTextureHeader = /** @class */ (function () {
8080
+ function OneTextureHeader(headerBuffer, notifyError) {
8081
+ this.headerBuffer = headerBuffer;
8082
+ this.notifyError = notifyError;
8083
+ // Identifier for the texture layout, which is the 4-byte ASCII string "oti1" hardcoded by the host
8084
+ // (oti1 stands for "one texture input version 1")
8085
+ this.ONE_TEXTURE_INPUT_ID = 0x6f746931;
8086
+ this.INVALID_HEADER_ERROR = 'Invalid video frame header';
8087
+ this.UNSUPPORTED_LAYOUT_ERROR = 'Unsupported texture layout';
8088
+ this.headerDataView = new Uint32Array(headerBuffer);
8089
+ // headerDataView will contain the following data:
8090
+ // 0: oneTextureLayoutId
8091
+ // 1: version
8092
+ // 2: frameRowOffset
8093
+ // 3: frameFormat
8094
+ // 4: frameWidth
8095
+ // 5: frameHeight
8096
+ // 6: multiStreamHeaderRowOffset
8097
+ // 7: multiStreamCount
8098
+ if (this.headerDataView.length < 8) {
8099
+ this.notifyError(this.INVALID_HEADER_ERROR);
8100
+ throw new Error(this.INVALID_HEADER_ERROR);
8101
+ }
8102
+ // ensure the texture layout is supported
8103
+ if (this.headerDataView[0] !== this.ONE_TEXTURE_INPUT_ID) {
8104
+ this.notifyError(this.UNSUPPORTED_LAYOUT_ERROR);
8105
+ throw new Error(this.UNSUPPORTED_LAYOUT_ERROR);
8106
+ }
8107
+ }
8108
+ Object.defineProperty(OneTextureHeader.prototype, "oneTextureLayoutId", {
8109
+ get: function () {
8110
+ return this.headerDataView[0];
8111
+ },
8112
+ enumerable: false,
8113
+ configurable: true
8114
+ });
8115
+ Object.defineProperty(OneTextureHeader.prototype, "version", {
8116
+ get: function () {
8117
+ return this.headerDataView[1];
8118
+ },
8119
+ enumerable: false,
8120
+ configurable: true
8121
+ });
8122
+ Object.defineProperty(OneTextureHeader.prototype, "frameRowOffset", {
8123
+ get: function () {
8124
+ return this.headerDataView[2];
8125
+ },
8126
+ enumerable: false,
8127
+ configurable: true
8128
+ });
8129
+ Object.defineProperty(OneTextureHeader.prototype, "frameFormat", {
8130
+ get: function () {
8131
+ return this.headerDataView[3];
8132
+ },
8133
+ enumerable: false,
8134
+ configurable: true
8135
+ });
8136
+ Object.defineProperty(OneTextureHeader.prototype, "frameWidth", {
8137
+ get: function () {
8138
+ return this.headerDataView[4];
8139
+ },
8140
+ enumerable: false,
8141
+ configurable: true
8142
+ });
8143
+ Object.defineProperty(OneTextureHeader.prototype, "frameHeight", {
8144
+ get: function () {
8145
+ return this.headerDataView[5];
8146
+ },
8147
+ enumerable: false,
8148
+ configurable: true
8149
+ });
8150
+ Object.defineProperty(OneTextureHeader.prototype, "multiStreamHeaderRowOffset", {
8151
+ get: function () {
8152
+ return this.headerDataView[6];
8153
+ },
8154
+ enumerable: false,
8155
+ configurable: true
8156
+ });
8157
+ Object.defineProperty(OneTextureHeader.prototype, "multiStreamCount", {
8158
+ get: function () {
8159
+ return this.headerDataView[7];
8160
+ },
8161
+ enumerable: false,
8162
+ configurable: true
8163
+ });
8164
+ return OneTextureHeader;
8165
+ }());
8166
+ /**
8167
+ * @hidden
8168
+ * Utility class to parse the metadata of a one-texture-input texture.
8169
+ */
8170
+ var OneTextureMetadata = /** @class */ (function () {
8171
+ function OneTextureMetadata(metadataBuffer, streamCount) {
8172
+ this.metadataMap = new Map();
8173
+ // Stream id for audio inference metadata, which is the 4-byte ASCII string "1dia" hardcoded by the host
8174
+ // (1dia stands for "audio inference data version 1")
8175
+ this.AUDIO_INFERENCE_RESULT_STREAM_ID = 0x31646961;
8176
+ var metadataDataView = new Uint32Array(metadataBuffer);
8177
+ for (var i = 0, index = 0; i < streamCount; i++) {
8178
+ var streamId = metadataDataView[index++];
8179
+ var streamDataOffset = metadataDataView[index++];
8180
+ var streamDataSize = metadataDataView[index++];
8181
+ var streamData = new Uint8Array(metadataBuffer, streamDataOffset, streamDataSize);
8182
+ this.metadataMap.set(streamId, streamData);
8183
+ }
8184
+ }
8185
+ Object.defineProperty(OneTextureMetadata.prototype, "audioInferenceResult", {
8186
+ get: function () {
8187
+ return this.metadataMap.get(this.AUDIO_INFERENCE_RESULT_STREAM_ID);
8188
+ },
8189
+ enumerable: false,
8190
+ configurable: true
8191
+ });
8192
+ return OneTextureMetadata;
8193
+ }());
8194
+ var TransformerWithMetadata = /** @class */ (function () {
8195
+ function TransformerWithMetadata(notifyError, videoFrameHandler) {
8196
+ var _this = this;
8197
+ this.notifyError = notifyError;
8198
+ this.videoFrameHandler = videoFrameHandler;
8199
+ this.shouldDiscardAudioInferenceResult = false;
8200
+ this.transform = function (originalFrame, controller) { return videoUtils_awaiter(_this, void 0, void 0, function () {
8201
+ var timestamp, _a, videoFrame, _b, _c, audioInferenceResult, frameProcessedByApp, processedFrame, error_3;
8202
+ return videoUtils_generator(this, function (_d) {
8203
+ switch (_d.label) {
8204
+ case 0:
8205
+ timestamp = originalFrame.timestamp;
8206
+ if (!(timestamp !== null)) return [3 /*break*/, 6];
8207
+ _d.label = 1;
8208
+ case 1:
8209
+ _d.trys.push([1, 4, , 5]);
8210
+ return [4 /*yield*/, this.extractVideoFrameAndMetadata(originalFrame)];
8211
+ case 2:
8212
+ _a = _d.sent(), videoFrame = _a.videoFrame, _b = _a.metadata, _c = _b === void 0 ? {} : _b, audioInferenceResult = _c.audioInferenceResult;
8213
+ return [4 /*yield*/, this.videoFrameHandler({ videoFrame: videoFrame, audioInferenceResult: audioInferenceResult })];
8214
+ case 3:
8215
+ frameProcessedByApp = _d.sent();
8216
+ processedFrame = new VideoFrame(frameProcessedByApp, {
8217
+ // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
8218
+ timestamp: timestamp,
8219
+ });
8220
+ controller.enqueue(processedFrame);
8221
+ videoFrame.close();
8222
+ originalFrame.close();
8223
+ frameProcessedByApp.close();
8224
+ return [3 /*break*/, 5];
8225
+ case 4:
8226
+ error_3 = _d.sent();
8227
+ originalFrame.close();
8228
+ this.notifyError(error_3);
8229
+ return [3 /*break*/, 5];
8230
+ case 5: return [3 /*break*/, 7];
8231
+ case 6:
8232
+ this.notifyError(VideoFrameTransformErrors.TimestampIsNull);
8233
+ _d.label = 7;
8234
+ case 7: return [2 /*return*/];
8235
+ }
8236
+ });
8237
+ }); };
8238
+ /**
8239
+ * @hidden
8240
+ * Extract video frame and metadata from the given texture.
8241
+ * The given texure should be in NV12 format and the layout of the texture should be:
8242
+ * | Texture layout |
8243
+ * | :--- |
8244
+ * | Header |
8245
+ * | Real video frame data |
8246
+ * | Metadata |
8247
+ *
8248
+ * The header data is in the first two rows with the following format:
8249
+ * | oneTextureLayoutId | version | frameRowOffset | frameFormat | frameWidth | frameHeight | multiStreamHeaderRowOffset | multiStreamCount | ... |
8250
+ * | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
8251
+ * | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | ... |
8252
+ *
8253
+ * After header, it comes with the real video frame data.
8254
+ * At the end of the texture, it comes with the metadata. The metadata section can contain multiple types of metadata.
8255
+ * Each type of metadata is called a stream. The section is in the following format:
8256
+ * | stream1.id | stream1.dataOffset | stream1.dataSize | stream2.id | stream2.dataOffset | stream2.dataSize | ... | stream1.data | stream2.data | ... |
8257
+ * | :---: | :---: | :---: | :---: | :---: | :---: |:---:| :---: | :---: |:---:|
8258
+ * | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | 4 bytes | ... | ... | ... | ... |
8259
+ *
8260
+ * @internal
8261
+ * Limited to Microsoft-internal use
8262
+ */
8263
+ this.extractVideoFrameAndMetadata = function (texture) { return videoUtils_awaiter(_this, void 0, void 0, function () {
8264
+ var headerRect, headerBuffer, header, metadataRect, metadataBuffer, metadata;
8265
+ return videoUtils_generator(this, function (_a) {
8266
+ switch (_a.label) {
8267
+ case 0:
8268
+ if (inServerSideRenderingEnvironment()) {
8269
+ throw errorNotSupportedOnPlatform;
8270
+ }
8271
+ if (texture.format !== 'NV12') {
8272
+ this.notifyError(VideoFrameTransformErrors.UnsupportedVideoFramePixelFormat);
8273
+ throw new Error(VideoFrameTransformErrors.UnsupportedVideoFramePixelFormat);
8274
+ }
8275
+ headerRect = { x: 0, y: 0, width: texture.codedWidth, height: 2 };
8276
+ headerBuffer = new ArrayBuffer((headerRect.width * headerRect.height * 3) / 2);
8277
+ return [4 /*yield*/, texture.copyTo(headerBuffer, { rect: headerRect })];
8278
+ case 1:
8279
+ _a.sent();
8280
+ header = new OneTextureHeader(headerBuffer, this.notifyError);
8281
+ metadataRect = {
8282
+ x: 0,
8283
+ y: header.multiStreamHeaderRowOffset,
8284
+ width: texture.codedWidth,
8285
+ height: texture.codedHeight - header.multiStreamHeaderRowOffset,
8286
+ };
8287
+ metadataBuffer = new ArrayBuffer((metadataRect.width * metadataRect.height * 3) / 2);
8288
+ return [4 /*yield*/, texture.copyTo(metadataBuffer, { rect: metadataRect })];
8289
+ case 2:
8290
+ _a.sent();
8291
+ metadata = new OneTextureMetadata(metadataBuffer, header.multiStreamCount);
8292
+ return [2 /*return*/, {
8293
+ videoFrame: new VideoFrame(texture, {
8294
+ timestamp: texture.timestamp,
8295
+ visibleRect: {
8296
+ x: 0,
8297
+ y: header.frameRowOffset,
8298
+ width: header.frameWidth,
8299
+ height: header.frameHeight,
8300
+ },
8301
+ }),
8302
+ metadata: {
8303
+ audioInferenceResult: this.shouldDiscardAudioInferenceResult ? undefined : metadata.audioInferenceResult,
8304
+ },
8305
+ }];
8306
+ }
8307
+ });
8308
+ }); };
8309
+ registerHandler('video.mediaStream.audioInferenceDiscardStatusChange', function (_a) {
8310
+ var discardAudioInferenceResult = _a.discardAudioInferenceResult;
8311
+ _this.shouldDiscardAudioInferenceResult = discardAudioInferenceResult;
8312
+ });
8313
+ }
8314
+ return TransformerWithMetadata;
8315
+ }());
7997
8316
  /**
7998
8317
  * @hidden
7999
8318
  */
@@ -8001,11 +8320,11 @@ function createEffectParameterChangeCallback(callback) {
8001
8320
  return function (effectId, effectParam) {
8002
8321
  callback(effectId, effectParam)
8003
8322
  .then(function () {
8004
- sendMessageToParent('video.videoEffectReadiness', [true, effectId]);
8323
+ sendMessageToParent('video.videoEffectReadiness', [true, effectId, undefined, effectParam]);
8005
8324
  })
8006
8325
  .catch(function (reason) {
8007
8326
  var validReason = reason in video.EffectFailureReason ? reason : video.EffectFailureReason.InitializationFailure;
8008
- sendMessageToParent('video.videoEffectReadiness', [false, effectId, validReason]);
8327
+ sendMessageToParent('video.videoEffectReadiness', [false, effectId, validReason, effectParam]);
8009
8328
  });
8010
8329
  };
8011
8330
  }
@@ -9571,6 +9890,423 @@ function ensureSupported() {
9571
9890
  }
9572
9891
  }
9573
9892
 
9893
+ ;// CONCATENATED MODULE: ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/regex.js
9894
+ /* harmony default export */ const regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
9895
+ ;// CONCATENATED MODULE: ../../node_modules/.pnpm/uuid@9.0.0/node_modules/uuid/dist/esm-browser/validate.js
9896
+
9897
+
9898
+ function validate_validate(uuid) {
9899
+ return typeof uuid === 'string' && regex.test(uuid);
9900
+ }
9901
+
9902
+ /* harmony default export */ const esm_browser_validate = (validate_validate);
9903
+ ;// CONCATENATED MODULE: ./src/internal/marketplaceUtils.ts
9904
+ var marketplaceUtils_assign = (undefined && undefined.__assign) || function () {
9905
+ marketplaceUtils_assign = Object.assign || function(t) {
9906
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9907
+ s = arguments[i];
9908
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9909
+ t[p] = s[p];
9910
+ }
9911
+ return t;
9912
+ };
9913
+ return marketplaceUtils_assign.apply(this, arguments);
9914
+ };
9915
+ var marketplaceUtils_rest = (undefined && undefined.__rest) || function (s, e) {
9916
+ var t = {};
9917
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
9918
+ t[p] = s[p];
9919
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
9920
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9921
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9922
+ t[p[i]] = s[p[i]];
9923
+ }
9924
+ return t;
9925
+ };
9926
+ /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
9927
+ /* eslint-disable @typescript-eslint/no-explicit-any */
9928
+
9929
+
9930
+ /**
9931
+ * @hidden
9932
+ * deserialize the cart data:
9933
+ * - convert url properties from string to URL
9934
+ * @param cartItems The cart items
9935
+ *
9936
+ * @internal
9937
+ * Limited to Microsoft-internal use
9938
+ */
9939
+ function deserializeCart(cartData) {
9940
+ try {
9941
+ cartData.cartItems = deserializeCartItems(cartData.cartItems);
9942
+ return cartData;
9943
+ }
9944
+ catch (e) {
9945
+ throw new Error('Error deserializing cart');
9946
+ }
9947
+ }
9948
+ /**
9949
+ * @hidden
9950
+ * deserialize the cart items:
9951
+ * - convert url properties from string to URL
9952
+ * @param cartItems The cart items
9953
+ *
9954
+ * @internal
9955
+ * Limited to Microsoft-internal use
9956
+ */
9957
+ function deserializeCartItems(cartItemsData) {
9958
+ return cartItemsData.map(function (cartItem) {
9959
+ if (cartItem.imageURL) {
9960
+ var url = new URL(cartItem.imageURL);
9961
+ cartItem.imageURL = url;
9962
+ }
9963
+ if (cartItem.accessories) {
9964
+ cartItem.accessories = deserializeCartItems(cartItem.accessories);
9965
+ }
9966
+ return cartItem;
9967
+ });
9968
+ }
9969
+ /**
9970
+ * @hidden
9971
+ * serialize the cart items:
9972
+ * - make URL properties to string
9973
+ * @param cartItems The cart items
9974
+ *
9975
+ * @internal
9976
+ * Limited to Microsoft-internal use
9977
+ */
9978
+ var serializeCartItems = function (cartItems) {
9979
+ try {
9980
+ return cartItems.map(function (cartItem) {
9981
+ var imageURL = cartItem.imageURL, accessories = cartItem.accessories, rest = marketplaceUtils_rest(cartItem, ["imageURL", "accessories"]);
9982
+ var cartItemsData = marketplaceUtils_assign({}, rest);
9983
+ if (imageURL) {
9984
+ cartItemsData.imageURL = imageURL.href;
9985
+ }
9986
+ if (accessories) {
9987
+ cartItemsData.accessories = serializeCartItems(accessories);
9988
+ }
9989
+ return cartItemsData;
9990
+ });
9991
+ }
9992
+ catch (e) {
9993
+ throw new Error('Error serializing cart items');
9994
+ }
9995
+ };
9996
+ /**
9997
+ * @hidden
9998
+ * Validate the cart item properties are valid
9999
+ * @param cartItems The cart items
10000
+ *
10001
+ * @internal
10002
+ * Limited to Microsoft-internal use
10003
+ */
10004
+ function validateCartItems(cartItems) {
10005
+ if (!Array.isArray(cartItems) || cartItems.length === 0) {
10006
+ throw new Error('cartItems must be a non-empty array');
10007
+ }
10008
+ for (var _i = 0, cartItems_1 = cartItems; _i < cartItems_1.length; _i++) {
10009
+ var cartItem = cartItems_1[_i];
10010
+ validateBasicCartItem(cartItem);
10011
+ validateAccessoryItems(cartItem.accessories);
10012
+ }
10013
+ }
10014
+ /**
10015
+ * @hidden
10016
+ * Validate accessories
10017
+ * @param accessoryItems The accessories to be validated
10018
+ *
10019
+ * @internal
10020
+ * Limited to Microsoft-internal use
10021
+ */
10022
+ function validateAccessoryItems(accessoryItems) {
10023
+ if (accessoryItems === null || accessoryItems === undefined) {
10024
+ return;
10025
+ }
10026
+ if (!Array.isArray(accessoryItems) || accessoryItems.length === 0) {
10027
+ throw new Error('CartItem.accessories must be a non-empty array');
10028
+ }
10029
+ for (var _i = 0, accessoryItems_1 = accessoryItems; _i < accessoryItems_1.length; _i++) {
10030
+ var accessoryItem = accessoryItems_1[_i];
10031
+ if (accessoryItem['accessories']) {
10032
+ throw new Error('Item in CartItem.accessories cannot have accessories');
10033
+ }
10034
+ validateBasicCartItem(accessoryItem);
10035
+ }
10036
+ }
10037
+ /**
10038
+ * @hidden
10039
+ * Validate the basic cart item properties are valid
10040
+ * @param basicCartItem The basic cart item
10041
+ *
10042
+ * @internal
10043
+ * Limited to Microsoft-internal use
10044
+ */
10045
+ function validateBasicCartItem(basicCartItem) {
10046
+ if (!basicCartItem.id) {
10047
+ throw new Error('cartItem.id must not be empty');
10048
+ }
10049
+ if (!basicCartItem.name) {
10050
+ throw new Error('cartItem.name must not be empty');
10051
+ }
10052
+ validatePrice(basicCartItem.price);
10053
+ validateQuantity(basicCartItem.quantity);
10054
+ }
10055
+ /**
10056
+ * @hidden
10057
+ * Validate the id is valid
10058
+ * @param id A uuid string
10059
+ *
10060
+ * @internal
10061
+ * Limited to Microsoft-internal use
10062
+ */
10063
+ function validateUuid(id) {
10064
+ if (id === undefined || id === null) {
10065
+ return;
10066
+ }
10067
+ if (!id) {
10068
+ throw new Error('id must not be empty');
10069
+ }
10070
+ if (esm_browser_validate(id) === false) {
10071
+ throw new Error('id must be a valid UUID');
10072
+ }
10073
+ }
10074
+ /**
10075
+ * @hidden
10076
+ * Validate the cart item properties are valid
10077
+ * @param price The price to be validated
10078
+ *
10079
+ * @internal
10080
+ * Limited to Microsoft-internal use
10081
+ */
10082
+ function validatePrice(price) {
10083
+ if (typeof price !== 'number' || price < 0) {
10084
+ throw new Error("price ".concat(price, " must be a number not less than 0"));
10085
+ }
10086
+ if (parseFloat(price.toFixed(3)) !== price) {
10087
+ throw new Error("price ".concat(price, " must have at most 3 decimal places"));
10088
+ }
10089
+ }
10090
+ /**
10091
+ * @hidden
10092
+ * Validate quantity
10093
+ * @param quantity The quantity to be validated
10094
+ *
10095
+ * @internal
10096
+ * Limited to Microsoft-internal use
10097
+ */
10098
+ function validateQuantity(quantity) {
10099
+ if (typeof quantity !== 'number' || quantity <= 0 || parseInt(quantity.toString()) !== quantity) {
10100
+ throw new Error("quantity ".concat(quantity, " must be an integer greater than 0"));
10101
+ }
10102
+ }
10103
+ /**
10104
+ * @hidden
10105
+ * Validate cart status
10106
+ * @param cartStatus The cartStatus to be validated
10107
+ *
10108
+ * @internal
10109
+ * Limited to Microsoft-internal use
10110
+ */
10111
+ function validateCartStatus(cartStatus) {
10112
+ if (!Object.values(marketplace.CartStatus).includes(cartStatus)) {
10113
+ throw new Error("cartStatus ".concat(cartStatus, " is not valid"));
10114
+ }
10115
+ }
10116
+
10117
+ ;// CONCATENATED MODULE: ./src/public/marketplace.ts
10118
+ var marketplace_assign = (undefined && undefined.__assign) || function () {
10119
+ marketplace_assign = Object.assign || function(t) {
10120
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
10121
+ s = arguments[i];
10122
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10123
+ t[p] = s[p];
10124
+ }
10125
+ return t;
10126
+ };
10127
+ return marketplace_assign.apply(this, arguments);
10128
+ };
10129
+
10130
+
10131
+
10132
+
10133
+
10134
+ /**
10135
+ * @hidden
10136
+ * Namespace for an app to support a checkout flow by interacting with the marketplace cart in the host.
10137
+ * @beta
10138
+ */
10139
+ var marketplace;
10140
+ (function (marketplace) {
10141
+ /**
10142
+ * @hidden
10143
+ * the version of the current cart interface
10144
+ * which is forced to send to the host in the calls.
10145
+ * @internal
10146
+ * Limited to Microsoft-internal use
10147
+ * @beta
10148
+ */
10149
+ marketplace.cartVersion = {
10150
+ /**
10151
+ * @hidden
10152
+ * Represents the major version of the current cart interface,
10153
+ * it is increased when incompatible interface update happens.
10154
+ */
10155
+ majorVersion: 1,
10156
+ /**
10157
+ * @hidden
10158
+ * The minor version of the current cart interface, which is compatible
10159
+ * with the previous minor version in the same major version.
10160
+ */
10161
+ minorVersion: 1,
10162
+ };
10163
+ /**
10164
+ * @hidden
10165
+ * Represents the persona creating the cart.
10166
+ * @beta
10167
+ */
10168
+ var Intent;
10169
+ (function (Intent) {
10170
+ /**
10171
+ * @hidden
10172
+ * The cart is created by admin of an organization in Teams Admin Center.
10173
+ */
10174
+ Intent["TACAdminUser"] = "TACAdminUser";
10175
+ /**
10176
+ * @hidden
10177
+ * The cart is created by admin of an organization in Teams.
10178
+ */
10179
+ Intent["TeamsAdminUser"] = "TeamsAdminUser";
10180
+ /**
10181
+ * @hidden
10182
+ * The cart is created by end user of an organization in Teams.
10183
+ */
10184
+ Intent["TeamsEndUser"] = "TeamsEndUser";
10185
+ })(Intent = marketplace.Intent || (marketplace.Intent = {}));
10186
+ /**
10187
+ * @hidden
10188
+ * Represents the status of the cart.
10189
+ * @beta
10190
+ */
10191
+ var CartStatus;
10192
+ (function (CartStatus) {
10193
+ /**
10194
+ * @hidden
10195
+ * Cart is created but not checked out yet.
10196
+ */
10197
+ CartStatus["Open"] = "Open";
10198
+ /**
10199
+ * @hidden
10200
+ * Cart is checked out but not completed yet.
10201
+ */
10202
+ CartStatus["Processing"] = "Processing";
10203
+ /**
10204
+ * @hidden
10205
+ * Indicate checking out is completed and the host should
10206
+ * return a new cart in the next getCart call.
10207
+ */
10208
+ CartStatus["Processed"] = "Processed";
10209
+ /**
10210
+ * @hidden
10211
+ * Indicate checking out process is manually cancelled by the user
10212
+ */
10213
+ CartStatus["Closed"] = "Closed";
10214
+ /**
10215
+ * @hidden
10216
+ * Indicate checking out is failed and the host should
10217
+ * return a new cart in the next getCart call.
10218
+ */
10219
+ CartStatus["Error"] = "Error";
10220
+ })(CartStatus = marketplace.CartStatus || (marketplace.CartStatus = {}));
10221
+ /**
10222
+ * @hidden
10223
+ * Get the cart object owned by the host to checkout.
10224
+ * @returns A promise of the cart object in the cartVersion.
10225
+ * @beta
10226
+ */
10227
+ function getCart() {
10228
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
10229
+ if (!isSupported()) {
10230
+ throw errorNotSupportedOnPlatform;
10231
+ }
10232
+ return sendAndHandleSdkError('marketplace.getCart', marketplace.cartVersion).then(deserializeCart);
10233
+ }
10234
+ marketplace.getCart = getCart;
10235
+ /**
10236
+ * @hidden
10237
+ * Add or update cart items in the cart owned by the host.
10238
+ * @param addOrUpdateCartItemsParams Represents the parameters to update the cart items.
10239
+ * @returns A promise of the updated cart object in the cartVersion.
10240
+ * @beta
10241
+ */
10242
+ function addOrUpdateCartItems(addOrUpdateCartItemsParams) {
10243
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
10244
+ if (!isSupported()) {
10245
+ throw errorNotSupportedOnPlatform;
10246
+ }
10247
+ if (!addOrUpdateCartItemsParams) {
10248
+ throw new Error('addOrUpdateCartItemsParams must be provided');
10249
+ }
10250
+ validateUuid(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartId);
10251
+ validateCartItems(addOrUpdateCartItemsParams === null || addOrUpdateCartItemsParams === void 0 ? void 0 : addOrUpdateCartItemsParams.cartItems);
10252
+ return sendAndHandleSdkError('marketplace.addOrUpdateCartItems', marketplace_assign(marketplace_assign({}, addOrUpdateCartItemsParams), { cartItems: serializeCartItems(addOrUpdateCartItemsParams.cartItems), cartVersion: marketplace.cartVersion })).then(deserializeCart);
10253
+ }
10254
+ marketplace.addOrUpdateCartItems = addOrUpdateCartItems;
10255
+ /**
10256
+ * @hidden
10257
+ * Remove cart items from the cart owned by the host.
10258
+ * @param removeCartItemsParams The parameters to remove the cart items.
10259
+ * @returns A promise of the updated cart object in the cartVersion.
10260
+ * @beta
10261
+ */
10262
+ function removeCartItems(removeCartItemsParams) {
10263
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
10264
+ if (!isSupported()) {
10265
+ throw errorNotSupportedOnPlatform;
10266
+ }
10267
+ if (!removeCartItemsParams) {
10268
+ throw new Error('removeCartItemsParams must be provided');
10269
+ }
10270
+ validateUuid(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartId);
10271
+ if (!Array.isArray(removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds) || (removeCartItemsParams === null || removeCartItemsParams === void 0 ? void 0 : removeCartItemsParams.cartItemIds.length) === 0) {
10272
+ throw new Error('cartItemIds must be a non-empty array');
10273
+ }
10274
+ return sendAndHandleSdkError('marketplace.removeCartItems', marketplace_assign(marketplace_assign({}, removeCartItemsParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
10275
+ }
10276
+ marketplace.removeCartItems = removeCartItems;
10277
+ /**
10278
+ * @hidden
10279
+ * Update cart status in the cart owned by the host.
10280
+ * @param updateCartStatusParams The parameters to update the cart status.
10281
+ * @returns A promise of the updated cart object in the cartVersion.
10282
+ * @beta
10283
+ */
10284
+ function updateCartStatus(updateCartStatusParams) {
10285
+ ensureInitialized(runtime, FrameContexts.content, FrameContexts.task);
10286
+ if (!isSupported()) {
10287
+ throw errorNotSupportedOnPlatform;
10288
+ }
10289
+ if (!updateCartStatusParams) {
10290
+ throw new Error('updateCartStatusParams must be provided');
10291
+ }
10292
+ validateUuid(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartId);
10293
+ validateCartStatus(updateCartStatusParams === null || updateCartStatusParams === void 0 ? void 0 : updateCartStatusParams.cartStatus);
10294
+ return sendAndHandleSdkError('marketplace.updateCartStatus', marketplace_assign(marketplace_assign({}, updateCartStatusParams), { cartVersion: marketplace.cartVersion })).then(deserializeCart);
10295
+ }
10296
+ marketplace.updateCartStatus = updateCartStatus;
10297
+ /**
10298
+ * @hidden
10299
+ * Checks if the marketplace capability is supported by the host.
10300
+ * @returns Boolean to represent whether the marketplace capability is supported.
10301
+ * @throws Error if {@linkcode app.initialize} has not successfully completed.
10302
+ * @beta
10303
+ */
10304
+ function isSupported() {
10305
+ return ensureInitialized(runtime) && runtime.supports.marketplace ? true : false;
10306
+ }
10307
+ marketplace.isSupported = isSupported;
10308
+ })(marketplace || (marketplace = {}));
10309
+
9574
10310
  ;// CONCATENATED MODULE: ./src/public/index.ts
9575
10311
 
9576
10312
 
@@ -9606,6 +10342,7 @@ function ensureSupported() {
9606
10342
 
9607
10343
 
9608
10344
 
10345
+
9609
10346
 
9610
10347
 
9611
10348
 
@@ -10841,6 +11578,43 @@ var teams;
10841
11578
  })(teams || (teams = {}));
10842
11579
 
10843
11580
  ;// CONCATENATED MODULE: ./src/private/videoEx.ts
11581
+ var videoEx_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
11582
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11583
+ return new (P || (P = Promise))(function (resolve, reject) {
11584
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11585
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11586
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11587
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11588
+ });
11589
+ };
11590
+ var videoEx_generator = (undefined && undefined.__generator) || function (thisArg, body) {
11591
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11592
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11593
+ function verb(n) { return function (v) { return step([n, v]); }; }
11594
+ function step(op) {
11595
+ if (f) throw new TypeError("Generator is already executing.");
11596
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
11597
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
11598
+ if (y = 0, t) op = [op[0] & 2, t.value];
11599
+ switch (op[0]) {
11600
+ case 0: case 1: t = op; break;
11601
+ case 4: _.label++; return { value: op[1], done: false };
11602
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11603
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11604
+ default:
11605
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11606
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11607
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11608
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11609
+ if (t[2]) _.ops.pop();
11610
+ _.trys.pop(); continue;
11611
+ }
11612
+ op = body.call(thisArg, _);
11613
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11614
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11615
+ }
11616
+ };
11617
+
10844
11618
 
10845
11619
 
10846
11620
 
@@ -10876,31 +11650,74 @@ var videoEx;
10876
11650
  * Register to process video frames
10877
11651
  * @beta
10878
11652
  *
10879
- * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
10880
- * @param config - VideoFrameConfig to customize generated video frame parameters
11653
+ * @param parameters - Callbacks and configuration to process the video frames. A host may support either {@link VideoFrameHandler} or {@link VideoBufferHandler}, but not both.
11654
+ * To ensure the video effect works on all supported hosts, the video app must provide both {@link VideoFrameHandler} and {@link VideoBufferHandler}.
11655
+ * The host will choose the appropriate callback based on the host's capability.
10881
11656
  *
10882
11657
  * @internal
10883
11658
  * Limited to Microsoft-internal use
10884
11659
  */
10885
11660
  function registerForVideoFrame(parameters) {
10886
- ensureInitialized(runtime, FrameContexts.sidePanel);
11661
+ var _this = this;
11662
+ var _a, _b;
10887
11663
  if (!isSupported()) {
10888
11664
  throw errorNotSupportedOnPlatform;
10889
11665
  }
10890
- if (!parameters.videoBufferHandler) {
10891
- throw new Error('parameters.videoBufferHandler must be provided');
11666
+ if (!parameters.videoFrameHandler || !parameters.videoBufferHandler) {
11667
+ throw new Error('Both videoFrameHandler and videoBufferHandler must be provided');
10892
11668
  }
10893
- registerHandler('video.newVideoFrame', function (videoBufferData) {
10894
- if (videoBufferData) {
10895
- var timestamp_1 = videoBufferData.timestamp;
10896
- parameters.videoBufferHandler(videoBufferData, function () {
10897
- notifyVideoFrameProcessed(timestamp_1);
10898
- }, notifyError);
11669
+ if (ensureInitialized(runtime, FrameContexts.sidePanel)) {
11670
+ if ((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream) {
11671
+ registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return videoEx_awaiter(_this, void 0, void 0, function () {
11672
+ var streamId, metadataInTexture, generator, _a;
11673
+ var _b, _c;
11674
+ return videoEx_generator(this, function (_d) {
11675
+ switch (_d.label) {
11676
+ case 0:
11677
+ streamId = mediaStreamInfo.streamId, metadataInTexture = mediaStreamInfo.metadataInTexture;
11678
+ if (!metadataInTexture) return [3 /*break*/, 2];
11679
+ return [4 /*yield*/, processMediaStreamWithMetadata(streamId, parameters.videoFrameHandler, notifyError)];
11680
+ case 1:
11681
+ _a = _d.sent();
11682
+ return [3 /*break*/, 4];
11683
+ case 2: return [4 /*yield*/, processMediaStream(streamId, parameters.videoFrameHandler, notifyError)];
11684
+ case 3:
11685
+ _a = _d.sent();
11686
+ _d.label = 4;
11687
+ case 4:
11688
+ generator = _a;
11689
+ // register the video track with processed frames back to the stream
11690
+ !inServerSideRenderingEnvironment() &&
11691
+ ((_c = (_b = window['chrome']) === null || _b === void 0 ? void 0 : _b.webview) === null || _c === void 0 ? void 0 : _c.registerTextureStream(streamId, generator));
11692
+ return [2 /*return*/];
11693
+ }
11694
+ });
11695
+ }); }, false);
11696
+ sendMessageToParent('video.mediaStream.registerForVideoFrame', [parameters.config]);
11697
+ }
11698
+ else if ((_b = runtime.supports.video) === null || _b === void 0 ? void 0 : _b.sharedFrame) {
11699
+ registerHandler('video.newVideoFrame', function (videoBufferData) {
11700
+ if (videoBufferData) {
11701
+ var timestamp_1 = videoBufferData.timestamp;
11702
+ parameters.videoBufferHandler(normalizedVideoBufferData(videoBufferData), function () {
11703
+ notifyVideoFrameProcessed(timestamp_1);
11704
+ }, notifyError);
11705
+ }
11706
+ }, false);
11707
+ sendMessageToParent('video.registerForVideoFrame', [parameters.config]);
10899
11708
  }
10900
- }, false);
10901
- sendMessageToParent('video.registerForVideoFrame', [parameters.config]);
11709
+ else {
11710
+ // should not happen if isSupported() is true
11711
+ throw errorNotSupportedOnPlatform;
11712
+ }
11713
+ }
10902
11714
  }
10903
11715
  videoEx.registerForVideoFrame = registerForVideoFrame;
11716
+ function normalizedVideoBufferData(videoBufferData) {
11717
+ videoBufferData['videoFrameBuffer'] = videoBufferData['videoFrameBuffer'] || videoBufferData['data'];
11718
+ delete videoBufferData['data'];
11719
+ return videoBufferData;
11720
+ }
10904
11721
  /**
10905
11722
  * @hidden
10906
11723
  * Video extension should call this to notify host that the current selected effect parameter changed.