covekit 0.1.2 → 0.1.3
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 +4 -6
- package/dist/index.d.ts +6 -2
- package/dist/index.js +12 -5
- package/dist/room.d.ts +1 -1
- package/dist/room.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,11 +50,7 @@ Orchestrate the WebRTC media transports programmatically to build a custom UI.
|
|
|
50
50
|
```typescript
|
|
51
51
|
import { CoveKitClient, CoveKitRoom } from 'covekit';
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
const client = new CoveKitClient(
|
|
55
|
-
'https://api.covekit.com', // Control Plane API
|
|
56
|
-
'wss://media.covekit.com/v1/media/ws' // Real-Time Signaling WS
|
|
57
|
-
);
|
|
53
|
+
const client = new CoveKitClient();
|
|
58
54
|
|
|
59
55
|
// 1. Get meeting token
|
|
60
56
|
const session = await client.joinPublicMeeting('lobby-room', 'Alice');
|
|
@@ -109,7 +105,9 @@ Main client class for talking to the CoveKit Control Plane.
|
|
|
109
105
|
|
|
110
106
|
#### Constructor
|
|
111
107
|
```typescript
|
|
112
|
-
new CoveKitClient(apiBaseUrl
|
|
108
|
+
new CoveKitClient(config?: { apiBaseUrl?: string; mediaWsUrl?: string })
|
|
109
|
+
// or positional overrides (for backwards compatibility):
|
|
110
|
+
new CoveKitClient(apiBaseUrl?: string, mediaWsUrl?: string)
|
|
113
111
|
```
|
|
114
112
|
|
|
115
113
|
#### Methods
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { ServerMessage } from './protocol';
|
|
2
|
+
export interface CoveKitClientConfig {
|
|
3
|
+
apiBaseUrl?: string;
|
|
4
|
+
mediaWsUrl?: string;
|
|
5
|
+
}
|
|
2
6
|
export declare class CoveKitClient {
|
|
3
7
|
private apiBaseUrl;
|
|
4
8
|
private mediaWsUrl;
|
|
5
9
|
private ws;
|
|
6
|
-
constructor(
|
|
10
|
+
constructor(apiBaseUrlOrConfig?: string | CoveKitClientConfig, mediaWsUrl?: string);
|
|
7
11
|
/**
|
|
8
12
|
* Control Plane REST: Fetch public meeting minimal info
|
|
9
13
|
*/
|
|
@@ -31,7 +35,7 @@ export declare class CoveKitClient {
|
|
|
31
35
|
/**
|
|
32
36
|
* Real-Time Plane WS: Initiates native signaling channel loops
|
|
33
37
|
*/
|
|
34
|
-
connectMediaServer(token: string, onMessage: (msg: ServerMessage) => void): Promise<WebSocket>;
|
|
38
|
+
connectMediaServer(token: string, onMessage: (msg: ServerMessage) => void, mediaWsUrlOverride?: string): Promise<WebSocket>;
|
|
35
39
|
private sendSignal;
|
|
36
40
|
requestCapabilities(): void;
|
|
37
41
|
createWebRtcTransport(direction: 'send' | 'recv'): void;
|
package/dist/index.js
CHANGED
|
@@ -14,10 +14,16 @@ function shallowCamelizeKeys(obj) {
|
|
|
14
14
|
return out;
|
|
15
15
|
}
|
|
16
16
|
export class CoveKitClient {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(apiBaseUrlOrConfig, mediaWsUrl) {
|
|
18
18
|
this.ws = null;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
if (apiBaseUrlOrConfig && typeof apiBaseUrlOrConfig === 'object') {
|
|
20
|
+
this.apiBaseUrl = apiBaseUrlOrConfig.apiBaseUrl || 'https://api.covekit.com';
|
|
21
|
+
this.mediaWsUrl = apiBaseUrlOrConfig.mediaWsUrl || 'wss://media.covekit.com/v1/media/ws';
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.apiBaseUrl = apiBaseUrlOrConfig || 'https://api.covekit.com';
|
|
25
|
+
this.mediaWsUrl = mediaWsUrl || 'wss://media.covekit.com/v1/media/ws';
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
/**
|
|
23
29
|
* Control Plane REST: Fetch public meeting minimal info
|
|
@@ -98,9 +104,10 @@ export class CoveKitClient {
|
|
|
98
104
|
/**
|
|
99
105
|
* Real-Time Plane WS: Initiates native signaling channel loops
|
|
100
106
|
*/
|
|
101
|
-
connectMediaServer(token, onMessage) {
|
|
107
|
+
connectMediaServer(token, onMessage, mediaWsUrlOverride) {
|
|
102
108
|
return new Promise((resolve, reject) => {
|
|
103
|
-
|
|
109
|
+
const wsUrl = mediaWsUrlOverride || this.mediaWsUrl;
|
|
110
|
+
this.ws = new WebSocket(wsUrl);
|
|
104
111
|
this.ws.onopen = () => {
|
|
105
112
|
console.log('Signaling pipe open. Launching cryptographic token validation handshake.');
|
|
106
113
|
this.sendSignal('init', { token });
|
package/dist/room.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare class CoveKitRoom {
|
|
|
41
41
|
private iceServers?;
|
|
42
42
|
private pingInterval;
|
|
43
43
|
constructor(client: CoveKitClient, events: CoveKitRoomEvents);
|
|
44
|
-
join(token: string, iceServers?: any[]): Promise<void>;
|
|
44
|
+
join(token: string, iceServers?: any[], mediaWsUrlOverride?: string): Promise<void>;
|
|
45
45
|
publishLocalMedia(audio: boolean, video: boolean, audioDeviceId?: string, existingStream?: MediaStream): Promise<void>;
|
|
46
46
|
private handleSignal;
|
|
47
47
|
private initializeTransport;
|
package/dist/room.js
CHANGED
|
@@ -21,12 +21,12 @@ export class CoveKitRoom {
|
|
|
21
21
|
this.client = client;
|
|
22
22
|
this.events = events;
|
|
23
23
|
}
|
|
24
|
-
async join(token, iceServers) {
|
|
24
|
+
async join(token, iceServers, mediaWsUrlOverride) {
|
|
25
25
|
try {
|
|
26
26
|
this.iceServers = iceServers;
|
|
27
27
|
this.device = new Device();
|
|
28
28
|
// Connect to WebSocket signaling server
|
|
29
|
-
await this.client.connectMediaServer(token, (msg) => this.handleSignal(msg));
|
|
29
|
+
await this.client.connectMediaServer(token, (msg) => this.handleSignal(msg), mediaWsUrlOverride);
|
|
30
30
|
// Start heartbeat every 15 seconds
|
|
31
31
|
this.pingInterval = window.setInterval(() => {
|
|
32
32
|
this.client.sendPing();
|