@stream-io/video-react-sdk 0.0.1-alpha.53 → 0.0.1-alpha.55

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,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.0.1-alpha.55](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.1-alpha.54...@stream-io/video-react-sdk-0.0.1-alpha.55) (2023-05-19)
6
+
7
+
8
+
9
+ ## [0.0.1-alpha.54](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.1-alpha.53...@stream-io/video-react-sdk-0.0.1-alpha.54) (2023-05-19)
10
+
11
+
12
+
5
13
  ## [0.0.1-alpha.53](https://github.com/GetStream/stream-video-js/compare/@stream-io/video-react-sdk-0.0.1-alpha.52...@stream-io/video-react-sdk-0.0.1-alpha.53) (2023-05-19)
6
14
 
7
15
 
@@ -17,7 +17,7 @@ type ErrorDeviceState = {
17
17
  };
18
18
  type DeviceState = EnabledDeviceState<EnabledStateType> | DisabledDeviceState<DisabledStateType> | ErrorDeviceState;
19
19
  /**
20
- * Exclude types from documentaiton site, but we should still add doc comments
20
+ * Exclude types from documentation site, but we should still add doc comments
21
21
  * @internal
22
22
  */
23
23
  export declare const DEVICE_STATE: {
@@ -28,50 +28,150 @@ export declare const DEVICE_STATE: {
28
28
  error: ErrorDeviceState;
29
29
  };
30
30
  /**
31
- * Exclude types from documentaiton site, but we should still add doc comments
32
- * @internal
31
+ * API to control device enablement, device selection and media stream access for a call.
32
+ * @category Device Management
33
33
  */
34
34
  export type MediaDevicesContextAPI = {
35
+ /**
36
+ * Deactivates MediaStream (stops and removes tracks) to be later garbage collected
37
+ *
38
+ * @param stream MediaStream
39
+ * @returns void
40
+ */
35
41
  disposeOfMediaStream: (stream: MediaStream) => void;
42
+ /**
43
+ * Returns an 'audioinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
44
+ *
45
+ * @param deviceId
46
+ * @returns
47
+ */
36
48
  getAudioStream: typeof getAudioStream;
49
+ /**
50
+ * Returns a 'videoinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
51
+ *
52
+ * @param deviceId
53
+ * @returns
54
+ */
37
55
  getVideoStream: typeof getVideoStream;
56
+ /**
57
+ * [Tells if the browser supports audio output change on 'audio' elements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId).
58
+ */
38
59
  isAudioOutputChangeSupported: boolean;
60
+ /**
61
+ * Signals whether audio stream will be published when the call is joined.
62
+ */
39
63
  initialAudioEnabled: boolean;
64
+ /**
65
+ * Signals whether audio stream will be published when the call is joined.
66
+ */
40
67
  initialVideoState: DeviceState;
41
- publishVideoStream: () => Promise<void>;
68
+ /**
69
+ * Publishes audio stream for currently selected audio input (microphone) device to other call participants.
70
+ */
42
71
  publishAudioStream: () => Promise<void>;
72
+ /**
73
+ * Publishes video stream for currently selected video input (camera) device to other call participants.
74
+ */
75
+ publishVideoStream: () => Promise<void>;
76
+ /**
77
+ * Stops publishing audio stream for currently selected audio input (microphone) device to other call participants.
78
+ */
43
79
  stopPublishingAudio: () => void;
80
+ /**
81
+ * Stops publishing video stream for currently selected video input (camera) device to other call participants.
82
+ */
44
83
  stopPublishingVideo: () => void;
84
+ /**
85
+ * Sets the initialAudioEnabled flag to a given boolean value.
86
+ * The latest value set will be used to decide, whether audio stream will be published when joining a call.
87
+ * @param enabled
88
+ */
45
89
  setInitialAudioEnabled: (enabled: boolean) => void;
90
+ /**
91
+ * Sets the initialVideoState to a given DeviceState value.
92
+ * The latest value set will be used to decide, whether video stream will be published when joining a call.
93
+ * @param enabled
94
+ */
46
95
  setInitialVideoState: (state: DeviceState) => void;
96
+ /**
97
+ * Stores audio input device (microphone) id which is used to publish user's sound to other call participants.
98
+ */
47
99
  selectedAudioInputDeviceId?: string;
100
+ /**
101
+ * Stores audio output device (speaker) id used to reproduce incoming audio from other call participants.
102
+ */
48
103
  selectedAudioOutputDeviceId?: string;
104
+ /**
105
+ * Stores video input device (camera) id which is used to publish user's video to other call participants.
106
+ */
49
107
  selectedVideoDeviceId?: string;
108
+ /**
109
+ * Function should be used to change selected device id.
110
+ * The change is later reflected in selectedAudioInputDeviceId, selectedAudioOutputDeviceId or selectedVideoDeviceId depending on kind parameter.
111
+ * @param kind
112
+ * @param deviceId
113
+ */
50
114
  switchDevice: (kind: MediaDeviceKind, deviceId?: string) => void;
115
+ /**
116
+ * Sets the initialAudioEnabled flag by negating the current state value.
117
+ * The latest value set will be used to decide, whether audio stream will be published when joining a call.
118
+ * @param enabled
119
+ */
51
120
  toggleInitialAudioMuteState: () => void;
121
+ /**
122
+ * Sets the initialVideoState by toggling the current state DeviceState value.
123
+ * The latest value set will be used to decide, whether video stream will be published when joining a call.
124
+ * @param enabled
125
+ */
52
126
  toggleInitialVideoMuteState: () => void;
53
127
  };
54
128
  /**
55
- * Exclude types from documentaiton site, but we should still add doc comments
56
- * @internal
129
+ * Configuration parameters for MediaDevicesProvider.
130
+ * @category Device Management
57
131
  */
58
- export type MediaDevicesProviderProps = PropsWithChildren<{
132
+ export type MediaDevicesProviderProps = {
133
+ /**
134
+ * Provides external control over the initial audio input (microphone) enablement. Overrides the default false.
135
+ */
59
136
  initialAudioEnabled?: boolean;
137
+ /**
138
+ * Provides external control over the initial video input (camera) enablement. Overrides the default false.
139
+ */
60
140
  initialVideoEnabled?: boolean;
141
+ /**
142
+ * Allows to override the default audio input (microphone) stream to be published. Overrides the default string 'default'.
143
+ */
61
144
  initialAudioInputDeviceId?: string;
145
+ /**
146
+ * Allows to override the default audio output (speaker) device to reproduce incoming audio from the SFU. Overrides the default string 'default'.
147
+ */
62
148
  initialAudioOutputDeviceId?: string;
149
+ /**
150
+ * Allows to override the default video input (camera) stream to be published. Overrides the default string 'default'.
151
+ */
63
152
  initialVideoInputDeviceId?: string;
64
- }>;
153
+ };
65
154
  /**
155
+ * Context provider that internally puts in place mechanisms that:
156
+ * 1. fall back to selecting a default device when trying to switch to a non-existent device
157
+ * 2. fall back to a default device when an active device is disconnected
158
+ * 3. stop publishing a media stream when a non-default device is disconnected
159
+ * 4. republish a media stream from the newly connected default device
160
+ * 5. republish a media stream when a new device is selected
66
161
  *
67
- * @param param0
162
+ * Provides `MediaDevicesContextAPI` that allow the integrators to handle:
163
+ * 1. the initial device state enablement (for example apt for lobby scenario)
164
+ * 2. media stream retrieval and disposal
165
+ * 3. media stream publishing
166
+ * 4. specific device selection
167
+ * @param params
68
168
  * @returns
69
169
  *
70
170
  * @category Device Management
71
171
  */
72
- export declare const MediaDevicesProvider: ({ children, initialAudioEnabled, initialVideoEnabled, initialVideoInputDeviceId, initialAudioOutputDeviceId, initialAudioInputDeviceId, }: MediaDevicesProviderProps) => JSX.Element;
172
+ export declare const MediaDevicesProvider: ({ children, initialAudioEnabled, initialVideoEnabled, initialVideoInputDeviceId, initialAudioOutputDeviceId, initialAudioInputDeviceId, }: PropsWithChildren<MediaDevicesProviderProps>) => JSX.Element;
73
173
  /**
74
- *
174
+ * Context consumer retrieving MediaDevicesContextAPI.
75
175
  * @returns
76
176
  *
77
177
  * @category Device Management
@@ -21,7 +21,7 @@ const DEVICE_STATE_TOGGLE = {
21
21
  error: 'starting',
22
22
  };
23
23
  /**
24
- * Exclude types from documentaiton site, but we should still add doc comments
24
+ * Exclude types from documentation site, but we should still add doc comments
25
25
  * @internal
26
26
  */
27
27
  export const DEVICE_STATE = {
@@ -33,10 +33,20 @@ export const DEVICE_STATE = {
33
33
  };
34
34
  const DEFAULT_DEVICE_ID = 'default';
35
35
  const MediaDevicesContext = createContext(null);
36
- // todo: republish the stream, when a new default device connected
37
36
  /**
37
+ * Context provider that internally puts in place mechanisms that:
38
+ * 1. fall back to selecting a default device when trying to switch to a non-existent device
39
+ * 2. fall back to a default device when an active device is disconnected
40
+ * 3. stop publishing a media stream when a non-default device is disconnected
41
+ * 4. republish a media stream from the newly connected default device
42
+ * 5. republish a media stream when a new device is selected
38
43
  *
39
- * @param param0
44
+ * Provides `MediaDevicesContextAPI` that allow the integrators to handle:
45
+ * 1. the initial device state enablement (for example apt for lobby scenario)
46
+ * 2. media stream retrieval and disposal
47
+ * 3. media stream publishing
48
+ * 4. specific device selection
49
+ * @param params
40
50
  * @returns
41
51
  *
42
52
  * @category Device Management
@@ -152,7 +162,7 @@ export const MediaDevicesProvider = ({ children, initialAudioEnabled, initialVid
152
162
  return (_jsx(MediaDevicesContext.Provider, Object.assign({ value: contextValue }, { children: children })));
153
163
  };
154
164
  /**
155
- *
165
+ * Context consumer retrieving MediaDevicesContextAPI.
156
166
  * @returns
157
167
  *
158
168
  * @category Device Management
@@ -1 +1 @@
1
- {"version":3,"file":"MediaDevicesContext.js","sourceRoot":"","sources":["../../../../src/core/contexts/MediaDevicesContext.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EACL,aAAa,EAEb,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,iCAAiC,EACjC,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,SAAS,EACT,qCAAqC,GACtC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,UAAU,CAAC;AA0BlB,MAAM,mBAAmB,GAAoD;IAC3E,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,UAAU;IACnB,aAAa,EAAE,UAAU;IACzB,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MA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AAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,YAAY,GAA2B;QAC3C,oBAAoB;QACpB,cAAc;QACd,cAAc;QACd,4BAA4B;QAC5B,0BAA0B;QAC1B,2BAA2B;QAC3B,qBAAqB;QACrB,YAAY;QACZ,mBAAmB,EAAE,gBAAgB;QACrC,iBAAiB;QACjB,sBAAsB;QACtB,oBAAoB;QACpB,2BAA2B;QAC3B,2BAA2B;QAC3B,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,kBAAC,KAAK,EAAE,YAAY,gBAC9C,QAAQ,IACoB,CAChC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;KAC1C;IACD,OAAO,KAA+B,CAAC;AACzC,CAAC,CAAC"}
1
+ {"version":3,"file":"MediaDevicesContext.js","sourceRoot":"","sources":["../../../../src/core/contexts/MediaDevicesContext.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EACL,aAAa,EAEb,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC3B,OAAO,EACL,YAAY,EACZ,iCAAiC,EACjC,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,SAAS,EACT,qCAAqC,GACtC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,YAAY,GACb,MAAM,iCAAiC,CAAC;AAEzC,OA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,GAAG,qCAAqC,CACxD,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,mBAAmB,CAAC,CAAC,CAC3D,CAAC,SAAS,CAAC,GAAS,EAAE;YACrB,yBAAyB,CAAC,iBAAiB,CAAC,CAAC;QAC/C,CAAC,CAAA,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAExB,MAAM,YAAY,GAA2B;QAC3C,oBAAoB;QACpB,cAAc;QACd,cAAc;QACd,4BAA4B;QAC5B,0BAA0B;QAC1B,2BAA2B;QAC3B,qBAAqB;QACrB,YAAY;QACZ,mBAAmB,EAAE,gBAAgB;QACrC,iBAAiB;QACjB,sBAAsB;QACtB,oBAAoB;QACpB,2BAA2B;QAC3B,2BAA2B;QAC3B,kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,mBAAmB;KACpB,CAAC;IAEF,OAAO,CACL,KAAC,mBAAmB,CAAC,QAAQ,kBAAC,KAAK,EAAE,YAAY,gBAC9C,QAAQ,IACoB,CAChC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,KAAK,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC9C,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;KAC1C;IACD,OAAO,KAA+B,CAAC;AACzC,CAAC,CAAC"}
@@ -59,10 +59,22 @@ export declare const useAudioOutputDeviceFallback: (switchToDefaultDevice: () =>
59
59
  * @param onDisconnect
60
60
  * @category Device Management
61
61
  */
62
- export declare const useOnUnavailableDevices: (observeDevices: () => Observable<MediaDeviceInfo[]>, onDisconnect: () => void) => void;
62
+ export declare const useOnUnavailableDevices: (observeDevices: Observable<MediaDeviceInfo[]>, onDisconnect: () => void) => void;
63
63
  /**
64
64
  * Observes disconnect of all video devices and executes onDisconnect callback
65
65
  * @param onDisconnect
66
66
  * @category Device Management
67
67
  */
68
68
  export declare const useOnUnavailableVideoDevices: (onDisconnect: () => void) => void;
69
+ /**
70
+ * Observes disconnect of all audio input devices and executes onDisconnect callback
71
+ * @param onDisconnect
72
+ * @category Device Management
73
+ */
74
+ export declare const useOnUnavailableAudioInputDevices: (onDisconnect: () => void) => void;
75
+ /**
76
+ * Observes disconnect of all audio output devices and executes onDisconnect callback
77
+ * @param onDisconnect
78
+ * @category Device Management
79
+ */
80
+ export declare const useOnUnavailableAudioOutputDevices: (onDisconnect: () => void) => void;
@@ -83,7 +83,7 @@ export const useAudioOutputDeviceFallback = (switchToDefaultDevice, selectedDevi
83
83
  */
84
84
  export const useOnUnavailableDevices = (observeDevices, onDisconnect) => {
85
85
  useEffect(() => {
86
- const subscription = observeDevices()
86
+ const subscription = observeDevices
87
87
  .pipe(pairwise())
88
88
  .subscribe(([prev, current]) => {
89
89
  if (prev.length > 0 && current.length === 0)
@@ -97,5 +97,17 @@ export const useOnUnavailableDevices = (observeDevices, onDisconnect) => {
97
97
  * @param onDisconnect
98
98
  * @category Device Management
99
99
  */
100
- export const useOnUnavailableVideoDevices = (onDisconnect) => useOnUnavailableDevices(getVideoDevices, onDisconnect);
100
+ export const useOnUnavailableVideoDevices = (onDisconnect) => useOnUnavailableDevices(getVideoDevices(), onDisconnect);
101
+ /**
102
+ * Observes disconnect of all audio input devices and executes onDisconnect callback
103
+ * @param onDisconnect
104
+ * @category Device Management
105
+ */
106
+ export const useOnUnavailableAudioInputDevices = (onDisconnect) => useOnUnavailableDevices(getAudioDevices(), onDisconnect);
107
+ /**
108
+ * Observes disconnect of all audio output devices and executes onDisconnect callback
109
+ * @param onDisconnect
110
+ * @category Device Management
111
+ */
112
+ export const useOnUnavailableAudioOutputDevices = (onDisconnect) => useOnUnavailableDevices(getAudioOutputDevices(), onDisconnect);
101
113
  //# sourceMappingURL=useDevices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDevices.js","sourceRoot":"","sources":["../../../../src/core/hooks/useDevices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAc,QAAQ,EAAE,MAAM,MAAM,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,GAChB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,cAAmD,EACnD,EAAE;IACF,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAoB,EAAE,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE5D,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAErB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAE7E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,QAAuC,EACvC,qBAAiC,EACjC,gBAAyB,EACzB,EAAE;IACF,SAAS,CAAC,GAAG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E,CACF,iBAAiB,CACf,qBAAqB,EAAE,EACvB,qBAAqB,EACrB,gBAAgB,CACjB,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,cAA6C,EAC7C,YAAwB,EACxB,EAAE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,cAAc;aAChC,IAAI,CAAC,QAAQ,EAAE,CAAC;aAChB,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,EAAE;YAC7B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;gBAAE,YAAY,EAAE,CAAC;QAC9D,CAAC,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC,EAAE,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,YAAwB,EAAE,EAAE,CACvE,uBAAuB,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,YAAwB,EAAE,EAAE,CAC5E,uBAAuB,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,YAAwB,EAAE,EAAE,CAC7E,uBAAuB,CAAC,qBAAqB,EAAE,EAAE,YAAY,CAAC,CAAC"}
package/package.json CHANGED
@@ -25,9 +25,9 @@
25
25
  "@floating-ui/react": "^0.22.0",
26
26
  "@nivo/core": "^0.80.0",
27
27
  "@nivo/line": "^0.80.0",
28
- "@stream-io/i18n": "^0.0.1-alpha.37",
29
- "@stream-io/video-client": "^0.0.1-alpha.161",
30
- "@stream-io/video-react-bindings": "^0.0.1-alpha.48",
28
+ "@stream-io/i18n": "^0.0.1-alpha.39",
29
+ "@stream-io/video-client": "^0.0.1-alpha.163",
30
+ "@stream-io/video-react-bindings": "^0.0.1-alpha.50",
31
31
  "clsx": "^1.2.1",
32
32
  "rxjs": "~7.8.1"
33
33
  },
@@ -36,7 +36,7 @@
36
36
  "react-dom": "^18.0.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@stream-io/video-styling": "^0.0.1-alpha.31",
39
+ "@stream-io/video-styling": "^0.0.1-alpha.33",
40
40
  "@types/rimraf": "^3.0.2",
41
41
  "react": "^18.2.0",
42
42
  "react-dom": "^18.2.0",
@@ -45,5 +45,5 @@
45
45
  "typedoc": "^0.24.7",
46
46
  "typescript": "^4.9.5"
47
47
  },
48
- "version": "0.0.1-alpha.53"
48
+ "version": "0.0.1-alpha.55"
49
49
  }
@@ -64,7 +64,7 @@ const DEVICE_STATE_TOGGLE: Record<DeviceStateType, 'starting' | 'stopped'> = {
64
64
  };
65
65
 
66
66
  /**
67
- * Exclude types from documentaiton site, but we should still add doc comments
67
+ * Exclude types from documentation site, but we should still add doc comments
68
68
  * @internal
69
69
  */
70
70
  export const DEVICE_STATE: {
@@ -84,48 +84,148 @@ export const DEVICE_STATE: {
84
84
  const DEFAULT_DEVICE_ID = 'default';
85
85
 
86
86
  /**
87
- * Exclude types from documentaiton site, but we should still add doc comments
88
- * @internal
87
+ * API to control device enablement, device selection and media stream access for a call.
88
+ * @category Device Management
89
89
  */
90
90
  export type MediaDevicesContextAPI = {
91
+ /**
92
+ * Deactivates MediaStream (stops and removes tracks) to be later garbage collected
93
+ *
94
+ * @param stream MediaStream
95
+ * @returns void
96
+ */
91
97
  disposeOfMediaStream: (stream: MediaStream) => void;
98
+ /**
99
+ * Returns an 'audioinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
100
+ *
101
+ * @param deviceId
102
+ * @returns
103
+ */
92
104
  getAudioStream: typeof getAudioStream;
105
+ /**
106
+ * Returns a 'videoinput' media stream with the given `deviceId`, if no `deviceId` is provided, it uses the first available device.
107
+ *
108
+ * @param deviceId
109
+ * @returns
110
+ */
93
111
  getVideoStream: typeof getVideoStream;
112
+ /**
113
+ * [Tells if the browser supports audio output change on 'audio' elements](https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId).
114
+ */
94
115
  isAudioOutputChangeSupported: boolean;
116
+ /**
117
+ * Signals whether audio stream will be published when the call is joined.
118
+ */
95
119
  initialAudioEnabled: boolean;
120
+ /**
121
+ * Signals whether audio stream will be published when the call is joined.
122
+ */
96
123
  initialVideoState: DeviceState;
97
- publishVideoStream: () => Promise<void>;
124
+ /**
125
+ * Publishes audio stream for currently selected audio input (microphone) device to other call participants.
126
+ */
98
127
  publishAudioStream: () => Promise<void>;
128
+ /**
129
+ * Publishes video stream for currently selected video input (camera) device to other call participants.
130
+ */
131
+ publishVideoStream: () => Promise<void>;
132
+ /**
133
+ * Stops publishing audio stream for currently selected audio input (microphone) device to other call participants.
134
+ */
99
135
  stopPublishingAudio: () => void;
136
+ /**
137
+ * Stops publishing video stream for currently selected video input (camera) device to other call participants.
138
+ */
100
139
  stopPublishingVideo: () => void;
140
+ /**
141
+ * Sets the initialAudioEnabled flag to a given boolean value.
142
+ * The latest value set will be used to decide, whether audio stream will be published when joining a call.
143
+ * @param enabled
144
+ */
101
145
  setInitialAudioEnabled: (enabled: boolean) => void;
146
+
147
+ /**
148
+ * Sets the initialVideoState to a given DeviceState value.
149
+ * The latest value set will be used to decide, whether video stream will be published when joining a call.
150
+ * @param enabled
151
+ */
102
152
  setInitialVideoState: (state: DeviceState) => void;
153
+ /**
154
+ * Stores audio input device (microphone) id which is used to publish user's sound to other call participants.
155
+ */
103
156
  selectedAudioInputDeviceId?: string;
157
+ /**
158
+ * Stores audio output device (speaker) id used to reproduce incoming audio from other call participants.
159
+ */
104
160
  selectedAudioOutputDeviceId?: string;
161
+ /**
162
+ * Stores video input device (camera) id which is used to publish user's video to other call participants.
163
+ */
105
164
  selectedVideoDeviceId?: string;
165
+ /**
166
+ * Function should be used to change selected device id.
167
+ * The change is later reflected in selectedAudioInputDeviceId, selectedAudioOutputDeviceId or selectedVideoDeviceId depending on kind parameter.
168
+ * @param kind
169
+ * @param deviceId
170
+ */
106
171
  switchDevice: (kind: MediaDeviceKind, deviceId?: string) => void;
172
+ /**
173
+ * Sets the initialAudioEnabled flag by negating the current state value.
174
+ * The latest value set will be used to decide, whether audio stream will be published when joining a call.
175
+ * @param enabled
176
+ */
107
177
  toggleInitialAudioMuteState: () => void;
178
+ /**
179
+ * Sets the initialVideoState by toggling the current state DeviceState value.
180
+ * The latest value set will be used to decide, whether video stream will be published when joining a call.
181
+ * @param enabled
182
+ */
108
183
  toggleInitialVideoMuteState: () => void;
109
184
  };
110
185
 
111
186
  const MediaDevicesContext = createContext<MediaDevicesContextAPI | null>(null);
112
187
 
113
188
  /**
114
- * Exclude types from documentaiton site, but we should still add doc comments
115
- * @internal
189
+ * Configuration parameters for MediaDevicesProvider.
190
+ * @category Device Management
116
191
  */
117
- export type MediaDevicesProviderProps = PropsWithChildren<{
192
+ export type MediaDevicesProviderProps = {
193
+ /**
194
+ * Provides external control over the initial audio input (microphone) enablement. Overrides the default false.
195
+ */
118
196
  initialAudioEnabled?: boolean;
197
+ /**
198
+ * Provides external control over the initial video input (camera) enablement. Overrides the default false.
199
+ */
119
200
  initialVideoEnabled?: boolean;
201
+ /**
202
+ * Allows to override the default audio input (microphone) stream to be published. Overrides the default string 'default'.
203
+ */
120
204
  initialAudioInputDeviceId?: string;
205
+ /**
206
+ * Allows to override the default audio output (speaker) device to reproduce incoming audio from the SFU. Overrides the default string 'default'.
207
+ */
121
208
  initialAudioOutputDeviceId?: string;
209
+ /**
210
+ * Allows to override the default video input (camera) stream to be published. Overrides the default string 'default'.
211
+ */
122
212
  initialVideoInputDeviceId?: string;
123
- }>;
213
+ };
124
214
 
125
- // todo: republish the stream, when a new default device connected
126
215
  /**
216
+ * Context provider that internally puts in place mechanisms that:
217
+ * 1. fall back to selecting a default device when trying to switch to a non-existent device
218
+ * 2. fall back to a default device when an active device is disconnected
219
+ * 3. stop publishing a media stream when a non-default device is disconnected
220
+ * 4. republish a media stream from the newly connected default device
221
+ * 5. republish a media stream when a new device is selected
127
222
  *
128
- * @param param0
223
+ * Provides `MediaDevicesContextAPI` that allow the integrators to handle:
224
+ * 1. the initial device state enablement (for example apt for lobby scenario)
225
+ * 2. media stream retrieval and disposal
226
+ * 3. media stream publishing
227
+ * 4. specific device selection
228
+ * @param params
129
229
  * @returns
130
230
  *
131
231
  * @category Device Management
@@ -137,7 +237,7 @@ export const MediaDevicesProvider = ({
137
237
  initialVideoInputDeviceId = DEFAULT_DEVICE_ID,
138
238
  initialAudioOutputDeviceId = DEFAULT_DEVICE_ID,
139
239
  initialAudioInputDeviceId = DEFAULT_DEVICE_ID,
140
- }: MediaDevicesProviderProps) => {
240
+ }: PropsWithChildren<MediaDevicesProviderProps>) => {
141
241
  const call = useCall();
142
242
  const callingState = useCallCallingState();
143
243
  const callState = useCallState();
@@ -302,7 +402,7 @@ export const MediaDevicesProvider = ({
302
402
  };
303
403
 
304
404
  /**
305
- *
405
+ * Context consumer retrieving MediaDevicesContextAPI.
306
406
  * @returns
307
407
  *
308
408
  * @category Device Management
@@ -122,11 +122,11 @@ export const useAudioOutputDeviceFallback = (
122
122
  * @category Device Management
123
123
  */
124
124
  export const useOnUnavailableDevices = (
125
- observeDevices: () => Observable<MediaDeviceInfo[]>,
125
+ observeDevices: Observable<MediaDeviceInfo[]>,
126
126
  onDisconnect: () => void,
127
127
  ) => {
128
128
  useEffect(() => {
129
- const subscription = observeDevices()
129
+ const subscription = observeDevices
130
130
  .pipe(pairwise())
131
131
  .subscribe(([prev, current]) => {
132
132
  if (prev.length > 0 && current.length === 0) onDisconnect();
@@ -142,4 +142,20 @@ export const useOnUnavailableDevices = (
142
142
  * @category Device Management
143
143
  */
144
144
  export const useOnUnavailableVideoDevices = (onDisconnect: () => void) =>
145
- useOnUnavailableDevices(getVideoDevices, onDisconnect);
145
+ useOnUnavailableDevices(getVideoDevices(), onDisconnect);
146
+
147
+ /**
148
+ * Observes disconnect of all audio input devices and executes onDisconnect callback
149
+ * @param onDisconnect
150
+ * @category Device Management
151
+ */
152
+ export const useOnUnavailableAudioInputDevices = (onDisconnect: () => void) =>
153
+ useOnUnavailableDevices(getAudioDevices(), onDisconnect);
154
+
155
+ /**
156
+ * Observes disconnect of all audio output devices and executes onDisconnect callback
157
+ * @param onDisconnect
158
+ * @category Device Management
159
+ */
160
+ export const useOnUnavailableAudioOutputDevices = (onDisconnect: () => void) =>
161
+ useOnUnavailableDevices(getAudioOutputDevices(), onDisconnect);