@stream-io/video-react-sdk 1.3.6 → 1.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [1.4.0](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.3.6...@stream-io/video-react-sdk-1.4.0) (2024-09-19)
6
+
7
+ ### Dependency Updates
8
+
9
+ * `@stream-io/video-client` updated to version `1.7.0`
10
+ * `@stream-io/video-filters-web` updated to version `0.1.4`
11
+ * `@stream-io/video-react-bindings` updated to version `1.0.6`
12
+ * `@stream-io/audio-filters-web` updated to version `0.2.2`
13
+
14
+ ### Features
15
+
16
+ * React SDK cold-start optimizations ([#1488](https://github.com/GetStream/stream-video-js/issues/1488)) ([972e579](https://github.com/GetStream/stream-video-js/commit/972e5792b5a131a212b1031ade76dcb383897a46))
17
+
5
18
  ## [1.3.6](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-1.3.5...@stream-io/video-react-sdk-1.3.6) (2024-09-19)
6
19
 
7
20
  ### Dependency Updates
package/dist/index.cjs.js CHANGED
@@ -8,8 +8,6 @@ var clsx = require('clsx');
8
8
  var reactDom = require('react-dom');
9
9
  var videoFiltersWeb = require('@stream-io/video-filters-web');
10
10
  var react$1 = require('@floating-ui/react');
11
- var chart_js = require('chart.js');
12
- var reactChartjs2 = require('react-chartjs-2');
13
11
 
14
12
  const Audio = ({ participant, trackType = 'audioTrack', ...rest }) => {
15
13
  const call = videoReactBindings.useCall();
@@ -1202,89 +1200,15 @@ const CancelCallButton = ({ disabled, caption, onClick, onLeave, }) => {
1202
1200
 
1203
1201
  const CallControls = ({ onLeave }) => (jsxRuntime.jsxs("div", { className: "str-video__call-controls", children: [jsxRuntime.jsx(SpeakingWhileMutedNotification, { children: jsxRuntime.jsx(ToggleAudioPublishingButton, {}) }), jsxRuntime.jsx(ToggleVideoPublishingButton, {}), jsxRuntime.jsx(ReactionsButton, {}), jsxRuntime.jsx(ScreenShareButton, {}), jsxRuntime.jsx(RecordCallButton, {}), jsxRuntime.jsx(CancelCallButton, { onLeave: onLeave })] }));
1204
1202
 
1205
- chart_js.Chart.register(chart_js.CategoryScale, chart_js.LinearScale, chart_js.LineElement, chart_js.PointElement);
1206
- const CallStatsLatencyChart = (props) => {
1207
- const { values } = props;
1208
- let max = 0;
1209
- const data = {
1210
- labels: values.map((point) => {
1211
- const date = new Date(point.x * 1000);
1212
- return `${date.getHours()}:${date.getMinutes()}`;
1213
- }),
1214
- datasets: [
1215
- {
1216
- data: values.map((point) => {
1217
- const { y } = point;
1218
- max = Math.max(max, y);
1219
- return point;
1220
- }),
1221
- borderColor: '#00e2a1',
1222
- backgroundColor: '#00e2a1',
1223
- },
1224
- ],
1225
- };
1226
- const options = react.useMemo(() => {
1227
- return {
1228
- maintainAspectRatio: false,
1229
- animation: {
1230
- duration: 0,
1231
- },
1232
- elements: {
1233
- line: {
1234
- borderWidth: 1,
1235
- },
1236
- point: {
1237
- radius: 2,
1238
- },
1239
- },
1240
- scales: {
1241
- y: {
1242
- position: 'right',
1243
- stacked: true,
1244
- min: 0,
1245
- max: Math.max(180, Math.ceil((max + 10) / 10) * 10),
1246
- grid: {
1247
- display: true,
1248
- color: '#979ca0',
1249
- },
1250
- ticks: {
1251
- stepSize: 30,
1252
- },
1253
- },
1254
- x: {
1255
- grid: {
1256
- display: false,
1257
- },
1258
- ticks: {
1259
- display: false,
1260
- },
1261
- },
1262
- },
1263
- };
1264
- }, [max]);
1265
- return (jsxRuntime.jsx("div", { className: "str-video__call-stats-line-chart-container", children: jsxRuntime.jsx(reactChartjs2.Line, { options: options, data: data, className: "str-video__call-stats__latencychart" }) }));
1266
- };
1267
-
1268
- exports.Statuses = void 0;
1269
- (function (Statuses) {
1270
- Statuses["GOOD"] = "Good";
1271
- Statuses["OK"] = "Ok";
1272
- Statuses["BAD"] = "Bad";
1273
- })(exports.Statuses || (exports.Statuses = {}));
1274
- const statsStatus = ({ value, lowBound, highBound, }) => {
1275
- if (value <= lowBound) {
1276
- return exports.Statuses.GOOD;
1277
- }
1278
- if (value >= lowBound && value <= highBound) {
1279
- return exports.Statuses.OK;
1280
- }
1281
- if (value >= highBound) {
1282
- return exports.Statuses.BAD;
1283
- }
1284
- return exports.Statuses.GOOD;
1285
- };
1203
+ const CallStatsLatencyChart = react.lazy(() => Promise.resolve().then(function () { return require('./latency-chart-CpL1M_s0.cjs.js'); }));
1204
+ var Status;
1205
+ (function (Status) {
1206
+ Status["GOOD"] = "Good";
1207
+ Status["OK"] = "Ok";
1208
+ Status["BAD"] = "Bad";
1209
+ })(Status || (Status = {}));
1286
1210
  const CallStats = (props) => {
1287
- const { latencyLowBound = 75, latencyHighBound = 400 } = props;
1211
+ const { latencyLowBound = 75, latencyHighBound = 400, showCodecInfo = false, LatencyChartSuspenseFallback = null, } = props;
1288
1212
  const [latencyBuffer, setLatencyBuffer] = react.useState(() => {
1289
1213
  const now = Date.now();
1290
1214
  return Array.from({ length: 20 }, (_, i) => ({ x: now + i, y: 0 }));
@@ -1324,13 +1248,13 @@ const CallStats = (props) => {
1324
1248
  highBound: latencyHighBound,
1325
1249
  value: callStatsReport?.publisherStats.averageRoundTripTimeInMs || 0,
1326
1250
  };
1327
- return (jsxRuntime.jsx("div", { className: "str-video__call-stats", children: callStatsReport && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__header", children: [jsxRuntime.jsxs("h3", { className: "str-video__call-stats__heading", children: [jsxRuntime.jsx(Icon, { className: "str-video__call-stats__icon", icon: "call-latency" }), t('Call Latency')] }), jsxRuntime.jsx("p", { className: "str-video__call-stats__description", children: t('Very high latency values may reduce call quality, cause lag, and make the call less enjoyable.') })] }), jsxRuntime.jsx("div", { className: "str-video__call-stats__latencychart", children: jsxRuntime.jsx(CallStatsLatencyChart, { values: latencyBuffer }) }), jsxRuntime.jsxs("div", { className: "str-video__call-stats__header", children: [jsxRuntime.jsxs("h3", { className: "str-video__call-stats__heading", children: [jsxRuntime.jsx(Icon, { className: "str-video__call-stats__icon", icon: "network-quality" }), t('Call performance')] }), jsxRuntime.jsx("p", { className: "str-video__call-stats__description", children: t('Review the key data points below to assess call performance') })] }), jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-container", children: [jsxRuntime.jsx(StatCard, { label: t('Region'), value: callStatsReport.datacenter }), jsxRuntime.jsx(StatCard, { label: t('Latency'), value: `${callStatsReport.publisherStats.averageRoundTripTimeInMs} ms.`, comparison: latencyComparison }), jsxRuntime.jsx(StatCard, { label: t('Receive jitter'), value: `${callStatsReport.subscriberStats.averageJitterInMs} ms.`, comparison: {
1251
+ return (jsxRuntime.jsx("div", { className: "str-video__call-stats", children: callStatsReport && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__header", children: [jsxRuntime.jsxs("h3", { className: "str-video__call-stats__heading", children: [jsxRuntime.jsx(Icon, { className: "str-video__call-stats__icon", icon: "call-latency" }), t('Call Latency')] }), jsxRuntime.jsx("p", { className: "str-video__call-stats__description", children: t('Very high latency values may reduce call quality, cause lag, and make the call less enjoyable.') })] }), jsxRuntime.jsx("div", { className: "str-video__call-stats__latencychart", children: jsxRuntime.jsx(react.Suspense, { fallback: LatencyChartSuspenseFallback, children: jsxRuntime.jsx(CallStatsLatencyChart, { values: latencyBuffer }) }) }), jsxRuntime.jsxs("div", { className: "str-video__call-stats__header", children: [jsxRuntime.jsxs("h3", { className: "str-video__call-stats__heading", children: [jsxRuntime.jsx(Icon, { className: "str-video__call-stats__icon", icon: "network-quality" }), t('Call performance')] }), jsxRuntime.jsx("p", { className: "str-video__call-stats__description", children: t('Review the key data points below to assess call performance') })] }), jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-container", children: [jsxRuntime.jsx(StatCard, { label: t('Region'), value: callStatsReport.datacenter }), jsxRuntime.jsx(StatCard, { label: t('Latency'), value: `${callStatsReport.publisherStats.averageRoundTripTimeInMs} ms.`, comparison: latencyComparison }), jsxRuntime.jsx(StatCard, { label: t('Receive jitter'), value: `${callStatsReport.subscriberStats.averageJitterInMs} ms.`, comparison: {
1328
1252
  ...latencyComparison,
1329
1253
  value: callStatsReport.subscriberStats.averageJitterInMs,
1330
1254
  } }), jsxRuntime.jsx(StatCard, { label: t('Publish jitter'), value: `${callStatsReport.publisherStats.averageJitterInMs} ms.`, comparison: {
1331
1255
  ...latencyComparison,
1332
1256
  value: callStatsReport.publisherStats.averageJitterInMs,
1333
- } }), jsxRuntime.jsx(StatCard, { label: t('Publish resolution'), value: toFrameSize(callStatsReport.publisherStats) }), jsxRuntime.jsx(StatCard, { label: t('Publish quality drop reason'), value: callStatsReport.publisherStats.qualityLimitationReasons }), jsxRuntime.jsx(StatCard, { label: t('Receiving resolution'), value: toFrameSize(callStatsReport.subscriberStats) }), jsxRuntime.jsx(StatCard, { label: t('Receive quality drop reason'), value: callStatsReport.subscriberStats.qualityLimitationReasons }), jsxRuntime.jsx(StatCard, { label: t('Publish bitrate'), value: publishBitrate }), jsxRuntime.jsx(StatCard, { label: t('Receiving bitrate'), value: subscribeBitrate })] })] })) }));
1257
+ } }), jsxRuntime.jsx(StatCard, { label: `${t('Publish resolution')}${showCodecInfo ? formatCodec(callStatsReport) : ''}`, value: toFrameSize(callStatsReport.publisherStats) }), jsxRuntime.jsx(StatCard, { label: t('Publish quality drop reason'), value: callStatsReport.publisherStats.qualityLimitationReasons }), jsxRuntime.jsx(StatCard, { label: t('Receiving resolution'), value: toFrameSize(callStatsReport.subscriberStats) }), jsxRuntime.jsx(StatCard, { label: t('Receive quality drop reason'), value: callStatsReport.subscriberStats.qualityLimitationReasons }), jsxRuntime.jsx(StatCard, { label: t('Publish bitrate'), value: publishBitrate }), jsxRuntime.jsx(StatCard, { label: t('Receiving bitrate'), value: subscribeBitrate })] })] })) }));
1334
1258
  };
1335
1259
  const StatCardExplanation = (props) => {
1336
1260
  const { description } = props;
@@ -1343,18 +1267,29 @@ const StatCardExplanation = (props) => {
1343
1267
  const { getReferenceProps, getFloatingProps } = react$1.useInteractions([hover]);
1344
1268
  return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: "str-video__call-explanation", ref: refs.setReference, ...getReferenceProps(), children: jsxRuntime.jsx(Icon, { className: "str-video__call-explanation__icon", icon: "info" }) }), isOpen && (jsxRuntime.jsx("div", { className: "str-video__call-explanation__description", ref: refs.setFloating, style: floatingStyles, ...getFloatingProps(), children: description }))] }));
1345
1269
  };
1346
- const StatsTag = ({ children, status = exports.Statuses.GOOD, }) => {
1270
+ const StatsTag = (props) => {
1271
+ const { children, status } = props;
1347
1272
  return (jsxRuntime.jsx("div", { className: clsx('str-video__call-stats__tag', {
1348
- 'str-video__call-stats__tag--good': status === exports.Statuses.GOOD,
1349
- 'str-video__call-stats__tag--ok': status === exports.Statuses.OK,
1350
- 'str-video__call-stats__tag--bad': status === exports.Statuses.BAD,
1273
+ 'str-video__call-stats__tag--good': status === Status.GOOD,
1274
+ 'str-video__call-stats__tag--ok': status === Status.OK,
1275
+ 'str-video__call-stats__tag--bad': status === Status.BAD,
1351
1276
  }), children: jsxRuntime.jsx("div", { className: "str-video__call-stats__tag__text", children: children }) }));
1352
1277
  };
1353
1278
  const StatCard = (props) => {
1354
1279
  const { label, value, description, comparison } = props;
1355
1280
  const { t } = videoReactBindings.useI18n();
1356
- const status = comparison ? statsStatus(comparison) : undefined;
1357
- return (jsxRuntime.jsxs("div", { className: "str-video__call-stats__card", children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-content", children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-label", children: [label, description && jsxRuntime.jsx(StatCardExplanation, { description: description })] }), jsxRuntime.jsx("div", { className: "str-video__call-stats__card-value", children: value })] }), comparison && status && jsxRuntime.jsx(StatsTag, { status: status, children: t(status) })] }));
1281
+ const status = comparison ? toStatus(comparison) : undefined;
1282
+ return (jsxRuntime.jsxs("div", { className: "str-video__call-stats__card", children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-content", children: [jsxRuntime.jsxs("div", { className: "str-video__call-stats__card-label", children: [label, description && jsxRuntime.jsx(StatCardExplanation, { description: description })] }), jsxRuntime.jsx("div", { className: "str-video__call-stats__card-value", children: value })] }), status && jsxRuntime.jsx(StatsTag, { status: status, children: t(status) })] }));
1283
+ };
1284
+ const toStatus = (config) => {
1285
+ const { value, lowBound, highBound } = config;
1286
+ if (value <= lowBound)
1287
+ return Status.GOOD;
1288
+ if (value >= lowBound && value <= highBound)
1289
+ return Status.OK;
1290
+ if (value >= highBound)
1291
+ return Status.BAD;
1292
+ return Status.GOOD;
1358
1293
  };
1359
1294
  const toFrameSize = (stats) => {
1360
1295
  const { highestFrameWidth: w, highestFrameHeight: h, highestFramesPerSecond: fps, } = stats;
@@ -1367,6 +1302,13 @@ const toFrameSize = (stats) => {
1367
1302
  }
1368
1303
  return size;
1369
1304
  };
1305
+ const formatCodec = (callStatsReport) => {
1306
+ const { codec } = callStatsReport.publisherStats;
1307
+ if (!codec)
1308
+ return '';
1309
+ const [, name] = codec.split('/');
1310
+ return name ? ` (${name})` : '';
1311
+ };
1370
1312
  const calculatePublishBitrate = (previousCallStatsReport, callStatsReport) => {
1371
1313
  const { publisherStats: { totalBytesSent: previousTotalBytesSent, timestamp: previousTimestamp, }, } = previousCallStatsReport;
1372
1314
  const { publisherStats: { totalBytesSent, timestamp }, } = callStatsReport;
@@ -2605,7 +2547,7 @@ const LivestreamPlayer = (props) => {
2605
2547
  return (jsxRuntime.jsx(StreamCall, { call: call, children: jsxRuntime.jsx(LivestreamLayout, { ...layoutProps }) }));
2606
2548
  };
2607
2549
 
2608
- const [major, minor, patch] = ("1.3.6" ).split('.');
2550
+ const [major, minor, patch] = ("1.4.0").split('.');
2609
2551
  videoClient.setSdkInfo({
2610
2552
  type: videoClient.SfuModels.SdkType.REACT,
2611
2553
  major,
@@ -2629,7 +2571,6 @@ exports.CallRecordingListHeader = CallRecordingListHeader;
2629
2571
  exports.CallRecordingListItem = CallRecordingListItem;
2630
2572
  exports.CallStats = CallStats;
2631
2573
  exports.CallStatsButton = CallStatsButton;
2632
- exports.CallStatsLatencyChart = CallStatsLatencyChart;
2633
2574
  exports.CancelCallButton = CancelCallButton;
2634
2575
  exports.CancelCallConfirmButton = CancelCallConfirmButton;
2635
2576
  exports.CompositeButton = CompositeButton;
@@ -2678,8 +2619,6 @@ exports.SpeakerLayout = SpeakerLayout;
2678
2619
  exports.SpeakingWhileMutedNotification = SpeakingWhileMutedNotification;
2679
2620
  exports.SpeechIndicator = SpeechIndicator;
2680
2621
  exports.StatCard = StatCard;
2681
- exports.StatCardExplanation = StatCardExplanation;
2682
- exports.StatsTag = StatsTag;
2683
2622
  exports.StreamCall = StreamCall;
2684
2623
  exports.StreamTheme = StreamTheme;
2685
2624
  exports.StreamVideo = StreamVideo;