Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initialization advanced #248

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/react-web-core/advanced/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 3,
"label": "Initialization",
"collapsible": true
}
123 changes: 123 additions & 0 deletions docs/react-web-core/advanced/advance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: 'Advance'
sidebar_position: 1
---

## Defaults Configuration

```js
await DyteClient.init({
defaults: {
...
}
})
```

While initializing DyteClient you can pass configuration overrides, the available options are

```ts
type DefaultOptions {
video?: boolean;
audio?: boolean;
screenShare?: {
displaySurface?: 'window' | 'monitor' | 'browser';
};
mediaConfiguration?: {
video?: VideoQualityConstraints,
audio?: AudioQualityConstraints,
}
isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
/**
* If true, will automatically switch audio input and output device
* to a new device connected mid call. (In case of disconnection switch
* will happen automatically in both cases)
*/
autoSwitchAudioDevice?: boolean;
recording?: RecordingConfig;
}
```

### audio

This optional propery is true by default and defines whether audioTrack would be acquired and enabled on SDK initialization

### video

This optional propery is true by default and defines whether videoTrack would be acquired and enabled on SDK initialization

### screenShare.displaySurface

Specifies the _preferred_ screenshare surface, user will still be shown all possible options but the one configured here will be preselected

### mediaConfiguration

Defines media quality configuration

For audio -

```ts
{
echoCancellation?: boolean, // default true
noiseSupression?: boolean, // default true
autoGainControl?: boolean, // default true
enableStereo?: boolean, // default false
enableHighBitrate?: boolean // default false
}
```

For applications where audio quality needs to be high and as loseless as possible

```js
{
echoCancellation: false,
noiseSupression: false,
autoGainControl: false,
enableStereo: true,
enableHighBitrate: true,
}
```

For video -

```ts
{
width: { ideal: number },
height: { ideal: number },
frameRate?: { ideal: number },
}
```

### isNonPreferredDevice

Our SDK will acquire media devices preferring virtual devices to not be selected by default (OBS, iPhone continuity)
You can override this logic by using your own function to decide the preference

```ts
defaults: {
...
isNonPreferredDevice: (device: MediaDeviceInfo) => {
if(device.label.startsWith("Virtual")) {
return false
}
}
}
```

### autoSwitchAudioDevice

By default, when a new audio device is plugged in our SDK switches to that device. You can configure that behaviour

### recording

```ts
{
fileNamePrefix?: string;
videoConfig?: {
height?: number;
width?: number;
codec?: string;
};
}
```

Refer to [recording codec guide](/guides/capabilities/recording/configure-codecs#configure-codecs) for info the `codec` parameter
5 changes: 5 additions & 0 deletions docs/web-core/advanced/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 3,
"label": "Initialization",
"collapsible": true
}
123 changes: 123 additions & 0 deletions docs/web-core/advanced/advance.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
---
title: 'Advance'
sidebar_position: 1
---

## Defaults Configuration

```js
await DyteClient.init({
defaults: {
...
}
})
```

While initializing DyteClient you can pass configuration overrides, the available options are

```ts
type DefaultOptions {
video?: boolean;
audio?: boolean;
screenShare?: {
displaySurface?: 'window' | 'monitor' | 'browser';
};
mediaConfiguration?: {
video?: VideoQualityConstraints,
audio?: AudioQualityConstraints,
}
isNonPreferredDevice?: (device: MediaDeviceInfo) => boolean;
/**
* If true, will automatically switch audio input and output device
* to a new device connected mid call. (In case of disconnection switch
* will happen automatically in both cases)
*/
autoSwitchAudioDevice?: boolean;
recording?: RecordingConfig;
}
```

### audio

This optional propery is true by default and defines whether audioTrack would be acquired and enabled on SDK initialization

### video

This optional propery is true by default and defines whether videoTrack would be acquired and enabled on SDK initialization

### screenShare.displaySurface

Specifies the _preferred_ screenshare surface, user will still be shown all possible options but the one configured here will be preselected

### mediaConfiguration

Defines media quality configuration

For audio -

```ts
{
echoCancellation?: boolean, // default true
noiseSupression?: boolean, // default true
autoGainControl?: boolean, // default true
enableStereo?: boolean, // default false
enableHighBitrate?: boolean // default false
}
```

For applications where audio quality needs to be high and as loseless as possible

```js
{
echoCancellation: false,
noiseSupression: false,
autoGainControl: false,
enableStereo: true,
enableHighBitrate: true,
}
```

For video -

```ts
{
width: { ideal: number },
height: { ideal: number },
frameRate?: { ideal: number },
}
```

### isNonPreferredDevice

Our SDK will acquire media devices preferring virtual devices to not be selected by default (OBS, iPhone continuity)
You can override this logic by using your own function to decide the preference

```ts
defaults: {
...
isNonPreferredDevice: (device: MediaDeviceInfo) => {
if(device.label.startsWith("Virtual")) {
return false
}
}
}
```

### autoSwitchAudioDevice

By default, when a new audio device is plugged in our SDK switches to that device. You can configure that behaviour

### recording

```ts
{
fileNamePrefix?: string;
videoConfig?: {
height?: number;
width?: number;
codec?: string;
};
}
```

Refer to [recording codec guide](/guides/capabilities/recording/configure-codecs#configure-codecs) for info the `codec` parameter
Loading