video-saas-client 0.1.1
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/README.md +54 -0
- package/dist/index.js +15213 -0
- package/dist/index.mjs +15208 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# video-saas-client
|
|
2
|
+
|
|
3
|
+
Video calling SDK for Video SaaS. Connect to video rooms with API key authentication.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install video-saas-client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```jsx
|
|
14
|
+
import { useVideoCall } from "video-saas-client";
|
|
15
|
+
|
|
16
|
+
function MyVideoCall({ roomId }) {
|
|
17
|
+
const {
|
|
18
|
+
localStream,
|
|
19
|
+
remoteStreams,
|
|
20
|
+
isConnected,
|
|
21
|
+
error,
|
|
22
|
+
leaveRoom,
|
|
23
|
+
} = useVideoCall(roomId, {
|
|
24
|
+
apiKey: "your-api-key",
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div>
|
|
29
|
+
{localStream && <video ref={el => { if (el) el.srcObject = localStream; }} muted autoPlay />}
|
|
30
|
+
{Array.from(remoteStreams.entries()).map(([peerId, stream]) => (
|
|
31
|
+
<video key={peerId} ref={el => { if (el) el.srcObject = stream; }} autoPlay />
|
|
32
|
+
))}
|
|
33
|
+
<button onClick={leaveRoom}>Leave</button>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API
|
|
40
|
+
|
|
41
|
+
### `useVideoCall(roomId, options)`
|
|
42
|
+
|
|
43
|
+
- **roomId** (string): Room ID to join
|
|
44
|
+
- **options** (object):
|
|
45
|
+
- **apiKey** (string, required): Your API key
|
|
46
|
+
|
|
47
|
+
### Returns
|
|
48
|
+
|
|
49
|
+
- **localStream**: MediaStream | null
|
|
50
|
+
- **remoteStreams**: Map<peerId, MediaStream>
|
|
51
|
+
- **isConnected**: boolean
|
|
52
|
+
- **error**: string | null
|
|
53
|
+
- **leaveRoom**: () => void
|
|
54
|
+
- **startRecording**, **stopRecording**, **isRecording**, **recordingIds**: Recording APIs (if supported by server)
|