@microsoft/teams-js 2.10.0 → 2.10.1-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.
@@ -1815,9 +1815,7 @@ var teamsRuntimeConfig = {
1815
1815
  fullTrust: {},
1816
1816
  },
1817
1817
  teamsCore: {},
1818
- video: {
1819
- sharedFrame: {},
1820
- },
1818
+ video: {},
1821
1819
  },
1822
1820
  };
1823
1821
  var v1HostClientTypes = [
@@ -2001,7 +1999,7 @@ var _minRuntimeConfigToUninitialize = {
2001
1999
  };
2002
2000
 
2003
2001
  ;// CONCATENATED MODULE: ./src/public/version.ts
2004
- var version = "2.10.0";
2002
+ var version = "2.10.1-beta.0";
2005
2003
 
2006
2004
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2007
2005
 
@@ -7639,53 +7637,6 @@ var profile;
7639
7637
  })(profile || (profile = {}));
7640
7638
 
7641
7639
  ;// CONCATENATED MODULE: ./src/public/video.ts
7642
- var video_assign = (undefined && undefined.__assign) || function () {
7643
- video_assign = Object.assign || function(t) {
7644
- for (var s, i = 1, n = arguments.length; i < n; i++) {
7645
- s = arguments[i];
7646
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7647
- t[p] = s[p];
7648
- }
7649
- return t;
7650
- };
7651
- return video_assign.apply(this, arguments);
7652
- };
7653
- var video_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
7654
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7655
- return new (P || (P = Promise))(function (resolve, reject) {
7656
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7657
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7658
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7659
- step((generator = generator.apply(thisArg, _arguments || [])).next());
7660
- });
7661
- };
7662
- var video_generator = (undefined && undefined.__generator) || function (thisArg, body) {
7663
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
7664
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
7665
- function verb(n) { return function (v) { return step([n, v]); }; }
7666
- function step(op) {
7667
- if (f) throw new TypeError("Generator is already executing.");
7668
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
7669
- 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;
7670
- if (y = 0, t) op = [op[0] & 2, t.value];
7671
- switch (op[0]) {
7672
- case 0: case 1: t = op; break;
7673
- case 4: _.label++; return { value: op[1], done: false };
7674
- case 5: _.label++; y = op[1]; op = [0]; continue;
7675
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
7676
- default:
7677
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
7678
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
7679
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
7680
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
7681
- if (t[2]) _.ops.pop();
7682
- _.trys.pop(); continue;
7683
- }
7684
- op = body.call(thisArg, _);
7685
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
7686
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7687
- }
7688
- };
7689
7640
 
7690
7641
 
7691
7642
 
@@ -7703,7 +7654,7 @@ var video;
7703
7654
  */
7704
7655
  var VideoFrameFormat;
7705
7656
  (function (VideoFrameFormat) {
7706
- VideoFrameFormat["NV12"] = "NV12";
7657
+ VideoFrameFormat[VideoFrameFormat["NV12"] = 0] = "NV12";
7707
7658
  })(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
7708
7659
  /**
7709
7660
  * Video effect change type enum
@@ -7714,11 +7665,11 @@ var video;
7714
7665
  /**
7715
7666
  * Current video effect changed
7716
7667
  */
7717
- EffectChangeType["EffectChanged"] = "EffectChanged";
7668
+ EffectChangeType[EffectChangeType["EffectChanged"] = 0] = "EffectChanged";
7718
7669
  /**
7719
7670
  * Disable the video effect
7720
7671
  */
7721
- EffectChangeType["EffectDisabled"] = "EffectDisabled";
7672
+ EffectChangeType[EffectChangeType["EffectDisabled"] = 1] = "EffectDisabled";
7722
7673
  })(EffectChangeType = video.EffectChangeType || (video.EffectChangeType = {}));
7723
7674
  /**
7724
7675
  * Predefined failure reasons for preparing the selected video effect
@@ -7736,6 +7687,28 @@ var video;
7736
7687
  */
7737
7688
  EffectFailureReason["InitializationFailure"] = "InitializationFailure";
7738
7689
  })(EffectFailureReason = video.EffectFailureReason || (video.EffectFailureReason = {}));
7690
+ /**
7691
+ * Register to read the video frames in Permissions section
7692
+ * @beta
7693
+ * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
7694
+ * @param config - VideoFrameConfig to customize generated video frame parameters
7695
+ */
7696
+ function registerForVideoFrame(frameCallback, config) {
7697
+ ensureInitialized(runtime, FrameContexts.sidePanel);
7698
+ if (!isSupported()) {
7699
+ throw errorNotSupportedOnPlatform;
7700
+ }
7701
+ registerHandler('video.newVideoFrame', function (videoFrame) {
7702
+ if (videoFrame) {
7703
+ var timestamp_1 = videoFrame.timestamp;
7704
+ frameCallback(videoFrame, function () {
7705
+ notifyVideoFrameProcessed(timestamp_1);
7706
+ }, notifyError);
7707
+ }
7708
+ }, false);
7709
+ sendMessageToParent('video.registerForVideoFrame', [config]);
7710
+ }
7711
+ video.registerForVideoFrame = registerForVideoFrame;
7739
7712
  /**
7740
7713
  * Video extension should call this to notify host that the current selected effect parameter changed.
7741
7714
  * If it's pre-meeting, host will call videoEffectCallback immediately then use the videoEffect.
@@ -7776,6 +7749,14 @@ var video;
7776
7749
  sendMessageToParent('video.registerForVideoEffect');
7777
7750
  }
7778
7751
  video.registerForVideoEffect = registerForVideoEffect;
7752
+ /**
7753
+ * Sending notification to host finished the video frame processing, now host can render this video frame
7754
+ * or pass the video frame to next one in video pipeline
7755
+ * @beta
7756
+ */
7757
+ function notifyVideoFrameProcessed(timestamp) {
7758
+ sendMessageToParent('video.videoFrameProcessed', [timestamp]);
7759
+ }
7779
7760
  /**
7780
7761
  * Sending error notification to host
7781
7762
  * @beta
@@ -7796,220 +7777,6 @@ var video;
7796
7777
  return ensureInitialized(runtime) && runtime.supports.video ? true : false;
7797
7778
  }
7798
7779
  video.isSupported = isSupported;
7799
- /**
7800
- * @beta
7801
- * Namespace to get video frames from a media stream.
7802
- * When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames.
7803
- */
7804
- var mediaStream;
7805
- (function (mediaStream_1) {
7806
- /**
7807
- * @beta
7808
- * Checks if video.mediaStream capability is supported by the host
7809
- * @returns boolean to represent whether the video.medisStream capability is supported
7810
- *
7811
- * @throws Error if {@linkcode app.initialize} has not successfully completed
7812
- *
7813
- */
7814
- function isSupported() {
7815
- var _a;
7816
- return ensureInitialized(runtime) && isTextureStreamAvailable() && !!((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream);
7817
- }
7818
- mediaStream_1.isSupported = isSupported;
7819
- function isTextureStreamAvailable() {
7820
- var _a, _b, _c, _d;
7821
- return (typeof window !== 'undefined' &&
7822
- !!(((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.getTextureStream) && ((_d = (_c = window['chrome']) === null || _c === void 0 ? void 0 : _c.webview) === null || _d === void 0 ? void 0 : _d.registerTextureStream)));
7823
- }
7824
- /**
7825
- * @beta
7826
- * Register to read the video frames from the media stream provided by the host.
7827
- * @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
7828
- * @example
7829
- * ```typescript
7830
- * video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
7831
- * const { videoFrame } = receivedVideoFrame;
7832
- * try {
7833
- * return await processVideoFrame(videoFrame);
7834
- * } catch (error) {
7835
- * throw error;
7836
- * }
7837
- * });
7838
- * ```
7839
- */
7840
- function registerForVideoFrame(frameCallback) {
7841
- var _this = this;
7842
- ensureInitialized(runtime, FrameContexts.sidePanel);
7843
- if (!isSupported()) {
7844
- throw errorNotSupportedOnPlatform;
7845
- }
7846
- registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return video_awaiter(_this, void 0, void 0, function () {
7847
- var streamId, videoTrack, generator;
7848
- var _a, _b;
7849
- return video_generator(this, function (_c) {
7850
- switch (_c.label) {
7851
- case 0:
7852
- streamId = mediaStreamInfo.streamId;
7853
- return [4 /*yield*/, getInputVideoTrack(streamId)];
7854
- case 1:
7855
- videoTrack = _c.sent();
7856
- generator = createProcessedStreamGenerator(videoTrack, frameCallback);
7857
- // register the video track with processed frames back to the stream:
7858
- typeof window !== 'undefined' && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
7859
- return [2 /*return*/];
7860
- }
7861
- });
7862
- }); });
7863
- sendMessageToParent('video.mediaStream.registerForVideoFrame', [
7864
- {
7865
- format: VideoFrameFormat.NV12,
7866
- },
7867
- ]);
7868
- }
7869
- mediaStream_1.registerForVideoFrame = registerForVideoFrame;
7870
- /**
7871
- * Get the video track from the media stream gotten from chrome.webview.getTextureStream(streamId).
7872
- */
7873
- function getInputVideoTrack(streamId) {
7874
- return video_awaiter(this, void 0, void 0, function () {
7875
- var chrome, mediaStream_2, tracks, error_1, errorMsg;
7876
- return video_generator(this, function (_a) {
7877
- switch (_a.label) {
7878
- case 0:
7879
- if (typeof window === 'undefined') {
7880
- throw errorNotSupportedOnPlatform;
7881
- }
7882
- chrome = window['chrome'];
7883
- _a.label = 1;
7884
- case 1:
7885
- _a.trys.push([1, 3, , 4]);
7886
- return [4 /*yield*/, chrome.webview.getTextureStream(streamId)];
7887
- case 2:
7888
- mediaStream_2 = _a.sent();
7889
- tracks = mediaStream_2.getVideoTracks();
7890
- if (tracks.length === 0) {
7891
- throw new Error("No video track in stream ".concat(streamId));
7892
- }
7893
- return [2 /*return*/, tracks[0]];
7894
- case 3:
7895
- error_1 = _a.sent();
7896
- errorMsg = "Failed to get video track from stream ".concat(streamId, ", error: ").concat(error_1);
7897
- notifyError(errorMsg);
7898
- throw new Error(errorMsg);
7899
- case 4: return [2 /*return*/];
7900
- }
7901
- });
7902
- });
7903
- }
7904
- /**
7905
- * The function to create a processed video track from the original video track.
7906
- * It reads frames from the video track and pipes them to the video frame callback to process the frames.
7907
- * The processed frames are then enqueued to the generator.
7908
- * The generator can be registered back to the media stream so that the host can get the processed frames.
7909
- */
7910
- function createProcessedStreamGenerator(videoTrack, videoFrameCallback) {
7911
- var processor = new MediaStreamTrackProcessor({ track: videoTrack });
7912
- var source = processor.readable;
7913
- var generator = new MediaStreamTrackGenerator({ kind: 'video' });
7914
- var sink = generator.writable;
7915
- source
7916
- .pipeThrough(new TransformStream({
7917
- transform: function (originalFrame, controller) {
7918
- return video_awaiter(this, void 0, void 0, function () {
7919
- var timestamp, frameProcessedByApp, processedFrame, error_2;
7920
- return video_generator(this, function (_a) {
7921
- switch (_a.label) {
7922
- case 0:
7923
- timestamp = originalFrame.timestamp;
7924
- if (!(timestamp !== null)) return [3 /*break*/, 5];
7925
- _a.label = 1;
7926
- case 1:
7927
- _a.trys.push([1, 3, , 4]);
7928
- return [4 /*yield*/, videoFrameCallback({ videoFrame: originalFrame })];
7929
- case 2:
7930
- frameProcessedByApp = _a.sent();
7931
- processedFrame = new VideoFrame(frameProcessedByApp, {
7932
- // we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
7933
- timestamp: timestamp,
7934
- });
7935
- controller.enqueue(processedFrame);
7936
- originalFrame.close();
7937
- frameProcessedByApp.close();
7938
- return [3 /*break*/, 4];
7939
- case 3:
7940
- error_2 = _a.sent();
7941
- originalFrame.close();
7942
- notifyError(error_2);
7943
- return [3 /*break*/, 4];
7944
- case 4: return [3 /*break*/, 6];
7945
- case 5:
7946
- notifyError('timestamp of the original video frame is null');
7947
- _a.label = 6;
7948
- case 6: return [2 /*return*/];
7949
- }
7950
- });
7951
- });
7952
- },
7953
- }))
7954
- .pipeTo(sink);
7955
- return generator;
7956
- }
7957
- })(mediaStream = video.mediaStream || (video.mediaStream = {}));
7958
- /**
7959
- * @beta
7960
- * Namespace to get shared video framed.
7961
- * When the host supports this capability, developer should call {@link sharedFrame.registerForVideoFrame} to get the video frames.
7962
- */
7963
- var sharedFrame;
7964
- (function (sharedFrame) {
7965
- /**
7966
- * Checks if video.sharedFrame capability is supported by the host
7967
- * @beta
7968
- * @returns boolean to represent whether the video capability is supported
7969
- *
7970
- * @throws Error if {@linkcode app.initialize} has not successfully completed
7971
- *
7972
- */
7973
- function isSupported() {
7974
- var _a;
7975
- return ensureInitialized(runtime) && ((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.sharedFrame) ? true : false;
7976
- }
7977
- sharedFrame.isSupported = isSupported;
7978
- /**
7979
- * Sending notification to host finished the video frame processing, now host can render this video frame
7980
- * or pass the video frame to next one in video pipeline
7981
- * @beta
7982
- */
7983
- function notifyVideoFrameProcessed(timestamp) {
7984
- sendMessageToParent('video.videoFrameProcessed', [timestamp]);
7985
- }
7986
- /**
7987
- * Register to read the video frames in Permissions section
7988
- * @beta
7989
- * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
7990
- * @param config - VideoFrameConfig to customize generated video frame parameters
7991
- */
7992
- function registerForVideoFrame(frameCallback, config) {
7993
- ensureInitialized(runtime, FrameContexts.sidePanel);
7994
- if (!isSupported()) {
7995
- throw errorNotSupportedOnPlatform;
7996
- }
7997
- registerHandler('video.newVideoFrame',
7998
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7999
- function (videoFrame) {
8000
- if (videoFrame) {
8001
- // The host may pass the VideoFrame with the old definition which has `data` instead of `videoFrameBuffer`
8002
- var videoFrameData = video_assign(video_assign({}, videoFrame), { videoFrameBuffer: videoFrame.videoFrameBuffer || videoFrame.data });
8003
- var timestamp_1 = videoFrameData.timestamp;
8004
- frameCallback(videoFrameData, function () {
8005
- notifyVideoFrameProcessed(timestamp_1);
8006
- }, notifyError);
8007
- }
8008
- }, false);
8009
- sendMessageToParent('video.registerForVideoFrame', [config]);
8010
- }
8011
- sharedFrame.registerForVideoFrame = registerForVideoFrame;
8012
- })(sharedFrame = video.sharedFrame || (video.sharedFrame = {}));
8013
7780
  })(video || (video = {})); //end of video namespace
8014
7781
 
8015
7782
  ;// CONCATENATED MODULE: ./src/public/search.ts
@@ -10497,6 +10264,33 @@ var videoEx;
10497
10264
  ErrorLevel["Fatal"] = "fatal";
10498
10265
  ErrorLevel["Warn"] = "warn";
10499
10266
  })(ErrorLevel = videoEx.ErrorLevel || (videoEx.ErrorLevel = {}));
10267
+ /**
10268
+ * @hidden
10269
+ * Register to process video frames
10270
+ * @beta
10271
+ *
10272
+ * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
10273
+ * @param config - VideoFrameConfig to customize generated video frame parameters
10274
+ *
10275
+ * @internal
10276
+ * Limited to Microsoft-internal use
10277
+ */
10278
+ function registerForVideoFrame(frameCallback, config) {
10279
+ ensureInitialized(runtime, FrameContexts.sidePanel);
10280
+ if (!isSupported()) {
10281
+ throw errorNotSupportedOnPlatform;
10282
+ }
10283
+ registerHandler('video.newVideoFrame', function (videoFrame) {
10284
+ if (videoFrame) {
10285
+ var timestamp_1 = videoFrame.timestamp;
10286
+ frameCallback(videoFrame, function () {
10287
+ notifyVideoFrameProcessed(timestamp_1);
10288
+ }, notifyError);
10289
+ }
10290
+ }, false);
10291
+ sendMessageToParent('video.registerForVideoFrame', [config]);
10292
+ }
10293
+ videoEx.registerForVideoFrame = registerForVideoFrame;
10500
10294
  /**
10501
10295
  * @hidden
10502
10296
  * Video extension should call this to notify host that the current selected effect parameter changed.
@@ -10570,6 +10364,18 @@ var videoEx;
10570
10364
  return video.isSupported();
10571
10365
  }
10572
10366
  videoEx.isSupported = isSupported;
10367
+ /**
10368
+ * @hidden
10369
+ * Sending notification to host finished the video frame processing, now host can render this video frame
10370
+ * or pass the video frame to next one in video pipeline
10371
+ * @beta
10372
+ *
10373
+ * @internal
10374
+ * Limited to Microsoft-internal use
10375
+ */
10376
+ function notifyVideoFrameProcessed(timestamp) {
10377
+ sendMessageToParent('video.videoFrameProcessed', [timestamp]);
10378
+ }
10573
10379
  /**
10574
10380
  * @hidden
10575
10381
  * Sending error notification to host
@@ -10602,73 +10408,6 @@ var videoEx;
10602
10408
  notifyError(errorMessage, ErrorLevel.Fatal);
10603
10409
  }
10604
10410
  videoEx.notifyFatalError = notifyFatalError;
10605
- /**
10606
- * @hidden
10607
- * @internal
10608
- * @beta
10609
- * Namespace to get shared video framed.
10610
- * When the host supports this capability, developer should call {@link sharedFrame.registerForVideoFrame} to get the video frames.
10611
- */
10612
- var sharedFrame;
10613
- (function (sharedFrame) {
10614
- /**
10615
- * @hidden
10616
- *
10617
- * Checks if video.sharedFrame capability is supported by the host
10618
- * @beta
10619
- *
10620
- * @throws Error if {@linkcode app.initialize} has not successfully completed
10621
- *
10622
- * @returns boolean to represent whether the video.sharedFrame capability is supported
10623
- *
10624
- * @internal
10625
- * Limited to Microsoft-internal use
10626
- */
10627
- function isSupported() {
10628
- ensureInitialized(runtime);
10629
- return video.sharedFrame.isSupported();
10630
- }
10631
- sharedFrame.isSupported = isSupported;
10632
- /**
10633
- * @hidden
10634
- * Register to process video frames
10635
- * @beta
10636
- *
10637
- * @param frameCallback - The callback to invoke when registerForVideoFrame has completed
10638
- * @param config - VideoFrameConfig to customize generated video frame parameters
10639
- *
10640
- * @internal
10641
- * Limited to Microsoft-internal use
10642
- */
10643
- function registerForVideoFrame(frameCallback, config) {
10644
- ensureInitialized(runtime, FrameContexts.sidePanel);
10645
- if (!isSupported()) {
10646
- throw errorNotSupportedOnPlatform;
10647
- }
10648
- registerHandler('video.newVideoFrame', function (videoFrame) {
10649
- if (videoFrame) {
10650
- var timestamp_1 = videoFrame.timestamp;
10651
- frameCallback(videoFrame, function () {
10652
- notifyVideoFrameProcessed(timestamp_1);
10653
- }, notifyError);
10654
- }
10655
- }, false);
10656
- sendMessageToParent('video.registerForVideoFrame', [config]);
10657
- }
10658
- sharedFrame.registerForVideoFrame = registerForVideoFrame;
10659
- /**
10660
- * @hidden
10661
- * Sending notification to host finished the video frame processing, now host can render this video frame
10662
- * or pass the video frame to next one in video pipeline
10663
- * @beta
10664
- *
10665
- * @internal
10666
- * Limited to Microsoft-internal use
10667
- */
10668
- function notifyVideoFrameProcessed(timestamp) {
10669
- sendMessageToParent('video.videoFrameProcessed', [timestamp]);
10670
- }
10671
- })(sharedFrame = videoEx.sharedFrame || (videoEx.sharedFrame = {}));
10672
10411
  })(videoEx || (videoEx = {}));
10673
10412
 
10674
10413
  ;// CONCATENATED MODULE: ./src/private/index.ts