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

docs(video): update push video docs #858

Merged
merged 3 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
echo "\nRunning GIT hooks..."
yarn cleanbuild
yarn nx affected --target=lint
yarn nx affected --target=test
# yarn nx affected --target=test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be commited

Copy link
Contributor Author

@madhur-push madhur-push Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. 😅 Will do.

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/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