@microsoft/teams-js 2.15.0-beta.2 → 2.15.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/README.md +4 -4
- package/dist/MicrosoftTeams.d.ts +2 -2
- package/dist/MicrosoftTeams.js +119 -62
- package/dist/MicrosoftTeams.js.map +1 -1
- package/dist/MicrosoftTeams.min.js +1 -1
- package/dist/MicrosoftTeams.min.js.map +1 -1
- package/package.json +34 -1
package/README.md
CHANGED
@@ -24,7 +24,7 @@ To install the stable [version](https://learn.microsoft.com/javascript/api/overv
|
|
24
24
|
|
25
25
|
### Production
|
26
26
|
|
27
|
-
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.
|
27
|
+
You can reference these files directly [from here](https://res.cdn.office.net/teams-js/2.15.0/js/MicrosoftTeams.min.js) or point your package manager at them.
|
28
28
|
|
29
29
|
## Usage
|
30
30
|
|
@@ -45,13 +45,13 @@ Reference the library inside of your `.html` page using:
|
|
45
45
|
```html
|
46
46
|
<!-- Microsoft Teams JavaScript API (via CDN) -->
|
47
47
|
<script
|
48
|
-
src="https://res.cdn.office.net/teams-js/2.
|
49
|
-
integrity="sha384
|
48
|
+
src="https://res.cdn.office.net/teams-js/2.15.0/js/MicrosoftTeams.min.js"
|
49
|
+
integrity="sha384-fTDbgjG+RKtC2IyKV3r1o0xdxY4oV1v53uPHwPJTmTddvDm2ats9JWRAbtouZx4C"
|
50
50
|
crossorigin="anonymous"
|
51
51
|
></script>
|
52
52
|
|
53
53
|
<!-- Microsoft Teams JavaScript API (via npm) -->
|
54
|
-
<script src="node_modules/@microsoft/teams-js@2.
|
54
|
+
<script src="node_modules/@microsoft/teams-js@2.15.0/dist/MicrosoftTeams.min.js"></script>
|
55
55
|
|
56
56
|
<!-- Microsoft Teams JavaScript API (via local) -->
|
57
57
|
<script src="MicrosoftTeams.min.js"></script>
|
package/dist/MicrosoftTeams.d.ts
CHANGED
@@ -8678,7 +8678,7 @@ export namespace marketplace {
|
|
8678
8678
|
* @hidden
|
8679
8679
|
* Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
|
8680
8680
|
*/
|
8681
|
-
export function processMediaStream(streamId: string, videoFrameHandler: video.VideoFrameHandler, notifyError: (string: any) => void, videoPerformanceMonitor?: VideoPerformanceMonitor): Promise<
|
8681
|
+
export function processMediaStream(streamId: string, videoFrameHandler: video.VideoFrameHandler, notifyError: (string: any) => void, videoPerformanceMonitor?: VideoPerformanceMonitor): Promise<void>;
|
8682
8682
|
/**
|
8683
8683
|
* @hidden
|
8684
8684
|
* Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
|
@@ -8687,7 +8687,7 @@ export function processMediaStream(streamId: string, videoFrameHandler: video.Vi
|
|
8687
8687
|
* @internal
|
8688
8688
|
* Limited to Microsoft-internal use
|
8689
8689
|
*/
|
8690
|
-
export function processMediaStreamWithMetadata(streamId: string, videoFrameHandler: videoEx.VideoFrameHandler, notifyError: (string: any) => void, videoPerformanceMonitor?: VideoPerformanceMonitor): Promise<
|
8690
|
+
export function processMediaStreamWithMetadata(streamId: string, videoFrameHandler: videoEx.VideoFrameHandler, notifyError: (string: any) => void, videoPerformanceMonitor?: VideoPerformanceMonitor): Promise<void>;
|
8691
8691
|
/**
|
8692
8692
|
* @hidden
|
8693
8693
|
* Video effect change call back function definition
|
package/dist/MicrosoftTeams.js
CHANGED
@@ -1478,6 +1478,7 @@ var teamsMinAdaptiveCardVersion = {
|
|
1478
1478
|
|
1479
1479
|
|
1480
1480
|
|
1481
|
+
|
1481
1482
|
/**
|
1482
1483
|
* @param pattern - reference pattern
|
1483
1484
|
* @param host - candidate string
|
@@ -1504,6 +1505,7 @@ function validateHostAgainstPattern(pattern, host) {
|
|
1504
1505
|
}
|
1505
1506
|
return false;
|
1506
1507
|
}
|
1508
|
+
var validateOriginLogger = getLogger('validateOrigin');
|
1507
1509
|
/**
|
1508
1510
|
* @internal
|
1509
1511
|
* Limited to Microsoft-internal use
|
@@ -1511,6 +1513,7 @@ function validateHostAgainstPattern(pattern, host) {
|
|
1511
1513
|
function validateOrigin(messageOrigin) {
|
1512
1514
|
// Check whether the url is in the pre-known allowlist or supplied by user
|
1513
1515
|
if (!isValidHttpsURL(messageOrigin)) {
|
1516
|
+
validateOriginLogger('Origin %s is invalid because it is not using https protocol. Protocol being used: %s', messageOrigin, messageOrigin.protocol);
|
1514
1517
|
return false;
|
1515
1518
|
}
|
1516
1519
|
var messageOriginHost = messageOrigin.host;
|
@@ -1524,6 +1527,7 @@ function validateOrigin(messageOrigin) {
|
|
1524
1527
|
return true;
|
1525
1528
|
}
|
1526
1529
|
}
|
1530
|
+
validateOriginLogger('Origin %s is invalid because it is not an origin approved by this library or included in the call to app.initialize.\nOrigins approved by this library: %o\nOrigins included in app.initialize: %o', messageOrigin, validOrigins, GlobalVars.additionalValidOrigins);
|
1527
1531
|
return false;
|
1528
1532
|
}
|
1529
1533
|
/**
|
@@ -1880,6 +1884,27 @@ function getBase64StringFromBlob(blob) {
|
|
1880
1884
|
reader.readAsDataURL(blob);
|
1881
1885
|
});
|
1882
1886
|
}
|
1887
|
+
/**
|
1888
|
+
* Returns an SSR safe reference to the window object
|
1889
|
+
* @returns Window object reference
|
1890
|
+
*/
|
1891
|
+
function ssrSafeWindow() {
|
1892
|
+
if (!inServerSideRenderingEnvironment()) {
|
1893
|
+
return window;
|
1894
|
+
}
|
1895
|
+
else {
|
1896
|
+
// This should NEVER actually be written.
|
1897
|
+
// If you EVER see this error in ANY log file, something has gone horribly wrong and a bug needs to be filed.
|
1898
|
+
throw new Error('window object undefined at SSR check');
|
1899
|
+
}
|
1900
|
+
}
|
1901
|
+
/**
|
1902
|
+
* Checks if running in a Server Side Environment
|
1903
|
+
* @returns True if running in a Server Side Environment
|
1904
|
+
*/
|
1905
|
+
function inServerSideRenderingEnvironment() {
|
1906
|
+
return typeof window === 'undefined';
|
1907
|
+
}
|
1883
1908
|
|
1884
1909
|
;// CONCATENATED MODULE: ./src/public/runtime.ts
|
1885
1910
|
/* eslint-disable @typescript-eslint/ban-types */
|
@@ -2178,7 +2203,7 @@ var _minRuntimeConfigToUninitialize = {
|
|
2178
2203
|
* @hidden
|
2179
2204
|
* Package version.
|
2180
2205
|
*/
|
2181
|
-
var version = "2.15.0
|
2206
|
+
var version = "2.15.0";
|
2182
2207
|
|
2183
2208
|
;// CONCATENATED MODULE: ./src/internal/internalAPIs.ts
|
2184
2209
|
|
@@ -2315,11 +2340,6 @@ function processAdditionalValidOrigins(validMessageOrigins) {
|
|
2315
2340
|
GlobalVars.additionalValidOrigins = combinedOriginUrls;
|
2316
2341
|
}
|
2317
2342
|
|
2318
|
-
;// CONCATENATED MODULE: ./src/private/inServerSideRenderingEnvironment.ts
|
2319
|
-
function inServerSideRenderingEnvironment() {
|
2320
|
-
return typeof window === 'undefined';
|
2321
|
-
}
|
2322
|
-
|
2323
2343
|
;// CONCATENATED MODULE: ./src/public/authentication.ts
|
2324
2344
|
|
2325
2345
|
|
@@ -2327,6 +2347,7 @@ function inServerSideRenderingEnvironment() {
|
|
2327
2347
|
|
2328
2348
|
|
2329
2349
|
|
2350
|
+
|
2330
2351
|
/**
|
2331
2352
|
* Namespace to interact with the authentication-specific part of the SDK.
|
2332
2353
|
*
|
@@ -2683,7 +2704,7 @@ var authentication;
|
|
2683
2704
|
var link = document.createElement('a');
|
2684
2705
|
link.href = decodeURIComponent(callbackUrl);
|
2685
2706
|
if (link.host &&
|
2686
|
-
link.host !==
|
2707
|
+
link.host !== ssrSafeWindow().location.host &&
|
2687
2708
|
link.host === 'outlook.office.com' &&
|
2688
2709
|
link.search.indexOf('client_type=Win32_Outlook') > -1) {
|
2689
2710
|
if (key && key === 'result') {
|
@@ -3339,6 +3360,7 @@ var menus;
|
|
3339
3360
|
|
3340
3361
|
|
3341
3362
|
|
3363
|
+
|
3342
3364
|
/**
|
3343
3365
|
* Namespace containing the set of APIs that support Teams-specific functionalities.
|
3344
3366
|
*/
|
@@ -3370,14 +3392,7 @@ var teamsCore;
|
|
3370
3392
|
* default print handler
|
3371
3393
|
*/
|
3372
3394
|
function print() {
|
3373
|
-
|
3374
|
-
window.print();
|
3375
|
-
}
|
3376
|
-
else {
|
3377
|
-
// This codepath only exists to enable compilation in a server-side redered environment. In standard usage, the window object should never be undefined so this code path should never run.
|
3378
|
-
// If this error has actually been thrown, something has gone very wrong and it is a bug
|
3379
|
-
throw new Error('window object undefined at print call');
|
3380
|
-
}
|
3395
|
+
ssrSafeWindow().print();
|
3381
3396
|
}
|
3382
3397
|
teamsCore.print = print;
|
3383
3398
|
/**
|
@@ -3490,7 +3505,6 @@ var teamsCore;
|
|
3490
3505
|
|
3491
3506
|
|
3492
3507
|
|
3493
|
-
|
3494
3508
|
/**
|
3495
3509
|
* Namespace to interact with app initialization and lifecycle.
|
3496
3510
|
*/
|
@@ -4869,7 +4883,7 @@ function initializeCommunication(validMessageOrigins) {
|
|
4869
4883
|
CommunicationPrivate.messageListener = function (evt) { return processMessage(evt); };
|
4870
4884
|
// If we are in an iframe, our parent window is the one hosting us (i.e., window.parent); otherwise,
|
4871
4885
|
// it's the window that opened us (i.e., window.opener)
|
4872
|
-
Communication.currentWindow = Communication.currentWindow ||
|
4886
|
+
Communication.currentWindow = Communication.currentWindow || ssrSafeWindow();
|
4873
4887
|
Communication.parentWindow =
|
4874
4888
|
Communication.currentWindow.parent !== Communication.currentWindow.self
|
4875
4889
|
? Communication.currentWindow.parent
|
@@ -5061,6 +5075,7 @@ function sendMessageToParentHelper(actionName, args) {
|
|
5061
5075
|
}
|
5062
5076
|
return request;
|
5063
5077
|
}
|
5078
|
+
var processMessageLogger = communicationLogger.extend('processMessage');
|
5064
5079
|
/**
|
5065
5080
|
* @internal
|
5066
5081
|
* Limited to Microsoft-internal use
|
@@ -5068,13 +5083,16 @@ function sendMessageToParentHelper(actionName, args) {
|
|
5068
5083
|
function processMessage(evt) {
|
5069
5084
|
// Process only if we received a valid message
|
5070
5085
|
if (!evt || !evt.data || typeof evt.data !== 'object') {
|
5086
|
+
processMessageLogger('Unrecognized message format received by app, message being ignored. Message: %o', evt);
|
5071
5087
|
return;
|
5072
5088
|
}
|
5073
5089
|
// Process only if the message is coming from a different window and a valid origin
|
5074
|
-
// valid origins are either a pre-known
|
5090
|
+
// valid origins are either a pre-known origin or one specified by the app developer
|
5091
|
+
// in their call to app.initialize
|
5075
5092
|
var messageSource = evt.source || (evt.originalEvent && evt.originalEvent.source);
|
5076
5093
|
var messageOrigin = evt.origin || (evt.originalEvent && evt.originalEvent.origin);
|
5077
5094
|
if (!shouldProcessMessage(messageSource, messageOrigin)) {
|
5095
|
+
processMessageLogger('Message being ignored by app because it is either coming from the current window or a different window with an invalid origin');
|
5078
5096
|
return;
|
5079
5097
|
}
|
5080
5098
|
// Update our parent and child relationships based on this message
|
@@ -5087,6 +5105,7 @@ function processMessage(evt) {
|
|
5087
5105
|
handleChildMessage(evt);
|
5088
5106
|
}
|
5089
5107
|
}
|
5108
|
+
var shouldProcessMessageLogger = communicationLogger.extend('shouldProcessMessage');
|
5090
5109
|
/**
|
5091
5110
|
* @hidden
|
5092
5111
|
* Validates the message source and origin, if it should be processed
|
@@ -5098,6 +5117,7 @@ function shouldProcessMessage(messageSource, messageOrigin) {
|
|
5098
5117
|
// Process if message source is a different window and if origin is either in
|
5099
5118
|
// Teams' pre-known whitelist or supplied as valid origin by user during initialization
|
5100
5119
|
if (Communication.currentWindow && messageSource === Communication.currentWindow) {
|
5120
|
+
shouldProcessMessageLogger('Should not process message because it is coming from the current window');
|
5101
5121
|
return false;
|
5102
5122
|
}
|
5103
5123
|
else if (Communication.currentWindow &&
|
@@ -5107,7 +5127,11 @@ function shouldProcessMessage(messageSource, messageOrigin) {
|
|
5107
5127
|
return true;
|
5108
5128
|
}
|
5109
5129
|
else {
|
5110
|
-
|
5130
|
+
var isOriginValid = validateOrigin(new URL(messageOrigin));
|
5131
|
+
if (!isOriginValid) {
|
5132
|
+
shouldProcessMessageLogger('Message has an invalid origin of %s', messageOrigin);
|
5133
|
+
}
|
5134
|
+
return isOriginValid;
|
5111
5135
|
}
|
5112
5136
|
}
|
5113
5137
|
/**
|
@@ -6775,6 +6799,7 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
|
|
6775
6799
|
|
6776
6800
|
|
6777
6801
|
|
6802
|
+
|
6778
6803
|
/**
|
6779
6804
|
* Interact with the system clipboard
|
6780
6805
|
*
|
@@ -6836,7 +6861,7 @@ var clipboard;
|
|
6836
6861
|
if (!isSupported()) {
|
6837
6862
|
throw errorNotSupportedOnPlatform;
|
6838
6863
|
}
|
6839
|
-
if (!isHostClientMobile()) return [3 /*break*/, 2];
|
6864
|
+
if (!(isHostClientMobile() || GlobalVars.hostClientType === HostClientType.macos)) return [3 /*break*/, 2];
|
6840
6865
|
_b = (_a = JSON).parse;
|
6841
6866
|
return [4 /*yield*/, sendAndHandleSdkError('clipboard.readFromClipboard')];
|
6842
6867
|
case 1:
|
@@ -8427,14 +8452,20 @@ var videoUtils_generator = (undefined && undefined.__generator) || function (thi
|
|
8427
8452
|
* Create a MediaStreamTrack from the media stream with the given streamId and processed by videoFrameHandler.
|
8428
8453
|
*/
|
8429
8454
|
function processMediaStream(streamId, videoFrameHandler, notifyError, videoPerformanceMonitor) {
|
8455
|
+
var _a, _b;
|
8430
8456
|
return videoUtils_awaiter(this, void 0, void 0, function () {
|
8431
|
-
var
|
8432
|
-
return videoUtils_generator(this, function (
|
8433
|
-
switch (
|
8457
|
+
var generator, _c;
|
8458
|
+
return videoUtils_generator(this, function (_d) {
|
8459
|
+
switch (_d.label) {
|
8434
8460
|
case 0:
|
8435
|
-
|
8461
|
+
generator = createProcessedStreamGeneratorWithoutSource();
|
8462
|
+
!inServerSideRenderingEnvironment() && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
|
8463
|
+
_c = pipeVideoSourceToGenerator;
|
8436
8464
|
return [4 /*yield*/, getInputVideoTrack(streamId, notifyError, videoPerformanceMonitor)];
|
8437
|
-
case 1:
|
8465
|
+
case 1:
|
8466
|
+
_c.apply(void 0, [_d.sent(), new DefaultTransformer(notifyError, videoFrameHandler),
|
8467
|
+
generator.writable]);
|
8468
|
+
return [2 /*return*/];
|
8438
8469
|
}
|
8439
8470
|
});
|
8440
8471
|
});
|
@@ -8448,14 +8479,20 @@ function processMediaStream(streamId, videoFrameHandler, notifyError, videoPerfo
|
|
8448
8479
|
* Limited to Microsoft-internal use
|
8449
8480
|
*/
|
8450
8481
|
function processMediaStreamWithMetadata(streamId, videoFrameHandler, notifyError, videoPerformanceMonitor) {
|
8482
|
+
var _a, _b;
|
8451
8483
|
return videoUtils_awaiter(this, void 0, void 0, function () {
|
8452
|
-
var
|
8453
|
-
return videoUtils_generator(this, function (
|
8454
|
-
switch (
|
8484
|
+
var generator, _c;
|
8485
|
+
return videoUtils_generator(this, function (_d) {
|
8486
|
+
switch (_d.label) {
|
8455
8487
|
case 0:
|
8456
|
-
|
8488
|
+
generator = createProcessedStreamGeneratorWithoutSource();
|
8489
|
+
!inServerSideRenderingEnvironment() && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
|
8490
|
+
_c = pipeVideoSourceToGenerator;
|
8457
8491
|
return [4 /*yield*/, getInputVideoTrack(streamId, notifyError, videoPerformanceMonitor)];
|
8458
|
-
case 1:
|
8492
|
+
case 1:
|
8493
|
+
_c.apply(void 0, [_d.sent(), new TransformerWithMetadata(notifyError, videoFrameHandler),
|
8494
|
+
generator.writable]);
|
8495
|
+
return [2 /*return*/];
|
8459
8496
|
}
|
8460
8497
|
});
|
8461
8498
|
});
|
@@ -8472,7 +8509,7 @@ function getInputVideoTrack(streamId, notifyError, videoPerformanceMonitor) {
|
|
8472
8509
|
if (inServerSideRenderingEnvironment()) {
|
8473
8510
|
throw errorNotSupportedOnPlatform;
|
8474
8511
|
}
|
8475
|
-
chrome =
|
8512
|
+
chrome = ssrSafeWindow()['chrome'];
|
8476
8513
|
_a.label = 1;
|
8477
8514
|
case 1:
|
8478
8515
|
_a.trys.push([1, 3, , 4]);
|
@@ -8497,23 +8534,30 @@ function getInputVideoTrack(streamId, notifyError, videoPerformanceMonitor) {
|
|
8497
8534
|
});
|
8498
8535
|
}
|
8499
8536
|
/**
|
8500
|
-
* The function to create a
|
8501
|
-
*
|
8502
|
-
* The processed frames are then enqueued to the generator.
|
8537
|
+
* The function to create a MediaStreamTrack generator.
|
8538
|
+
* The generator can then get the processed frames as media stream source.
|
8503
8539
|
* The generator can be registered back to the media stream so that the host can get the processed frames.
|
8504
8540
|
*/
|
8505
|
-
function
|
8541
|
+
function createProcessedStreamGeneratorWithoutSource() {
|
8506
8542
|
if (inServerSideRenderingEnvironment()) {
|
8507
8543
|
throw errorNotSupportedOnPlatform;
|
8508
8544
|
}
|
8509
|
-
var
|
8545
|
+
var MediaStreamTrackGenerator = window['MediaStreamTrackGenerator'];
|
8546
|
+
if (!MediaStreamTrackGenerator) {
|
8547
|
+
throw errorNotSupportedOnPlatform;
|
8548
|
+
}
|
8549
|
+
return new MediaStreamTrackGenerator({ kind: 'video' });
|
8550
|
+
}
|
8551
|
+
/**
|
8552
|
+
* The function to create a processed video track from the original video track.
|
8553
|
+
* It reads frames from the video track and pipes them to the video frame callback to process the frames.
|
8554
|
+
* The processed frames are then enqueued to the generator.
|
8555
|
+
*/
|
8556
|
+
function pipeVideoSourceToGenerator(videoTrack, transformer, sink) {
|
8557
|
+
var MediaStreamTrackProcessor = ssrSafeWindow()['MediaStreamTrackProcessor'];
|
8510
8558
|
var processor = new MediaStreamTrackProcessor({ track: videoTrack });
|
8511
8559
|
var source = processor.readable;
|
8512
|
-
var MediaStreamTrackGenerator = window['MediaStreamTrackGenerator'];
|
8513
|
-
var generator = new MediaStreamTrackGenerator({ kind: 'video' });
|
8514
|
-
var sink = generator.writable;
|
8515
8560
|
source.pipeThrough(new TransformStream(transformer)).pipeTo(sink);
|
8516
|
-
return generator;
|
8517
8561
|
}
|
8518
8562
|
/**
|
8519
8563
|
* @hidden
|
@@ -9070,18 +9114,15 @@ var video;
|
|
9070
9114
|
throw errorNotSupportedOnPlatform;
|
9071
9115
|
}
|
9072
9116
|
registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return video_awaiter(_this, void 0, void 0, function () {
|
9073
|
-
var streamId, monitoredVideoFrameHandler
|
9074
|
-
|
9075
|
-
|
9076
|
-
switch (_c.label) {
|
9117
|
+
var streamId, monitoredVideoFrameHandler;
|
9118
|
+
return video_generator(this, function (_a) {
|
9119
|
+
switch (_a.label) {
|
9077
9120
|
case 0:
|
9078
9121
|
streamId = mediaStreamInfo.streamId;
|
9079
9122
|
monitoredVideoFrameHandler = createMonitoredVideoFrameHandler(videoFrameHandler, videoPerformanceMonitor);
|
9080
9123
|
return [4 /*yield*/, processMediaStream(streamId, monitoredVideoFrameHandler, notifyError, videoPerformanceMonitor)];
|
9081
9124
|
case 1:
|
9082
|
-
|
9083
|
-
// register the video track with processed frames back to the stream:
|
9084
|
-
!inServerSideRenderingEnvironment() && ((_b = (_a = window['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.registerTextureStream(streamId, generator));
|
9125
|
+
_a.sent();
|
9085
9126
|
return [2 /*return*/];
|
9086
9127
|
}
|
9087
9128
|
});
|
@@ -9143,8 +9184,7 @@ var video;
|
|
9143
9184
|
}
|
9144
9185
|
function isTextureStreamAvailable() {
|
9145
9186
|
var _a, _b, _c, _d;
|
9146
|
-
return (
|
9147
|
-
!!(((_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)));
|
9187
|
+
return !!(((_b = (_a = ssrSafeWindow()['chrome']) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.getTextureStream) && ((_d = (_c = ssrSafeWindow()['chrome']) === null || _c === void 0 ? void 0 : _c.webview) === null || _d === void 0 ? void 0 : _d.registerTextureStream));
|
9148
9188
|
}
|
9149
9189
|
function doesSupportSharedFrame() {
|
9150
9190
|
var _a;
|
@@ -12200,26 +12240,25 @@ var videoEx;
|
|
12200
12240
|
registerHandler('video.setFrameProcessTimeLimit', function (timeLimit) { return videoPerformanceMonitor === null || videoPerformanceMonitor === void 0 ? void 0 : videoPerformanceMonitor.setFrameProcessTimeLimit(timeLimit); }, false);
|
12201
12241
|
if ((_a = runtime.supports.video) === null || _a === void 0 ? void 0 : _a.mediaStream) {
|
12202
12242
|
registerHandler('video.startVideoExtensibilityVideoStream', function (mediaStreamInfo) { return videoEx_awaiter(_this, void 0, void 0, function () {
|
12203
|
-
var streamId, metadataInTexture,
|
12204
|
-
|
12205
|
-
|
12206
|
-
switch (_d.label) {
|
12243
|
+
var streamId, metadataInTexture, handler, _a;
|
12244
|
+
return videoEx_generator(this, function (_b) {
|
12245
|
+
switch (_b.label) {
|
12207
12246
|
case 0:
|
12208
12247
|
streamId = mediaStreamInfo.streamId, metadataInTexture = mediaStreamInfo.metadataInTexture;
|
12248
|
+
handler = videoPerformanceMonitor
|
12249
|
+
? createMonitoredVideoFrameHandler(parameters.videoFrameHandler, videoPerformanceMonitor)
|
12250
|
+
: parameters.videoFrameHandler;
|
12209
12251
|
if (!metadataInTexture) return [3 /*break*/, 2];
|
12210
|
-
return [4 /*yield*/, processMediaStreamWithMetadata(streamId,
|
12252
|
+
return [4 /*yield*/, processMediaStreamWithMetadata(streamId, handler, notifyError, videoPerformanceMonitor)];
|
12211
12253
|
case 1:
|
12212
|
-
_a =
|
12254
|
+
_a = _b.sent();
|
12213
12255
|
return [3 /*break*/, 4];
|
12214
|
-
case 2: return [4 /*yield*/, processMediaStream(streamId,
|
12256
|
+
case 2: return [4 /*yield*/, processMediaStream(streamId, handler, notifyError, videoPerformanceMonitor)];
|
12215
12257
|
case 3:
|
12216
|
-
_a =
|
12217
|
-
|
12258
|
+
_a = _b.sent();
|
12259
|
+
_b.label = 4;
|
12218
12260
|
case 4:
|
12219
|
-
|
12220
|
-
// register the video track with processed frames back to the stream
|
12221
|
-
!inServerSideRenderingEnvironment() &&
|
12222
|
-
((_c = (_b = window['chrome']) === null || _b === void 0 ? void 0 : _b.webview) === null || _c === void 0 ? void 0 : _c.registerTextureStream(streamId, generator));
|
12261
|
+
_a;
|
12223
12262
|
return [2 /*return*/];
|
12224
12263
|
}
|
12225
12264
|
});
|
@@ -12247,6 +12286,24 @@ var videoEx;
|
|
12247
12286
|
}
|
12248
12287
|
}
|
12249
12288
|
videoEx.registerForVideoFrame = registerForVideoFrame;
|
12289
|
+
function createMonitoredVideoFrameHandler(videoFrameHandler, videoPerformanceMonitor) {
|
12290
|
+
var _this = this;
|
12291
|
+
return function (receivedVideoFrame) { return videoEx_awaiter(_this, void 0, void 0, function () {
|
12292
|
+
var originalFrame, processedFrame;
|
12293
|
+
return videoEx_generator(this, function (_a) {
|
12294
|
+
switch (_a.label) {
|
12295
|
+
case 0:
|
12296
|
+
originalFrame = receivedVideoFrame.videoFrame;
|
12297
|
+
videoPerformanceMonitor.reportStartFrameProcessing(originalFrame.codedWidth, originalFrame.codedHeight);
|
12298
|
+
return [4 /*yield*/, videoFrameHandler(receivedVideoFrame)];
|
12299
|
+
case 1:
|
12300
|
+
processedFrame = _a.sent();
|
12301
|
+
videoPerformanceMonitor.reportFrameProcessed();
|
12302
|
+
return [2 /*return*/, processedFrame];
|
12303
|
+
}
|
12304
|
+
});
|
12305
|
+
}); };
|
12306
|
+
}
|
12250
12307
|
function normalizedVideoBufferData(videoBufferData) {
|
12251
12308
|
videoBufferData['videoFrameBuffer'] = videoBufferData['videoFrameBuffer'] || videoBufferData['data'];
|
12252
12309
|
delete videoBufferData['data'];
|