@microsoft/teams-js 2.8.0 → 2.9.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.
@@ -6690,11 +6690,27 @@ export namespace video {
6690
6690
  * @beta
6691
6691
  */
6692
6692
  type VideoFrameCallback = (frame: VideoFrame, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
6693
+ /**
6694
+ * Predefined failure reasons for preparing the selected video effect
6695
+ * @beta
6696
+ */
6697
+ enum EffectFailureReason {
6698
+ /**
6699
+ * A wrong effect id is provide.
6700
+ * Use this reason when the effect id is not found or empty, this may indicate a mismatch between the app and its manifest or a bug of the host.
6701
+ */
6702
+ InvalidEffectId = "InvalidEffectId",
6703
+ /**
6704
+ * The effect can't be initialized
6705
+ */
6706
+ InitializationFailure = "InitializationFailure"
6707
+ }
6693
6708
  /**
6694
6709
  * Video effect change call back function definition
6710
+ * Return a Promise which will be resolved when the effect is prepared, or throw an {@link EffectFailureReason} on error.
6695
6711
  * @beta
6696
6712
  */
6697
- type VideoEffectCallBack = (effectId: string | undefined) => void;
6713
+ type VideoEffectCallback = (effectId: string | undefined) => Promise<void>;
6698
6714
  /**
6699
6715
  * Register to read the video frames in Permissions section
6700
6716
  * @beta
@@ -6712,11 +6728,11 @@ export namespace video {
6712
6728
  */
6713
6729
  function notifySelectedVideoEffectChanged(effectChangeType: EffectChangeType, effectId: string | undefined): void;
6714
6730
  /**
6715
- * Register the video effect callback, host uses this to notify the video extension the new video effect will by applied
6731
+ * Register a callback to be notified when a new video effect is applied.
6716
6732
  * @beta
6717
- * @param callback - The VideoEffectCallback to invoke when registerForVideoEffect has completed
6733
+ * @param callback - Function to be called when new video effect is applied.
6718
6734
  */
6719
- function registerForVideoEffect(callback: VideoEffectCallBack): void;
6735
+ function registerForVideoEffect(callback: VideoEffectCallback): void;
6720
6736
  /**
6721
6737
  * Checks if video capability is supported by the host
6722
6738
  * @beta
@@ -2151,7 +2151,7 @@ var _minRuntimeConfigToUninitialize = {
2151
2151
  };
2152
2152
 
2153
2153
  ;// CONCATENATED MODULE: ./src/public/version.ts
2154
- var version = "2.8.0";
2154
+ var version = "2.9.0-beta.0";
2155
2155
 
2156
2156
  ;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
2157
2157
 
@@ -7800,6 +7800,22 @@ var video;
7800
7800
  */
7801
7801
  EffectChangeType[EffectChangeType["EffectDisabled"] = 1] = "EffectDisabled";
7802
7802
  })(EffectChangeType = video.EffectChangeType || (video.EffectChangeType = {}));
7803
+ /**
7804
+ * Predefined failure reasons for preparing the selected video effect
7805
+ * @beta
7806
+ */
7807
+ var EffectFailureReason;
7808
+ (function (EffectFailureReason) {
7809
+ /**
7810
+ * A wrong effect id is provide.
7811
+ * Use this reason when the effect id is not found or empty, this may indicate a mismatch between the app and its manifest or a bug of the host.
7812
+ */
7813
+ EffectFailureReason["InvalidEffectId"] = "InvalidEffectId";
7814
+ /**
7815
+ * The effect can't be initialized
7816
+ */
7817
+ EffectFailureReason["InitializationFailure"] = "InitializationFailure";
7818
+ })(EffectFailureReason = video.EffectFailureReason || (video.EffectFailureReason = {}));
7803
7819
  /**
7804
7820
  * Register to read the video frames in Permissions section
7805
7821
  * @beta
@@ -7839,16 +7855,26 @@ var video;
7839
7855
  }
7840
7856
  video.notifySelectedVideoEffectChanged = notifySelectedVideoEffectChanged;
7841
7857
  /**
7842
- * Register the video effect callback, host uses this to notify the video extension the new video effect will by applied
7858
+ * Register a callback to be notified when a new video effect is applied.
7843
7859
  * @beta
7844
- * @param callback - The VideoEffectCallback to invoke when registerForVideoEffect has completed
7860
+ * @param callback - Function to be called when new video effect is applied.
7845
7861
  */
7846
7862
  function registerForVideoEffect(callback) {
7847
7863
  ensureInitialized(runtime, FrameContexts.sidePanel);
7848
7864
  if (!isSupported()) {
7849
7865
  throw errorNotSupportedOnPlatform;
7850
7866
  }
7851
- registerHandler('video.effectParameterChange', callback, false);
7867
+ var effectParameterChangeHandler = function (effectId) {
7868
+ callback(effectId)
7869
+ .then(function () {
7870
+ sendMessageToParent('video.videoEffectReadiness', [true, effectId]);
7871
+ })
7872
+ .catch(function (reason) {
7873
+ var validReason = reason in EffectFailureReason ? reason : EffectFailureReason.InitializationFailure;
7874
+ sendMessageToParent('video.videoEffectReadiness', [false, effectId, validReason]);
7875
+ });
7876
+ };
7877
+ registerHandler('video.effectParameterChange', effectParameterChangeHandler, false);
7852
7878
  sendMessageToParent('video.registerForVideoEffect');
7853
7879
  }
7854
7880
  video.registerForVideoEffect = registerForVideoEffect;