@whereby.com/browser-sdk 2.0.0-alpha3 → 2.0.0-alpha4

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/lib.cjs.js CHANGED
@@ -130,7 +130,7 @@ heresy.define("WherebyEmbed", {
130
130
  if (!subdomain)
131
131
  return this.html `Whereby: Missing subdomain attr.`;
132
132
  const url = new URL(room, `https://${subdomain}.whereby.com`);
133
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha3", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
133
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha4", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
134
134
  // add to URL if set in any way
135
135
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
136
136
  if (!url.searchParams.has(k) && typeof v === "string") {
@@ -147,12 +147,21 @@ heresy.define("WherebyEmbed", {
147
147
  });
148
148
 
149
149
  var VideoView = (_a) => {
150
- var { stream } = _a, rest = tslib.__rest(_a, ["stream"]);
151
- const videoEl = React.useCallback((node) => {
152
- if (node !== null && node.srcObject !== stream) {
153
- node.srcObject = stream;
150
+ var { muted, stream } = _a, rest = tslib.__rest(_a, ["muted", "stream"]);
151
+ const videoEl = React.useRef(null);
152
+ React.useEffect(() => {
153
+ if (!videoEl.current) {
154
+ return;
155
+ }
156
+ if (videoEl.current.srcObject !== stream) {
157
+ videoEl.current.srcObject = stream;
158
+ }
159
+ // Handle muting programatically, not as video attribute
160
+ // https://stackoverflow.com/questions/14111917/html5-video-muted-but-still-playing
161
+ if (videoEl.current.muted !== muted) {
162
+ videoEl.current.muted = Boolean(muted);
154
163
  }
155
- }, []);
164
+ }, [muted, stream, videoEl]);
156
165
  return React__default["default"].createElement("video", Object.assign({ ref: videoEl, autoPlay: true, playsInline: true }, rest));
157
166
  };
158
167
 
@@ -5462,7 +5471,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5462
5471
  ];
5463
5472
  }
5464
5473
 
5465
- const sdkVersion = "2.0.0-alpha3";
5474
+ const sdkVersion = "2.0.0-alpha4";
5466
5475
 
5467
5476
  exports.sdkVersion = sdkVersion;
5468
5477
  exports.useRoomConnection = useRoomConnection;
package/dist/lib.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { define, ref } from 'heresy';
2
2
  import { __rest, __awaiter } from 'tslib';
3
- import React, { useCallback, useState, useReducer, useEffect } from 'react';
3
+ import React, { useRef, useEffect, useState, useReducer } from 'react';
4
4
  import adapter from 'webrtc-adapter';
5
5
  import io from 'socket.io-client';
6
6
  import SDPUtils from 'sdp';
@@ -115,7 +115,7 @@ define("WherebyEmbed", {
115
115
  if (!subdomain)
116
116
  return this.html `Whereby: Missing subdomain attr.`;
117
117
  const url = new URL(room, `https://${subdomain}.whereby.com`);
118
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha3", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
118
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha4", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
119
119
  // add to URL if set in any way
120
120
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
121
121
  if (!url.searchParams.has(k) && typeof v === "string") {
@@ -132,12 +132,21 @@ define("WherebyEmbed", {
132
132
  });
133
133
 
134
134
  var VideoView = (_a) => {
135
- var { stream } = _a, rest = __rest(_a, ["stream"]);
136
- const videoEl = useCallback((node) => {
137
- if (node !== null && node.srcObject !== stream) {
138
- node.srcObject = stream;
135
+ var { muted, stream } = _a, rest = __rest(_a, ["muted", "stream"]);
136
+ const videoEl = useRef(null);
137
+ useEffect(() => {
138
+ if (!videoEl.current) {
139
+ return;
140
+ }
141
+ if (videoEl.current.srcObject !== stream) {
142
+ videoEl.current.srcObject = stream;
143
+ }
144
+ // Handle muting programatically, not as video attribute
145
+ // https://stackoverflow.com/questions/14111917/html5-video-muted-but-still-playing
146
+ if (videoEl.current.muted !== muted) {
147
+ videoEl.current.muted = Boolean(muted);
139
148
  }
140
- }, []);
149
+ }, [muted, stream, videoEl]);
141
150
  return React.createElement("video", Object.assign({ ref: videoEl, autoPlay: true, playsInline: true }, rest));
142
151
  };
143
152
 
@@ -5447,6 +5456,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
5447
5456
  ];
5448
5457
  }
5449
5458
 
5450
- const sdkVersion = "2.0.0-alpha3";
5459
+ const sdkVersion = "2.0.0-alpha4";
5451
5460
 
5452
5461
  export { sdkVersion, useRoomConnection };
package/dist/types.d.ts CHANGED
@@ -36,7 +36,7 @@ interface VideoViewSelfProps {
36
36
  style?: React.CSSProperties;
37
37
  }
38
38
  type VideoViewProps = VideoViewSelfProps & React.DetailedHTMLProps<React.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
39
- declare const _default: ({ stream, ...rest }: VideoViewProps) => JSX.Element;
39
+ declare const _default: ({ muted, stream, ...rest }: VideoViewProps) => JSX.Element;
40
40
 
41
41
  interface RoomParticipantData {
42
42
  displayName: string;
@@ -100,6 +100,6 @@ interface RoomConnectionComponents {
100
100
  }
101
101
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions: RoomConnectionOptions): [state: RoomState, actions: RoomConnectionActions, components: RoomConnectionComponents];
102
102
 
103
- declare const sdkVersion = "2.0.0-alpha3";
103
+ declare const sdkVersion = "2.0.0-alpha4";
104
104
 
105
105
  export { sdkVersion, useRoomConnection };