@whereby.com/browser-sdk 3.36.0 → 3.36.2

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.
@@ -126,6 +126,8 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
126
126
  const client = (_b = React__namespace.useContext(WherebyContext)) === null || _b === void 0 ? void 0 : _b.getRoomConnection();
127
127
  const videoEl = React__namespace.useRef(null);
128
128
  const audioEl = useAudioElement({ muted, stream });
129
+ const onVideoResizeRef = React__namespace.useRef(onVideoResize);
130
+ onVideoResizeRef.current = onVideoResize;
129
131
  React__namespace.useImperativeHandle(ref, () => {
130
132
  return Object.assign(videoEl.current, {
131
133
  captureAspectRatio: () => {
@@ -146,17 +148,16 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
146
148
  return;
147
149
  }
148
150
  const resizeObserver = new ResizeObserver(core.debounce(() => {
151
+ var _a;
149
152
  if (videoEl.current && (stream === null || stream === void 0 ? void 0 : stream.id)) {
150
153
  const width = videoEl.current.clientWidth;
151
154
  const height = videoEl.current.clientHeight;
152
155
  client === null || client === void 0 ? void 0 : client.reportStreamResolution(stream.id, width, height);
153
- if (onVideoResize) {
154
- onVideoResize({
155
- width,
156
- height,
157
- stream,
158
- });
159
- }
156
+ (_a = onVideoResizeRef.current) === null || _a === void 0 ? void 0 : _a.call(onVideoResizeRef, {
157
+ width,
158
+ height,
159
+ stream,
160
+ });
160
161
  }
161
162
  }, { delay: 1000, edges: true }));
162
163
  resizeObserver.observe(videoEl.current);
@@ -164,6 +165,26 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
164
165
  resizeObserver.disconnect();
165
166
  };
166
167
  }, [stream]);
168
+ React__namespace.useEffect(() => {
169
+ const video = videoEl.current;
170
+ if (!video) {
171
+ return;
172
+ }
173
+ const handleSourceResize = () => {
174
+ var _a;
175
+ if (stream === null || stream === void 0 ? void 0 : stream.id) {
176
+ (_a = onVideoResizeRef.current) === null || _a === void 0 ? void 0 : _a.call(onVideoResizeRef, {
177
+ width: video.clientWidth,
178
+ height: video.clientHeight,
179
+ stream,
180
+ });
181
+ }
182
+ };
183
+ video.addEventListener("resize", handleSourceResize);
184
+ return () => {
185
+ video.removeEventListener("resize", handleSourceResize);
186
+ };
187
+ }, [stream]);
167
188
  React__namespace.useEffect(() => {
168
189
  if (!videoEl.current) {
169
190
  return;
@@ -181,7 +202,7 @@ const VideoView = React__namespace.forwardRef((_a, ref) => {
181
202
  });
182
203
  VideoView.displayName = "VideoView";
183
204
 
184
- const browserSdkVersion = "3.36.0";
205
+ const browserSdkVersion = "3.36.2";
185
206
 
186
207
  const initialState$1 = {
187
208
  chatMessages: [],
@@ -105,6 +105,8 @@ const VideoView = React.forwardRef((_a, ref) => {
105
105
  const client = (_b = React.useContext(WherebyContext)) === null || _b === void 0 ? void 0 : _b.getRoomConnection();
106
106
  const videoEl = React.useRef(null);
107
107
  const audioEl = useAudioElement({ muted, stream });
108
+ const onVideoResizeRef = React.useRef(onVideoResize);
109
+ onVideoResizeRef.current = onVideoResize;
108
110
  React.useImperativeHandle(ref, () => {
109
111
  return Object.assign(videoEl.current, {
110
112
  captureAspectRatio: () => {
@@ -125,17 +127,16 @@ const VideoView = React.forwardRef((_a, ref) => {
125
127
  return;
126
128
  }
127
129
  const resizeObserver = new ResizeObserver(debounce(() => {
130
+ var _a;
128
131
  if (videoEl.current && (stream === null || stream === void 0 ? void 0 : stream.id)) {
129
132
  const width = videoEl.current.clientWidth;
130
133
  const height = videoEl.current.clientHeight;
131
134
  client === null || client === void 0 ? void 0 : client.reportStreamResolution(stream.id, width, height);
132
- if (onVideoResize) {
133
- onVideoResize({
134
- width,
135
- height,
136
- stream,
137
- });
138
- }
135
+ (_a = onVideoResizeRef.current) === null || _a === void 0 ? void 0 : _a.call(onVideoResizeRef, {
136
+ width,
137
+ height,
138
+ stream,
139
+ });
139
140
  }
140
141
  }, { delay: 1000, edges: true }));
141
142
  resizeObserver.observe(videoEl.current);
@@ -143,6 +144,26 @@ const VideoView = React.forwardRef((_a, ref) => {
143
144
  resizeObserver.disconnect();
144
145
  };
145
146
  }, [stream]);
147
+ React.useEffect(() => {
148
+ const video = videoEl.current;
149
+ if (!video) {
150
+ return;
151
+ }
152
+ const handleSourceResize = () => {
153
+ var _a;
154
+ if (stream === null || stream === void 0 ? void 0 : stream.id) {
155
+ (_a = onVideoResizeRef.current) === null || _a === void 0 ? void 0 : _a.call(onVideoResizeRef, {
156
+ width: video.clientWidth,
157
+ height: video.clientHeight,
158
+ stream,
159
+ });
160
+ }
161
+ };
162
+ video.addEventListener("resize", handleSourceResize);
163
+ return () => {
164
+ video.removeEventListener("resize", handleSourceResize);
165
+ };
166
+ }, [stream]);
146
167
  React.useEffect(() => {
147
168
  if (!videoEl.current) {
148
169
  return;
@@ -160,7 +181,7 @@ const VideoView = React.forwardRef((_a, ref) => {
160
181
  });
161
182
  VideoView.displayName = "VideoView";
162
183
 
163
- const browserSdkVersion = "3.36.0";
184
+ const browserSdkVersion = "3.36.2";
164
185
 
165
186
  const initialState$1 = {
166
187
  chatMessages: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "3.36.0",
3
+ "version": "3.36.2",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",
@@ -73,8 +73,8 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@radix-ui/react-popover": "^1.0.7",
76
- "@whereby.com/media": "11.3.1",
77
- "@whereby.com/core": "1.26.0",
76
+ "@whereby.com/media": "11.3.2",
77
+ "@whereby.com/core": "1.26.2",
78
78
  "clsx": "^2.1.1",
79
79
  "heresy": "^1.0.4",
80
80
  "runes": "^0.4.3",