Skip to content

Commit e02d224

Browse files
authored
Elaborate on initializeDevices details, minor improvements (#109)
1 parent bbf8311 commit e02d224

File tree

6 files changed

+27
-10
lines changed

6 files changed

+27
-10
lines changed

docs/audio-calls.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Using this feature is as easy as setting the `roomType` field to `audio_only` wh
3636

3737
```python
3838
options = RoomOptions(room_type="audio_only")
39-
created_room = fishjam_client.create_room()
39+
created_room = fishjam_client.create_room(options)
4040
```
4141

4242
</TabItem>

docs/react/start-streaming.mdx

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ To ask the browser for permission to list the available devices,
1111
call the [`initializeDevices`](/api/web/functions/useInitializeDevices#initializedevices)
1212
function from [`useInitializeDevices`](/api/web/functions/useInitializeDevices) hook.
1313

14+
You can choose whether to initialize both camera and microphone devices or just one of them by passing [`InitializeDevicesSettings`](/api/web/type-aliases/InitializeDevicesSettings)
15+
as an argument. By default, both camera and microphone are initialized.
16+
17+
The [`initializeDevices`](/api/web/functions/useInitializeDevices#initializedevices) function will return a [`Promise<InitializeDevicesResult>`](/api/web/type-aliases/InitializeDevicesResult) object.
18+
1419
```ts
1520
import { useEffect } from "react";
1621
import { useInitializeDevices } from "@fishjam-cloud/react-client";
@@ -19,19 +24,24 @@ export function useExample() {
1924
const { initializeDevices } = useInitializeDevices();
2025

2126
useEffect(() => {
22-
initializeDevices();
27+
initializeDevices().then((result) => {
28+
// optionally handle the result
29+
console.log(result);
30+
});
2331
}, [initializeDevices]);
2432
}
2533
```
2634

27-
:::info
28-
The code above will make the browser ask the user for camera and microphone permissions.
35+
:::note
36+
The [`useInitializeDevices`](/api/web/functions/useInitializeDevices) hook gives you the convenience of asking the user for all permissions at once.
37+
38+
It is not the only way to enable the device. You can just toggle the device using [`useCamera`](/api/web/functions/useCamera) or [`useMicrophone`](/api/web/functions/useMicrophone) hooks.
2939
:::
3040

3141
### Device API
3242

3343
To manage users' camera and microphone devices, use the respective [`useCamera`](/api/web/functions/useCamera)
34-
and [`useMicrophone`](/api/web/functions/useMicrophone) hooks.
44+
and [`useMicrophone`](/api/web/functions/useMicrophone) hooks.
3545
Both of them has similar API. To keep things simple, we will just use the camera hook.
3646

3747
```tsx

packages/mobile-client-sdk

Submodule mobile-client-sdk updated 98 files

packages/web-client-sdk

Submodule web-client-sdk updated 85 files

src/css/custom.css

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
--ifm-color-primary-lightest: #4fddbf;
2929
--docusaurus-highlighted-code-line-bg: rgba(0, 0, 0, 0.3);
3030
}
31-
31+
html[data-theme="light"] body {
32+
color: #221f1c;
33+
}
3234
html[data-theme="light"] footer.footer {
3335
background-color: #fcf4e4;
3436
}
@@ -37,5 +39,10 @@ html[data-theme="light"] nav.navbar--fixed-top {
3739
}
3840
html[data-theme="light"] header.heroBanner_src-pages-index-module {
3941
background-color: #9bdcfb;
40-
color: #000;
42+
color: #221f1c;
43+
}
44+
45+
.navbar__search input {
46+
border-radius: var(--ifm-global-radius);
47+
background-color: white;
4148
}

0 commit comments

Comments
 (0)