@whereby.com/browser-sdk 2.0.0 → 2.1.0-beta2

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.
@@ -1,4 +1,6 @@
1
- interface WherebyEmbedAttributes {
1
+ import { ReactHTMLElement } from 'react';
2
+
3
+ interface WherebyEmbedElementAttributes extends ReactHTMLElement<HTMLElement> {
2
4
  audio: string;
3
5
  avatarUrl: string;
4
6
  background: string;
@@ -35,10 +37,68 @@ interface WherebyEmbedAttributes {
35
37
  video: string;
36
38
  virtualBackgroundUrl: string;
37
39
  }
40
+ interface WherebyEmbedElementEventMap {
41
+ ready: CustomEvent;
42
+ knock: CustomEvent;
43
+ participantupdate: CustomEvent<{
44
+ count: number;
45
+ }>;
46
+ join: CustomEvent;
47
+ leave: CustomEvent<{
48
+ removed: boolean;
49
+ }>;
50
+ participant_join: CustomEvent<{
51
+ participant: {
52
+ metadata: string;
53
+ };
54
+ }>;
55
+ participant_leave: CustomEvent<{
56
+ participant: {
57
+ metadata: string;
58
+ };
59
+ }>;
60
+ microphone_toggle: CustomEvent<{
61
+ enabled: boolean;
62
+ }>;
63
+ camera_toggle: CustomEvent<{
64
+ enabled: boolean;
65
+ }>;
66
+ chat_toggle: CustomEvent<{
67
+ open: boolean;
68
+ }>;
69
+ pip_toggle: CustomEvent<{
70
+ open: boolean;
71
+ }>;
72
+ deny_device_permission: CustomEvent<{
73
+ denied: boolean;
74
+ }>;
75
+ screenshare_toggle: CustomEvent<{
76
+ enabled: boolean;
77
+ }>;
78
+ streaming_status_change: CustomEvent<{
79
+ status: string;
80
+ }>;
81
+ connection_status_change: CustomEvent<{
82
+ status: "stable" | "unstable";
83
+ }>;
84
+ }
85
+ interface WherebyEmbedElementCommands {
86
+ startRecording: () => void;
87
+ stopRecording: () => void;
88
+ startStreaming: () => void;
89
+ stopStreaming: () => void;
90
+ toggleCamera: (enabled?: boolean) => void;
91
+ toggleMicrophone: (enabled?: boolean) => void;
92
+ toggleScreenshare: (enabled?: boolean) => void;
93
+ toogleChat: (enabled?: boolean) => void;
94
+ }
95
+ interface WherebyEmbedElement extends HTMLIFrameElement, WherebyEmbedElementCommands {
96
+ addEventListener<K extends keyof (WherebyEmbedElementEventMap & HTMLElementEventMap)>(type: K, listener: (this: HTMLIFrameElement, ev: (WherebyEmbedElementEventMap & HTMLElementEventMap)[K]) => void, options?: boolean | AddEventListenerOptions | undefined): void;
97
+ }
38
98
  declare global {
39
99
  namespace JSX {
40
100
  interface IntrinsicElements {
41
- ["whereby-embed"]: Partial<WherebyEmbedAttributes>;
101
+ ["whereby-embed"]: Partial<WherebyEmbedElementAttributes>;
42
102
  }
43
103
  }
44
104
  }
@@ -46,4 +106,4 @@ declare const _default: {
46
106
  sdkVersion: string;
47
107
  };
48
108
 
49
- export { _default as default };
109
+ export { type WherebyEmbedElement, _default as default };
@@ -20,7 +20,7 @@ function parseRoomUrlAndSubdomain(roomAttribute, subdomainAttribute) {
20
20
  };
21
21
  }
22
22
 
23
- const sdkVersion = "2.0.0";
23
+ const sdkVersion = "2.1.0-beta2";
24
24
 
25
25
  const boolAttrs = [
26
26
  "audio",
@@ -119,7 +119,7 @@ define("WherebyEmbed", {
119
119
  toggleChat(enabled) {
120
120
  this._postCommand("toggle_chat", [enabled]);
121
121
  },
122
- onmessage({ origin, data }) {
122
+ onmessage({ origin, data, }) {
123
123
  if (!this.roomUrl || origin !== this.roomUrl.origin)
124
124
  return;
125
125
  const { type, payload: detail } = data;
@@ -147,7 +147,7 @@ define("WherebyEmbed", {
147
147
  title=${title || "Video calling component"}
148
148
  ref=${this.iframe}
149
149
  src=${this.roomUrl}
150
- allow="autoplay; camera; microphone; fullscreen; speaker; display-capture" />
150
+ allow="autoplay; camera; microphone; fullscreen; speaker; display-capture; media-capture" />
151
151
  `;
152
152
  },
153
153
  });
@@ -1,5 +1,4 @@
1
- import * as React from 'react';
2
- import React__default from 'react';
1
+ import * as React$1 from 'react';
3
2
  import _whereby_jslib_media_src_utils_ServerSocket, { ChatMessage as ChatMessage$2 } from '@whereby/jslib-media/src/utils/ServerSocket';
4
3
  import * as redux_thunk from 'redux-thunk';
5
4
  import { AxiosRequestConfig } from 'axios';
@@ -13,15 +12,18 @@ interface VideoViewSelfProps {
13
12
  stream: MediaStream;
14
13
  muted?: boolean;
15
14
  mirror?: boolean;
16
- style?: React__default.CSSProperties;
15
+ style?: React$1.CSSProperties;
17
16
  onResize?: ({ width, height, stream }: {
18
17
  width: number;
19
18
  height: number;
20
19
  stream: MediaStream;
21
20
  }) => void;
21
+ onSetAspectRatio?: ({ aspectRatio }: {
22
+ aspectRatio: number;
23
+ }) => void;
22
24
  }
23
- type VideoViewProps = VideoViewSelfProps & React__default.DetailedHTMLProps<React__default.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
24
- declare const _default: ({ muted, mirror, stream, onResize, ...rest }: VideoViewProps) => React__default.JSX.Element;
25
+ type VideoViewProps = VideoViewSelfProps & React$1.DetailedHTMLProps<React$1.VideoHTMLAttributes<HTMLVideoElement>, HTMLVideoElement>;
26
+ declare const _default: ({ muted, mirror, stream, onResize, onSetAspectRatio, ...rest }: VideoViewProps) => React$1.JSX.Element;
25
27
 
26
28
  interface RoomParticipantData {
27
29
  displayName: string;
@@ -813,7 +815,6 @@ interface RoomConnectionActions {
813
815
  stopCloudRecording(): void;
814
816
  stopScreenshare(): void;
815
817
  }
816
-
817
818
  type VideoViewComponentProps = Omit<React.ComponentProps<typeof _default>, "onResize">;
818
819
  interface RoomConnectionComponents {
819
820
  VideoView: (props: VideoViewComponentProps) => ReturnType<typeof _default>;
@@ -824,10 +825,34 @@ type RoomConnectionRef = {
824
825
  components: RoomConnectionComponents;
825
826
  _ref: Store;
826
827
  };
828
+
827
829
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions?: UseRoomConnectionOptions): RoomConnectionRef;
828
830
 
829
831
  declare function useLocalMedia(optionsOrStream?: UseLocalMediaOptions | MediaStream): UseLocalMediaResult;
830
832
 
833
+ type Origin = {
834
+ top: number;
835
+ left: number;
836
+ };
837
+ type Bounds = {
838
+ width: number;
839
+ height: number;
840
+ };
841
+
842
+ interface GridProps {
843
+ roomConnection: RoomConnectionRef;
844
+ renderParticipant?: ({ cell, participant, }: {
845
+ cell: {
846
+ clientId: string;
847
+ bounds: Bounds;
848
+ origin: Origin;
849
+ };
850
+ participant: RemoteParticipantState | LocalParticipantState;
851
+ }) => React$1.ReactNode;
852
+ videoGridGap?: number;
853
+ }
854
+ declare function Grid({ roomConnection, renderParticipant, videoGridGap }: GridProps): React$1.JSX.Element;
855
+
831
856
  declare const sdkVersion = "__SDK_VERSION__";
832
857
 
833
- export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };
858
+ export { type ChatMessageState as ChatMessage, type LocalParticipantState as LocalParticipant, type RemoteParticipantState as RemoteParticipant, type RoomConnectionState as RoomConnection, type ScreenshareState as Screenshare, type UseLocalMediaResult, Grid as VideoGrid, _default as VideoView, type WaitingParticipantState as WaitingParticipant, sdkVersion, useLocalMedia, useRoomConnection };