Skip to content

Commit

Permalink
docs(video): update push video docs
Browse files Browse the repository at this point in the history
  • Loading branch information
madhur-push committed Nov 20, 2023
1 parent 33e0ca9 commit a7483f9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@pushprotocol/restapi": "^1.4.38",
"@pushprotocol/restapi": "^1.4.39",
"@pushprotocol/socket": "^0.5.1",
"@pushprotocol/uiweb": "^1.1.8",
"@rainbow-me/rainbowkit": "0.12.14",
Expand Down
70 changes: 36 additions & 34 deletions packages/restapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5598,7 +5598,7 @@ export type VideoCallData = {
video: boolean | null; // local video status
address: string; // local address
};
incoming: [PeerData];
incoming: PeerData[];
};

private data: VideoCallData;
Expand Down Expand Up @@ -5647,14 +5647,14 @@ constructor({
}) {}
```

Allowed Options (params with _ are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| signer_ | SignerType | - | signer object for a user |
| chainId* | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 |
| pgpPrivatekey* | string | - | PGP private key of the user, used while sending video call notifications |
| env | string | 'prod' | API env - 'prod', 'staging', 'dev'|
| setData\* | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data |
| signer | SignerType | - | signer object for a user |
| chainId | number | - | chainId for the video call - Eth Mainnet: 1, Polygon Mainnet: 137 |
| pgpPrivatekey | string | - | PGP private key of the user, used while sending video call notifications |
| env* | string | 'prod' | API env - 'prod', 'staging', 'dev'|
| setData | `(fn: (data: VideoCallData) => VideoCallData) => void` | - | Function to update video call data |

---

Expand All @@ -5667,16 +5667,18 @@ Allowed Options (params with _ are mandatory)
export type VideoCreateInputOptions = {
video?: boolean;
audio?: boolean;
stream?: MediaStream; // for backend use
};

async create(options: VideoCreateInputOptions): Promise<void> {}
```

Allowed Options (params with \* are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| video | boolean | true | video status for the local stream |
| audio | boolean | true | audio status for the local stream |
| video* | boolean | true | video status for the local stream |
| audio* | boolean | true | audio status for the local stream |
| stream* | MediaStream | null | local stream, for backend use |

Note - If audio, video aren't enabled in create() then they wont be available during the call respectively.

Expand All @@ -5690,7 +5692,7 @@ Note - If audio, video aren't enabled in create() then they wont be available du
```typescript
export type VideoRequestInputOptions = {
senderAddress: string;
recipientAddress: string;
recipientAddress: string | string[];
chatId: string;
onReceiveMessage?: (message: string) => void;
retry?: boolean;
Expand All @@ -5699,14 +5701,14 @@ export type VideoRequestInputOptions = {
async request(options: VideoRequestInputOptions): Promise<void> {}
```

Allowed Options (params with _ are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| senderAddress_ | string | - | Local peer address |
| recipientAddress* | string | - | Incoming/remote peer address |
| chatId* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation |
| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel |
| retry | boolean | false | If we are retrying the call, only for internal use |
| senderAddress | string | - | Wallet address of the local user |
| recipientAddress | string, string[] | - | Wallet addresses of users you want to call, single address for wallet to wallet call and array of addresses for group call |
| chatId | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation |
| onReceiveMessage* | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel |
| retry* | boolean | false | If we are retrying the call, only for internal use |

---

Expand All @@ -5728,15 +5730,15 @@ export type VideoAcceptRequestInputOptions = {
async acceptRequest(options: VideoAcceptRequestInputOptions): Promise<void> {}
```

Allowed Options (params with _ are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| signalData_ | any | - | Signal data received from the initiator peer via psuh notification upon call request |
| senderAddress* | string | - | Local peer address |
| recipientAddress* | string | - | Incoming/remote peer address |
| chatId\* | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation |
| onReceiveMessage | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel |
| retry | boolean | false | If we are retrying the call, only for internal use |
| signalData | any | - | Signal data received from the initiator peer via psuh notification upon call request |
| senderAddress | string | - | Local peer address |
| recipientAddress | string | - | Incoming/remote peer address |
| chatId | string | - | Unique identifier for every wallet-to-wallet push chat, will be used during verification proof generation |
| onReceiveMessage* | `(message: string) => void` | `(message: string) => {console.log('received a meesage', message);}` | Function which will be called when the sender receives a message via webRTC data channel |
| retry* | boolean | false | If we are retrying the call, only for internal use |

---

Expand All @@ -5754,11 +5756,11 @@ export type VideoConnectInputOptions = {
connect(options: VideoConnectInputOptions): void {}
```

Allowed Options (params with _ are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| signalData_ | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest |
| peerAddress | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest |
| signalData | any | - | Signal data received from the receiver peer via push notification upon call acceptRequest |
| peerAddress* | string | data.incoming[0].address | Address of the receiver peer, received via push notification upon call acceptRequest |

---

Expand All @@ -5770,15 +5772,15 @@ Allowed Options (params with _ are mandatory)
```typescript
export type VideoDisconnectOptions = {
peerAddress: string;
} | null;
};

disconnect(options: VideoDisconnectOptions): void {}
disconnect(options?: VideoDisconnectOptions): void {}
```

Allowed Options (params with \* are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| peerAddress | string | data.incoming[0].address | Address of the peer to be disconnected from |
| peerAddress* | string | data.incoming[0].address | Address of the peer to be disconnected from |

---

Expand All @@ -5789,14 +5791,14 @@ Allowed Options (params with \* are mandatory)
- **Note -** If video was not enabled during `create()` then it will always remain off.

```typescript
export type EnableVideoInputOptions = {
export type EnableVideoInputOptions = {
state: boolean;
}

enableVideo(options: EnableVideoInputOptions): void
```

Allowed Options (params with \* are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| state | boolean | - | true for enable and false for disable |
Expand All @@ -5817,7 +5819,7 @@ export type EnableAudioInputOptions = {
enableAudio(options: EnableAudioInputOptions): void
```

Allowed Options (params with \* are mandatory)
Allowed Options (params with * are optional)
| Param | Type | Default | Remarks |
|----------|---------|---------|--------------------------------------------|
| state | boolean | - | true for enable and false for disable |
Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ export type VideoDisconnectOptions = {
type: SPACE_DISCONNECT_TYPE;
data: Record<string, unknown>;
};
} | null;
};

export type EnableVideoInputOptions = {
state: boolean;
Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/video/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ export class Video {
}
}

disconnect(options: VideoDisconnectOptions): void {
disconnect(options?: VideoDisconnectOptions): void {
const { peerAddress, details } = options || {};

try {
Expand Down

0 comments on commit a7483f9

Please sign in to comment.