@microsoft/teams-js 2.9.1 → 2.10.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.
package/dist/MicrosoftTeams.d.ts
CHANGED
@@ -2075,7 +2075,7 @@ export namespace videoEx {
|
|
2075
2075
|
* @internal
|
2076
2076
|
* Limited to Microsoft-internal use
|
2077
2077
|
*/
|
2078
|
-
interface VideoFrame extends video.
|
2078
|
+
interface VideoFrame extends video.VideoFrameData {
|
2079
2079
|
/**
|
2080
2080
|
* @hidden
|
2081
2081
|
* The model output if you passed in an {@linkcode VideoFrameConfig.audioInferenceModel}
|
@@ -6683,7 +6683,7 @@ export namespace video {
|
|
6683
6683
|
* Represents a video frame
|
6684
6684
|
* @beta
|
6685
6685
|
*/
|
6686
|
-
interface
|
6686
|
+
interface VideoFrameData {
|
6687
6687
|
/**
|
6688
6688
|
* Video frame width
|
6689
6689
|
*/
|
@@ -6695,7 +6695,7 @@ export namespace video {
|
|
6695
6695
|
/**
|
6696
6696
|
* Video frame buffer
|
6697
6697
|
*/
|
6698
|
-
|
6698
|
+
videoFrameBuffer: Uint8ClampedArray;
|
6699
6699
|
/**
|
6700
6700
|
* NV12 luma stride, valid only when video frame format is NV12
|
6701
6701
|
*/
|
@@ -6718,7 +6718,7 @@ export namespace video {
|
|
6718
6718
|
* @beta
|
6719
6719
|
*/
|
6720
6720
|
enum VideoFrameFormat {
|
6721
|
-
NV12 =
|
6721
|
+
NV12 = "NV12"
|
6722
6722
|
}
|
6723
6723
|
/**
|
6724
6724
|
* Video frame configuration supplied to the host to customize the generated video frame parameters, like format
|
@@ -6748,7 +6748,7 @@ export namespace video {
|
|
6748
6748
|
* Video frame call back function definition
|
6749
6749
|
* @beta
|
6750
6750
|
*/
|
6751
|
-
type VideoFrameCallback = (frame:
|
6751
|
+
type VideoFrameCallback = (frame: VideoFrameData, notifyVideoFrameProcessed: () => void, notifyError: (errorMessage: string) => void) => void;
|
6752
6752
|
/**
|
6753
6753
|
* Predefined failure reasons for preparing the selected video effect
|
6754
6754
|
* @beta
|
@@ -6801,6 +6801,56 @@ export namespace video {
|
|
6801
6801
|
*
|
6802
6802
|
*/
|
6803
6803
|
function isSupported(): boolean;
|
6804
|
+
/**
|
6805
|
+
* @beta
|
6806
|
+
* Namespace to get video frames from a media stream.
|
6807
|
+
* When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames instead of {@link registerForVideoFrame} to get the video frames, callback of {@link registerForVideoFrame} will be ignored when the host supports this capability.
|
6808
|
+
*/
|
6809
|
+
namespace mediaStream {
|
6810
|
+
/**
|
6811
|
+
* @beta
|
6812
|
+
* Checks if video.mediaStream capability is supported by the host
|
6813
|
+
* @returns boolean to represent whether the video.medisStream capability is supported
|
6814
|
+
*
|
6815
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
6816
|
+
*
|
6817
|
+
*/
|
6818
|
+
function isSupported(): boolean;
|
6819
|
+
/**
|
6820
|
+
* @beta
|
6821
|
+
* Video frame data extracted from the media stream. More properties may be added in the future.
|
6822
|
+
*/
|
6823
|
+
type MediaStreamFrameData = {
|
6824
|
+
/**
|
6825
|
+
* The video frame from the media stream.
|
6826
|
+
*/
|
6827
|
+
videoFrame: VideoFrame;
|
6828
|
+
};
|
6829
|
+
/**
|
6830
|
+
* @beta
|
6831
|
+
* Video effect change call back function definition.
|
6832
|
+
* The video app should resolve the promise to notify a successfully processed video frame.
|
6833
|
+
* The video app should reject the promise to notify a failure.
|
6834
|
+
*/
|
6835
|
+
type VideoFrameCallback = (receivedVideoFrame: MediaStreamFrameData) => Promise<VideoFrame>;
|
6836
|
+
/**
|
6837
|
+
* @beta
|
6838
|
+
* Register to read the video frames from the media stream provided by the host.
|
6839
|
+
* @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
|
6840
|
+
* @example
|
6841
|
+
* ```typescript
|
6842
|
+
* video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
|
6843
|
+
* const { videoFrame } = receivedVideoFrame;
|
6844
|
+
* try {
|
6845
|
+
* return await processVideoFrame(videoFrame);
|
6846
|
+
* } catch (error) {
|
6847
|
+
* throw error;
|
6848
|
+
* }
|
6849
|
+
* });
|
6850
|
+
* ```
|
6851
|
+
*/
|
6852
|
+
function registerForVideoFrame(frameCallback: VideoFrameCallback): void;
|
6853
|
+
}
|
6804
6854
|
}
|
6805
6855
|
|
6806
6856
|
/**
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -2155,7 +2155,7 @@ var _minRuntimeConfigToUninitialize = {
|
|
2155
2155
|
};
|
2156
2156
|
|
2157
2157
|
;// CONCATENATED MODULE: ./src/public/version.ts
|
2158
|
-
var version = "2.
|
2158
|
+
var version = "2.10.0-beta.0";
|
2159
2159
|
|
2160
2160
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
2161
2161
|
|
@@ -7790,6 +7790,53 @@ var profile;
|
|
7790
7790
|
})(profile || (profile = {}));
|
7791
7791
|
|
7792
7792
|
;// CONCATENATED MODULE: ./src/public/video.ts
|
7793
|
+
var video_assign = (undefined && undefined.__assign) || function () {
|
7794
|
+
video_assign = Object.assign || function(t) {
|
7795
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
7796
|
+
s = arguments[i];
|
7797
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7798
|
+
t[p] = s[p];
|
7799
|
+
}
|
7800
|
+
return t;
|
7801
|
+
};
|
7802
|
+
return video_assign.apply(this, arguments);
|
7803
|
+
};
|
7804
|
+
var video_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
7805
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
7806
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
7807
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
7808
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7809
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
7810
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
7811
|
+
});
|
7812
|
+
};
|
7813
|
+
var video_generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
7814
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
7815
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
7816
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
7817
|
+
function step(op) {
|
7818
|
+
if (f) throw new TypeError("Generator is already executing.");
|
7819
|
+
while (_) try {
|
7820
|
+
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;
|
7821
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
7822
|
+
switch (op[0]) {
|
7823
|
+
case 0: case 1: t = op; break;
|
7824
|
+
case 4: _.label++; return { value: op[1], done: false };
|
7825
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
7826
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
7827
|
+
default:
|
7828
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
7829
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
7830
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
7831
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
7832
|
+
if (t[2]) _.ops.pop();
|
7833
|
+
_.trys.pop(); continue;
|
7834
|
+
}
|
7835
|
+
op = body.call(thisArg, _);
|
7836
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
7837
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
7838
|
+
}
|
7839
|
+
};
|
7793
7840
|
|
7794
7841
|
|
7795
7842
|
|
@@ -7807,7 +7854,7 @@ var video;
|
|
7807
7854
|
*/
|
7808
7855
|
var VideoFrameFormat;
|
7809
7856
|
(function (VideoFrameFormat) {
|
7810
|
-
VideoFrameFormat[
|
7857
|
+
VideoFrameFormat["NV12"] = "NV12";
|
7811
7858
|
})(VideoFrameFormat = video.VideoFrameFormat || (video.VideoFrameFormat = {}));
|
7812
7859
|
/**
|
7813
7860
|
* Video effect change type enum
|
@@ -7851,10 +7898,14 @@ var video;
|
|
7851
7898
|
if (!isSupported()) {
|
7852
7899
|
throw errorNotSupportedOnPlatform;
|
7853
7900
|
}
|
7854
|
-
registerHandler('video.newVideoFrame',
|
7901
|
+
registerHandler('video.newVideoFrame',
|
7902
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
7903
|
+
function (videoFrame) {
|
7855
7904
|
if (videoFrame) {
|
7856
|
-
|
7857
|
-
|
7905
|
+
// The host may pass the VideoFrame with the old definition which has `data` instead of `videoFrameBuffer`
|
7906
|
+
var videoFrameData = video_assign(video_assign({}, videoFrame), { videoFrameBuffer: videoFrame.videoFrameBuffer || videoFrame.data });
|
7907
|
+
var timestamp_1 = videoFrameData.timestamp;
|
7908
|
+
frameCallback(videoFrameData, function () {
|
7858
7909
|
notifyVideoFrameProcessed(timestamp_1);
|
7859
7910
|
}, notifyError);
|
7860
7911
|
}
|
@@ -7930,6 +7981,165 @@ var video;
|
|
7930
7981
|
return ensureInitialized(runtime) && runtime.supports.video ? true : false;
|
7931
7982
|
}
|
7932
7983
|
video.isSupported = isSupported;
|
7984
|
+
/**
|
7985
|
+
* @beta
|
7986
|
+
* Namespace to get video frames from a media stream.
|
7987
|
+
* When the host supports this capability, developer should call {@link mediaStream.registerForVideoFrame} to get the video frames instead of {@link registerForVideoFrame} to get the video frames, callback of {@link registerForVideoFrame} will be ignored when the host supports this capability.
|
7988
|
+
*/
|
7989
|
+
var mediaStream;
|
7990
|
+
(function (mediaStream_1) {
|
7991
|
+
/**
|
7992
|
+
* @beta
|
7993
|
+
* Checks if video.mediaStream capability is supported by the host
|
7994
|
+
* @returns boolean to represent whether the video.medisStream capability is supported
|
7995
|
+
*
|
7996
|
+
* @throws Error if {@linkcode app.initialize} has not successfully completed
|
7997
|
+
*
|
7998
|
+
*/
|
7999
|
+
function isSupported() {
|
8000
|
+
var _a;
|
8001
|
+
return ensureInitialized(runtime) && isTextureStreamAvailable() && !!((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream);
|
8002
|
+
}
|
8003
|
+
mediaStream_1.isSupported = isSupported;
|
8004
|
+
function isTextureStreamAvailable() {
|
8005
|
+
var _a, _b, _c, _d;
|
8006
|
+
return (typeof window !== 'undefined' &&
|
8007
|
+
!!(((_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)));
|
8008
|
+
}
|
8009
|
+
/**
|
8010
|
+
* @beta
|
8011
|
+
* Register to read the video frames from the media stream provided by the host.
|
8012
|
+
* @param frameCallback - The callback to invoke when recieve a video frame from the media stream.
|
8013
|
+
* @example
|
8014
|
+
* ```typescript
|
8015
|
+
* video.mediaStream.registerForVideoFrame(async (receivedVideoFrame) => {
|
8016
|
+
* const { videoFrame } = receivedVideoFrame;
|
8017
|
+
* try {
|
8018
|
+
* return await processVideoFrame(videoFrame);
|
8019
|
+
* } catch (error) {
|
8020
|
+
* throw error;
|
8021
|
+
* }
|
8022
|
+
* });
|
8023
|
+
* ```
|
8024
|
+
*/
|
8025
|
+
function registerForVideoFrame(frameCallback) {
|
8026
|
+
var _this = this;
|
8027
|
+
ensureInitialized(runtime, FrameContexts.sidePanel);
|
8028
|
+
if (!isSupported()) {
|
8029
|
+
throw errorNotSupportedOnPlatform;
|
8030
|
+
}
|
8031
|
+
registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return video_awaiter(_this, void 0, void 0, function () {
|
8032
|
+
var streamId, videoTrack, generator;
|
8033
|
+
var _a, _b;
|
8034
|
+
return video_generator(this, function (_c) {
|
8035
|
+
switch (_c.label) {
|
8036
|
+
case 0:
|
8037
|
+
streamId = mediaStreamInfo.streamId;
|
8038
|
+
return [4 /*yield*/, getInputVideoTrack(streamId)];
|
8039
|
+
case 1:
|
8040
|
+
videoTrack = _c.sent();
|
8041
|
+
generator = createProcessedStreamGenerator(videoTrack, frameCallback);
|
8042
|
+
// register the video track with processed frames back to the stream:
|
8043
|
+
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));
|
8044
|
+
return [2 /*return*/];
|
8045
|
+
}
|
8046
|
+
});
|
8047
|
+
}); });
|
8048
|
+
sendMessageToParent('video.registerForVideoFrame', [
|
8049
|
+
{
|
8050
|
+
format: VideoFrameFormat.NV12,
|
8051
|
+
},
|
8052
|
+
]);
|
8053
|
+
}
|
8054
|
+
mediaStream_1.registerForVideoFrame = registerForVideoFrame;
|
8055
|
+
/**
|
8056
|
+
* Get the video track from the media stream gotten from chrome.webview.getTextureStream(streamId).
|
8057
|
+
*/
|
8058
|
+
function getInputVideoTrack(streamId) {
|
8059
|
+
return video_awaiter(this, void 0, void 0, function () {
|
8060
|
+
var chrome, mediaStream_2, tracks, error_1, errorMsg;
|
8061
|
+
return video_generator(this, function (_a) {
|
8062
|
+
switch (_a.label) {
|
8063
|
+
case 0:
|
8064
|
+
if (typeof window === 'undefined') {
|
8065
|
+
throw errorNotSupportedOnPlatform;
|
8066
|
+
}
|
8067
|
+
chrome = window['chrome'];
|
8068
|
+
_a.label = 1;
|
8069
|
+
case 1:
|
8070
|
+
_a.trys.push([1, 3, , 4]);
|
8071
|
+
return [4 /*yield*/, chrome.webview.getTextureStream(streamId)];
|
8072
|
+
case 2:
|
8073
|
+
mediaStream_2 = _a.sent();
|
8074
|
+
tracks = mediaStream_2.getVideoTracks();
|
8075
|
+
if (tracks.length === 0) {
|
8076
|
+
throw new Error("No video track in stream ".concat(streamId));
|
8077
|
+
}
|
8078
|
+
return [2 /*return*/, tracks[0]];
|
8079
|
+
case 3:
|
8080
|
+
error_1 = _a.sent();
|
8081
|
+
errorMsg = "Failed to get video track from stream ".concat(streamId, ", error: ").concat(error_1);
|
8082
|
+
notifyError(errorMsg);
|
8083
|
+
throw new Error(errorMsg);
|
8084
|
+
case 4: return [2 /*return*/];
|
8085
|
+
}
|
8086
|
+
});
|
8087
|
+
});
|
8088
|
+
}
|
8089
|
+
/**
|
8090
|
+
* The function to create a processed video track from the original video track.
|
8091
|
+
* It reads frames from the video track and pipes them to the video frame callback to process the frames.
|
8092
|
+
* The processed frames are then enqueued to the generator.
|
8093
|
+
* The generator can be registered back to the media stream so that the host can get the processed frames.
|
8094
|
+
*/
|
8095
|
+
function createProcessedStreamGenerator(videoTrack, videoFrameCallback) {
|
8096
|
+
var processor = new MediaStreamTrackProcessor({ track: videoTrack });
|
8097
|
+
var source = processor.readable;
|
8098
|
+
var generator = new MediaStreamTrackGenerator({ kind: 'video' });
|
8099
|
+
var sink = generator.writable;
|
8100
|
+
source
|
8101
|
+
.pipeThrough(new TransformStream({
|
8102
|
+
transform: function (originalFrame, controller) {
|
8103
|
+
return video_awaiter(this, void 0, void 0, function () {
|
8104
|
+
var timestamp, frameProcessedByApp, processedFrame, error_2;
|
8105
|
+
return video_generator(this, function (_a) {
|
8106
|
+
switch (_a.label) {
|
8107
|
+
case 0:
|
8108
|
+
timestamp = originalFrame.timestamp;
|
8109
|
+
if (!(timestamp !== null)) return [3 /*break*/, 5];
|
8110
|
+
_a.label = 1;
|
8111
|
+
case 1:
|
8112
|
+
_a.trys.push([1, 3, , 4]);
|
8113
|
+
return [4 /*yield*/, videoFrameCallback({ videoFrame: originalFrame })];
|
8114
|
+
case 2:
|
8115
|
+
frameProcessedByApp = _a.sent();
|
8116
|
+
processedFrame = new VideoFrame(frameProcessedByApp, {
|
8117
|
+
// we need the timestamp to be unchanged from the oirginal frame, so we explicitly set it here.
|
8118
|
+
timestamp: timestamp,
|
8119
|
+
});
|
8120
|
+
controller.enqueue(processedFrame);
|
8121
|
+
originalFrame.close();
|
8122
|
+
frameProcessedByApp.close();
|
8123
|
+
return [3 /*break*/, 4];
|
8124
|
+
case 3:
|
8125
|
+
error_2 = _a.sent();
|
8126
|
+
originalFrame.close();
|
8127
|
+
notifyError(error_2);
|
8128
|
+
return [3 /*break*/, 4];
|
8129
|
+
case 4: return [3 /*break*/, 6];
|
8130
|
+
case 5:
|
8131
|
+
notifyError('timestamp of the original video frame is null');
|
8132
|
+
_a.label = 6;
|
8133
|
+
case 6: return [2 /*return*/];
|
8134
|
+
}
|
8135
|
+
});
|
8136
|
+
});
|
8137
|
+
},
|
8138
|
+
}))
|
8139
|
+
.pipeTo(sink);
|
8140
|
+
return generator;
|
8141
|
+
}
|
8142
|
+
})(mediaStream = video.mediaStream || (video.mediaStream = {}));
|
7933
8143
|
})(video || (video = {})); //end of video namespace
|
7934
8144
|
|
7935
8145
|
;// CONCATENATED MODULE: ./src/public/search.ts
|