@fishjam-cloud/js-server-sdk 0.21.0 → 0.22.0
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/dist/index.d.mts +105 -64
- package/dist/index.d.ts +105 -64
- package/dist/index.js +1090 -129
- package/dist/index.mjs +1090 -129
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -27,10 +27,16 @@ interface Peer$1 {
|
|
|
27
27
|
'status': PeerStatus;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
|
-
* @type {
|
|
30
|
+
* @type {SubscribeMode}
|
|
31
31
|
* @memberof Peer
|
|
32
32
|
*/
|
|
33
|
-
'
|
|
33
|
+
'subscribeMode': SubscribeMode;
|
|
34
|
+
/**
|
|
35
|
+
* Describes peer\'s subscriptions in manual mode
|
|
36
|
+
* @type {Array<string>}
|
|
37
|
+
* @memberof Peer
|
|
38
|
+
*/
|
|
39
|
+
'subscriptions': Array<string>;
|
|
34
40
|
/**
|
|
35
41
|
* List of all peer\'s tracks
|
|
36
42
|
* @type {Array<Track>}
|
|
@@ -49,7 +55,59 @@ interface Peer$1 {
|
|
|
49
55
|
* Peer-specific options
|
|
50
56
|
* @export
|
|
51
57
|
*/
|
|
52
|
-
type PeerOptions =
|
|
58
|
+
type PeerOptions = PeerOptionsAgent | PeerOptionsWebRTC;
|
|
59
|
+
/**
|
|
60
|
+
* Options specific to the Agent peer
|
|
61
|
+
* @export
|
|
62
|
+
* @interface PeerOptionsAgent
|
|
63
|
+
*/
|
|
64
|
+
interface PeerOptionsAgent {
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @type {PeerOptionsAgentOutput}
|
|
68
|
+
* @memberof PeerOptionsAgent
|
|
69
|
+
*/
|
|
70
|
+
'output'?: PeerOptionsAgentOutput;
|
|
71
|
+
/**
|
|
72
|
+
* Configuration of peer\'s subscribing policy
|
|
73
|
+
* @type {string}
|
|
74
|
+
* @memberof PeerOptionsAgent
|
|
75
|
+
*/
|
|
76
|
+
'subscribeMode'?: PeerOptionsAgentSubscribeModeEnum;
|
|
77
|
+
}
|
|
78
|
+
declare const PeerOptionsAgentSubscribeModeEnum: {
|
|
79
|
+
readonly Auto: "auto";
|
|
80
|
+
readonly Manual: "manual";
|
|
81
|
+
};
|
|
82
|
+
type PeerOptionsAgentSubscribeModeEnum = typeof PeerOptionsAgentSubscribeModeEnum[keyof typeof PeerOptionsAgentSubscribeModeEnum];
|
|
83
|
+
/**
|
|
84
|
+
* Output audio options
|
|
85
|
+
* @export
|
|
86
|
+
* @interface PeerOptionsAgentOutput
|
|
87
|
+
*/
|
|
88
|
+
interface PeerOptionsAgentOutput {
|
|
89
|
+
/**
|
|
90
|
+
* The format of the output audio
|
|
91
|
+
* @type {string}
|
|
92
|
+
* @memberof PeerOptionsAgentOutput
|
|
93
|
+
*/
|
|
94
|
+
'audioFormat'?: PeerOptionsAgentOutputAudioFormatEnum;
|
|
95
|
+
/**
|
|
96
|
+
* The sample rate of the output audio
|
|
97
|
+
* @type {number}
|
|
98
|
+
* @memberof PeerOptionsAgentOutput
|
|
99
|
+
*/
|
|
100
|
+
'audioSampleRate'?: PeerOptionsAgentOutputAudioSampleRateEnum;
|
|
101
|
+
}
|
|
102
|
+
declare const PeerOptionsAgentOutputAudioFormatEnum: {
|
|
103
|
+
readonly Pcm16: "pcm16";
|
|
104
|
+
};
|
|
105
|
+
type PeerOptionsAgentOutputAudioFormatEnum = typeof PeerOptionsAgentOutputAudioFormatEnum[keyof typeof PeerOptionsAgentOutputAudioFormatEnum];
|
|
106
|
+
declare const PeerOptionsAgentOutputAudioSampleRateEnum: {
|
|
107
|
+
readonly NUMBER_16000: 16000;
|
|
108
|
+
readonly NUMBER_24000: 24000;
|
|
109
|
+
};
|
|
110
|
+
type PeerOptionsAgentOutputAudioSampleRateEnum = typeof PeerOptionsAgentOutputAudioSampleRateEnum[keyof typeof PeerOptionsAgentOutputAudioSampleRateEnum];
|
|
53
111
|
/**
|
|
54
112
|
* Options specific to the WebRTC peer
|
|
55
113
|
* @export
|
|
@@ -71,12 +129,17 @@ interface PeerOptionsWebRTC {
|
|
|
71
129
|
[key: string]: any;
|
|
72
130
|
};
|
|
73
131
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @type {
|
|
132
|
+
* Configuration of peer\'s subscribing policy
|
|
133
|
+
* @type {string}
|
|
76
134
|
* @memberof PeerOptionsWebRTC
|
|
77
135
|
*/
|
|
78
|
-
'
|
|
136
|
+
'subscribeMode'?: PeerOptionsWebRTCSubscribeModeEnum;
|
|
79
137
|
}
|
|
138
|
+
declare const PeerOptionsWebRTCSubscribeModeEnum: {
|
|
139
|
+
readonly Auto: "auto";
|
|
140
|
+
readonly Manual: "manual";
|
|
141
|
+
};
|
|
142
|
+
type PeerOptionsWebRTCSubscribeModeEnum = typeof PeerOptionsWebRTCSubscribeModeEnum[keyof typeof PeerOptionsWebRTCSubscribeModeEnum];
|
|
80
143
|
/**
|
|
81
144
|
* Informs about the peer status
|
|
82
145
|
* @export
|
|
@@ -140,6 +203,7 @@ declare const RoomConfigRoomTypeEnum: {
|
|
|
140
203
|
readonly Broadcaster: "broadcaster";
|
|
141
204
|
readonly Livestream: "livestream";
|
|
142
205
|
readonly Conference: "conference";
|
|
206
|
+
readonly AudioOnlyLivestream: "audio_only_livestream";
|
|
143
207
|
};
|
|
144
208
|
type RoomConfigRoomTypeEnum = typeof RoomConfigRoomTypeEnum[keyof typeof RoomConfigRoomTypeEnum];
|
|
145
209
|
declare const RoomConfigVideoCodecEnum: {
|
|
@@ -161,69 +225,23 @@ interface StreamerToken {
|
|
|
161
225
|
'token': string;
|
|
162
226
|
}
|
|
163
227
|
/**
|
|
164
|
-
* Configuration of
|
|
165
|
-
* @export
|
|
166
|
-
* @interface SubscribeOptions
|
|
167
|
-
*/
|
|
168
|
-
interface SubscribeOptions {
|
|
169
|
-
/**
|
|
170
|
-
* The format of the output audio
|
|
171
|
-
* @type {string}
|
|
172
|
-
* @memberof SubscribeOptions
|
|
173
|
-
*/
|
|
174
|
-
'audioFormat'?: SubscribeOptionsAudioFormatEnum;
|
|
175
|
-
/**
|
|
176
|
-
* The sample rate of the output audio
|
|
177
|
-
* @type {number}
|
|
178
|
-
* @memberof SubscribeOptions
|
|
179
|
-
*/
|
|
180
|
-
'audioSampleRate'?: SubscribeOptionsAudioSampleRateEnum;
|
|
181
|
-
}
|
|
182
|
-
declare const SubscribeOptionsAudioFormatEnum: {
|
|
183
|
-
readonly Pcm16: "pcm16";
|
|
184
|
-
};
|
|
185
|
-
type SubscribeOptionsAudioFormatEnum = typeof SubscribeOptionsAudioFormatEnum[keyof typeof SubscribeOptionsAudioFormatEnum];
|
|
186
|
-
declare const SubscribeOptionsAudioSampleRateEnum: {
|
|
187
|
-
readonly NUMBER_16000: 16000;
|
|
188
|
-
readonly NUMBER_24000: 24000;
|
|
189
|
-
};
|
|
190
|
-
type SubscribeOptionsAudioSampleRateEnum = typeof SubscribeOptionsAudioSampleRateEnum[keyof typeof SubscribeOptionsAudioSampleRateEnum];
|
|
191
|
-
/**
|
|
192
|
-
* Configuration of server-side subscriptions to the peer\'s tracks
|
|
228
|
+
* Configuration of peer\'s subscribing policy
|
|
193
229
|
* @export
|
|
194
|
-
* @
|
|
230
|
+
* @enum {string}
|
|
195
231
|
*/
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
* @type {string}
|
|
200
|
-
* @memberof SubscribeOptions1
|
|
201
|
-
*/
|
|
202
|
-
'audioFormat'?: SubscribeOptions1AudioFormatEnum;
|
|
203
|
-
/**
|
|
204
|
-
* The sample rate of the output audio
|
|
205
|
-
* @type {number}
|
|
206
|
-
* @memberof SubscribeOptions1
|
|
207
|
-
*/
|
|
208
|
-
'audioSampleRate'?: SubscribeOptions1AudioSampleRateEnum;
|
|
209
|
-
}
|
|
210
|
-
declare const SubscribeOptions1AudioFormatEnum: {
|
|
211
|
-
readonly Pcm16: "pcm16";
|
|
212
|
-
};
|
|
213
|
-
type SubscribeOptions1AudioFormatEnum = typeof SubscribeOptions1AudioFormatEnum[keyof typeof SubscribeOptions1AudioFormatEnum];
|
|
214
|
-
declare const SubscribeOptions1AudioSampleRateEnum: {
|
|
215
|
-
readonly NUMBER_16000: 16000;
|
|
216
|
-
readonly NUMBER_24000: 24000;
|
|
232
|
+
declare const SubscribeMode: {
|
|
233
|
+
readonly Auto: "auto";
|
|
234
|
+
readonly Manual: "manual";
|
|
217
235
|
};
|
|
218
|
-
type
|
|
236
|
+
type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode];
|
|
219
237
|
/**
|
|
220
|
-
* Describes media track of a Peer
|
|
238
|
+
* Describes media track of a Peer
|
|
221
239
|
* @export
|
|
222
240
|
* @interface Track
|
|
223
241
|
*/
|
|
224
242
|
interface Track$1 {
|
|
225
243
|
/**
|
|
226
|
-
*
|
|
244
|
+
* Assigned track id
|
|
227
245
|
* @type {string}
|
|
228
246
|
* @memberof Track
|
|
229
247
|
*/
|
|
@@ -327,10 +345,14 @@ interface ServerMessage {
|
|
|
327
345
|
trackMetadataUpdated?: ServerMessage_TrackMetadataUpdated | undefined;
|
|
328
346
|
peerAdded?: ServerMessage_PeerAdded | undefined;
|
|
329
347
|
peerDeleted?: ServerMessage_PeerDeleted | undefined;
|
|
348
|
+
/** @deprecated */
|
|
330
349
|
streamConnected?: ServerMessage_StreamConnected | undefined;
|
|
350
|
+
/** @deprecated */
|
|
331
351
|
streamDisconnected?: ServerMessage_StreamDisconnected | undefined;
|
|
332
352
|
viewerConnected?: ServerMessage_ViewerConnected | undefined;
|
|
333
353
|
viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
|
|
354
|
+
streamerConnected?: ServerMessage_StreamerConnected | undefined;
|
|
355
|
+
streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined;
|
|
334
356
|
}
|
|
335
357
|
declare const ServerMessage: MessageFns$1<ServerMessage>;
|
|
336
358
|
/** Notification sent when a room crashes */
|
|
@@ -479,6 +501,16 @@ interface ServerMessage_ViewerDisconnected {
|
|
|
479
501
|
viewerId: string;
|
|
480
502
|
}
|
|
481
503
|
declare const ServerMessage_ViewerDisconnected: MessageFns$1<ServerMessage_ViewerDisconnected>;
|
|
504
|
+
interface ServerMessage_StreamerConnected {
|
|
505
|
+
streamId: string;
|
|
506
|
+
streamerId: string;
|
|
507
|
+
}
|
|
508
|
+
declare const ServerMessage_StreamerConnected: MessageFns$1<ServerMessage_StreamerConnected>;
|
|
509
|
+
interface ServerMessage_StreamerDisconnected {
|
|
510
|
+
streamId: string;
|
|
511
|
+
streamerId: string;
|
|
512
|
+
}
|
|
513
|
+
declare const ServerMessage_StreamerDisconnected: MessageFns$1<ServerMessage_StreamerDisconnected>;
|
|
482
514
|
type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
483
515
|
type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? {
|
|
484
516
|
[K in keyof T]?: DeepPartial$1<T[K]>;
|
|
@@ -606,8 +638,7 @@ type Room = {
|
|
|
606
638
|
config: RoomConfig;
|
|
607
639
|
};
|
|
608
640
|
type FishjamConfig = {
|
|
609
|
-
fishjamId
|
|
610
|
-
fishjamUrl?: string;
|
|
641
|
+
fishjamId: string;
|
|
611
642
|
managementToken: string;
|
|
612
643
|
};
|
|
613
644
|
type ErrorEventHandler = (msg: Event) => void;
|
|
@@ -721,7 +752,7 @@ declare class FishjamAgent extends FishjamAgent_base {
|
|
|
721
752
|
|
|
722
753
|
/**
|
|
723
754
|
* Client class that allows to manage Rooms and Peers for a Fishjam App.
|
|
724
|
-
* It requires the Fishjam
|
|
755
|
+
* It requires the Fishjam ID and management token that can be retrieved from the Fishjam Dashboard.
|
|
725
756
|
* @category Client
|
|
726
757
|
*/
|
|
727
758
|
declare class FishjamClient {
|
|
@@ -735,7 +766,7 @@ declare class FishjamClient {
|
|
|
735
766
|
* Example usage:
|
|
736
767
|
* ```
|
|
737
768
|
* const fishjamClient = new FishjamClient({
|
|
738
|
-
*
|
|
769
|
+
* fishjamId: fastify.config.FISHJAM_ID,
|
|
739
770
|
* managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
|
|
740
771
|
* });
|
|
741
772
|
* ```
|
|
@@ -775,6 +806,16 @@ declare class FishjamClient {
|
|
|
775
806
|
* Delete a peer - this will also disconnect the peer from the room.
|
|
776
807
|
*/
|
|
777
808
|
deletePeer(roomId: RoomId, peerId: PeerId): Promise<void>;
|
|
809
|
+
/**
|
|
810
|
+
* Subscribe a peer to another peer - this will make all tracks from the publisher available to the subscriber.
|
|
811
|
+
* Using this function only makes sense if subscribeMode is set to manual
|
|
812
|
+
*/
|
|
813
|
+
subscribePeer(roomId: RoomId, subscriberPeerId: PeerId, publisherPeerId: PeerId): Promise<void>;
|
|
814
|
+
/**
|
|
815
|
+
* Subscribe a peer to specific tracks from another peer - this will make only the specified tracks from the publisher available to the subscriber.
|
|
816
|
+
* Using this function only makes sense if subscribeMode is set to manual
|
|
817
|
+
*/
|
|
818
|
+
subscribeTracks(roomId: RoomId, subscriberPeerId: PeerId, tracks: TrackId[]): Promise<void>;
|
|
778
819
|
/**
|
|
779
820
|
* Refresh the peer token for an already existing peer.
|
|
780
821
|
* If an already created peer has not been connected to the room for more than 24 hours, the token will become invalid. This method can be used to generate a new peer token for the existing peer.
|
package/dist/index.d.ts
CHANGED
|
@@ -27,10 +27,16 @@ interface Peer$1 {
|
|
|
27
27
|
'status': PeerStatus;
|
|
28
28
|
/**
|
|
29
29
|
*
|
|
30
|
-
* @type {
|
|
30
|
+
* @type {SubscribeMode}
|
|
31
31
|
* @memberof Peer
|
|
32
32
|
*/
|
|
33
|
-
'
|
|
33
|
+
'subscribeMode': SubscribeMode;
|
|
34
|
+
/**
|
|
35
|
+
* Describes peer\'s subscriptions in manual mode
|
|
36
|
+
* @type {Array<string>}
|
|
37
|
+
* @memberof Peer
|
|
38
|
+
*/
|
|
39
|
+
'subscriptions': Array<string>;
|
|
34
40
|
/**
|
|
35
41
|
* List of all peer\'s tracks
|
|
36
42
|
* @type {Array<Track>}
|
|
@@ -49,7 +55,59 @@ interface Peer$1 {
|
|
|
49
55
|
* Peer-specific options
|
|
50
56
|
* @export
|
|
51
57
|
*/
|
|
52
|
-
type PeerOptions =
|
|
58
|
+
type PeerOptions = PeerOptionsAgent | PeerOptionsWebRTC;
|
|
59
|
+
/**
|
|
60
|
+
* Options specific to the Agent peer
|
|
61
|
+
* @export
|
|
62
|
+
* @interface PeerOptionsAgent
|
|
63
|
+
*/
|
|
64
|
+
interface PeerOptionsAgent {
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @type {PeerOptionsAgentOutput}
|
|
68
|
+
* @memberof PeerOptionsAgent
|
|
69
|
+
*/
|
|
70
|
+
'output'?: PeerOptionsAgentOutput;
|
|
71
|
+
/**
|
|
72
|
+
* Configuration of peer\'s subscribing policy
|
|
73
|
+
* @type {string}
|
|
74
|
+
* @memberof PeerOptionsAgent
|
|
75
|
+
*/
|
|
76
|
+
'subscribeMode'?: PeerOptionsAgentSubscribeModeEnum;
|
|
77
|
+
}
|
|
78
|
+
declare const PeerOptionsAgentSubscribeModeEnum: {
|
|
79
|
+
readonly Auto: "auto";
|
|
80
|
+
readonly Manual: "manual";
|
|
81
|
+
};
|
|
82
|
+
type PeerOptionsAgentSubscribeModeEnum = typeof PeerOptionsAgentSubscribeModeEnum[keyof typeof PeerOptionsAgentSubscribeModeEnum];
|
|
83
|
+
/**
|
|
84
|
+
* Output audio options
|
|
85
|
+
* @export
|
|
86
|
+
* @interface PeerOptionsAgentOutput
|
|
87
|
+
*/
|
|
88
|
+
interface PeerOptionsAgentOutput {
|
|
89
|
+
/**
|
|
90
|
+
* The format of the output audio
|
|
91
|
+
* @type {string}
|
|
92
|
+
* @memberof PeerOptionsAgentOutput
|
|
93
|
+
*/
|
|
94
|
+
'audioFormat'?: PeerOptionsAgentOutputAudioFormatEnum;
|
|
95
|
+
/**
|
|
96
|
+
* The sample rate of the output audio
|
|
97
|
+
* @type {number}
|
|
98
|
+
* @memberof PeerOptionsAgentOutput
|
|
99
|
+
*/
|
|
100
|
+
'audioSampleRate'?: PeerOptionsAgentOutputAudioSampleRateEnum;
|
|
101
|
+
}
|
|
102
|
+
declare const PeerOptionsAgentOutputAudioFormatEnum: {
|
|
103
|
+
readonly Pcm16: "pcm16";
|
|
104
|
+
};
|
|
105
|
+
type PeerOptionsAgentOutputAudioFormatEnum = typeof PeerOptionsAgentOutputAudioFormatEnum[keyof typeof PeerOptionsAgentOutputAudioFormatEnum];
|
|
106
|
+
declare const PeerOptionsAgentOutputAudioSampleRateEnum: {
|
|
107
|
+
readonly NUMBER_16000: 16000;
|
|
108
|
+
readonly NUMBER_24000: 24000;
|
|
109
|
+
};
|
|
110
|
+
type PeerOptionsAgentOutputAudioSampleRateEnum = typeof PeerOptionsAgentOutputAudioSampleRateEnum[keyof typeof PeerOptionsAgentOutputAudioSampleRateEnum];
|
|
53
111
|
/**
|
|
54
112
|
* Options specific to the WebRTC peer
|
|
55
113
|
* @export
|
|
@@ -71,12 +129,17 @@ interface PeerOptionsWebRTC {
|
|
|
71
129
|
[key: string]: any;
|
|
72
130
|
};
|
|
73
131
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @type {
|
|
132
|
+
* Configuration of peer\'s subscribing policy
|
|
133
|
+
* @type {string}
|
|
76
134
|
* @memberof PeerOptionsWebRTC
|
|
77
135
|
*/
|
|
78
|
-
'
|
|
136
|
+
'subscribeMode'?: PeerOptionsWebRTCSubscribeModeEnum;
|
|
79
137
|
}
|
|
138
|
+
declare const PeerOptionsWebRTCSubscribeModeEnum: {
|
|
139
|
+
readonly Auto: "auto";
|
|
140
|
+
readonly Manual: "manual";
|
|
141
|
+
};
|
|
142
|
+
type PeerOptionsWebRTCSubscribeModeEnum = typeof PeerOptionsWebRTCSubscribeModeEnum[keyof typeof PeerOptionsWebRTCSubscribeModeEnum];
|
|
80
143
|
/**
|
|
81
144
|
* Informs about the peer status
|
|
82
145
|
* @export
|
|
@@ -140,6 +203,7 @@ declare const RoomConfigRoomTypeEnum: {
|
|
|
140
203
|
readonly Broadcaster: "broadcaster";
|
|
141
204
|
readonly Livestream: "livestream";
|
|
142
205
|
readonly Conference: "conference";
|
|
206
|
+
readonly AudioOnlyLivestream: "audio_only_livestream";
|
|
143
207
|
};
|
|
144
208
|
type RoomConfigRoomTypeEnum = typeof RoomConfigRoomTypeEnum[keyof typeof RoomConfigRoomTypeEnum];
|
|
145
209
|
declare const RoomConfigVideoCodecEnum: {
|
|
@@ -161,69 +225,23 @@ interface StreamerToken {
|
|
|
161
225
|
'token': string;
|
|
162
226
|
}
|
|
163
227
|
/**
|
|
164
|
-
* Configuration of
|
|
165
|
-
* @export
|
|
166
|
-
* @interface SubscribeOptions
|
|
167
|
-
*/
|
|
168
|
-
interface SubscribeOptions {
|
|
169
|
-
/**
|
|
170
|
-
* The format of the output audio
|
|
171
|
-
* @type {string}
|
|
172
|
-
* @memberof SubscribeOptions
|
|
173
|
-
*/
|
|
174
|
-
'audioFormat'?: SubscribeOptionsAudioFormatEnum;
|
|
175
|
-
/**
|
|
176
|
-
* The sample rate of the output audio
|
|
177
|
-
* @type {number}
|
|
178
|
-
* @memberof SubscribeOptions
|
|
179
|
-
*/
|
|
180
|
-
'audioSampleRate'?: SubscribeOptionsAudioSampleRateEnum;
|
|
181
|
-
}
|
|
182
|
-
declare const SubscribeOptionsAudioFormatEnum: {
|
|
183
|
-
readonly Pcm16: "pcm16";
|
|
184
|
-
};
|
|
185
|
-
type SubscribeOptionsAudioFormatEnum = typeof SubscribeOptionsAudioFormatEnum[keyof typeof SubscribeOptionsAudioFormatEnum];
|
|
186
|
-
declare const SubscribeOptionsAudioSampleRateEnum: {
|
|
187
|
-
readonly NUMBER_16000: 16000;
|
|
188
|
-
readonly NUMBER_24000: 24000;
|
|
189
|
-
};
|
|
190
|
-
type SubscribeOptionsAudioSampleRateEnum = typeof SubscribeOptionsAudioSampleRateEnum[keyof typeof SubscribeOptionsAudioSampleRateEnum];
|
|
191
|
-
/**
|
|
192
|
-
* Configuration of server-side subscriptions to the peer\'s tracks
|
|
228
|
+
* Configuration of peer\'s subscribing policy
|
|
193
229
|
* @export
|
|
194
|
-
* @
|
|
230
|
+
* @enum {string}
|
|
195
231
|
*/
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
* @type {string}
|
|
200
|
-
* @memberof SubscribeOptions1
|
|
201
|
-
*/
|
|
202
|
-
'audioFormat'?: SubscribeOptions1AudioFormatEnum;
|
|
203
|
-
/**
|
|
204
|
-
* The sample rate of the output audio
|
|
205
|
-
* @type {number}
|
|
206
|
-
* @memberof SubscribeOptions1
|
|
207
|
-
*/
|
|
208
|
-
'audioSampleRate'?: SubscribeOptions1AudioSampleRateEnum;
|
|
209
|
-
}
|
|
210
|
-
declare const SubscribeOptions1AudioFormatEnum: {
|
|
211
|
-
readonly Pcm16: "pcm16";
|
|
212
|
-
};
|
|
213
|
-
type SubscribeOptions1AudioFormatEnum = typeof SubscribeOptions1AudioFormatEnum[keyof typeof SubscribeOptions1AudioFormatEnum];
|
|
214
|
-
declare const SubscribeOptions1AudioSampleRateEnum: {
|
|
215
|
-
readonly NUMBER_16000: 16000;
|
|
216
|
-
readonly NUMBER_24000: 24000;
|
|
232
|
+
declare const SubscribeMode: {
|
|
233
|
+
readonly Auto: "auto";
|
|
234
|
+
readonly Manual: "manual";
|
|
217
235
|
};
|
|
218
|
-
type
|
|
236
|
+
type SubscribeMode = typeof SubscribeMode[keyof typeof SubscribeMode];
|
|
219
237
|
/**
|
|
220
|
-
* Describes media track of a Peer
|
|
238
|
+
* Describes media track of a Peer
|
|
221
239
|
* @export
|
|
222
240
|
* @interface Track
|
|
223
241
|
*/
|
|
224
242
|
interface Track$1 {
|
|
225
243
|
/**
|
|
226
|
-
*
|
|
244
|
+
* Assigned track id
|
|
227
245
|
* @type {string}
|
|
228
246
|
* @memberof Track
|
|
229
247
|
*/
|
|
@@ -327,10 +345,14 @@ interface ServerMessage {
|
|
|
327
345
|
trackMetadataUpdated?: ServerMessage_TrackMetadataUpdated | undefined;
|
|
328
346
|
peerAdded?: ServerMessage_PeerAdded | undefined;
|
|
329
347
|
peerDeleted?: ServerMessage_PeerDeleted | undefined;
|
|
348
|
+
/** @deprecated */
|
|
330
349
|
streamConnected?: ServerMessage_StreamConnected | undefined;
|
|
350
|
+
/** @deprecated */
|
|
331
351
|
streamDisconnected?: ServerMessage_StreamDisconnected | undefined;
|
|
332
352
|
viewerConnected?: ServerMessage_ViewerConnected | undefined;
|
|
333
353
|
viewerDisconnected?: ServerMessage_ViewerDisconnected | undefined;
|
|
354
|
+
streamerConnected?: ServerMessage_StreamerConnected | undefined;
|
|
355
|
+
streamerDisconnected?: ServerMessage_StreamerDisconnected | undefined;
|
|
334
356
|
}
|
|
335
357
|
declare const ServerMessage: MessageFns$1<ServerMessage>;
|
|
336
358
|
/** Notification sent when a room crashes */
|
|
@@ -479,6 +501,16 @@ interface ServerMessage_ViewerDisconnected {
|
|
|
479
501
|
viewerId: string;
|
|
480
502
|
}
|
|
481
503
|
declare const ServerMessage_ViewerDisconnected: MessageFns$1<ServerMessage_ViewerDisconnected>;
|
|
504
|
+
interface ServerMessage_StreamerConnected {
|
|
505
|
+
streamId: string;
|
|
506
|
+
streamerId: string;
|
|
507
|
+
}
|
|
508
|
+
declare const ServerMessage_StreamerConnected: MessageFns$1<ServerMessage_StreamerConnected>;
|
|
509
|
+
interface ServerMessage_StreamerDisconnected {
|
|
510
|
+
streamId: string;
|
|
511
|
+
streamerId: string;
|
|
512
|
+
}
|
|
513
|
+
declare const ServerMessage_StreamerDisconnected: MessageFns$1<ServerMessage_StreamerDisconnected>;
|
|
482
514
|
type Builtin$1 = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
483
515
|
type DeepPartial$1<T> = T extends Builtin$1 ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial$1<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial$1<U>> : T extends {} ? {
|
|
484
516
|
[K in keyof T]?: DeepPartial$1<T[K]>;
|
|
@@ -606,8 +638,7 @@ type Room = {
|
|
|
606
638
|
config: RoomConfig;
|
|
607
639
|
};
|
|
608
640
|
type FishjamConfig = {
|
|
609
|
-
fishjamId
|
|
610
|
-
fishjamUrl?: string;
|
|
641
|
+
fishjamId: string;
|
|
611
642
|
managementToken: string;
|
|
612
643
|
};
|
|
613
644
|
type ErrorEventHandler = (msg: Event) => void;
|
|
@@ -721,7 +752,7 @@ declare class FishjamAgent extends FishjamAgent_base {
|
|
|
721
752
|
|
|
722
753
|
/**
|
|
723
754
|
* Client class that allows to manage Rooms and Peers for a Fishjam App.
|
|
724
|
-
* It requires the Fishjam
|
|
755
|
+
* It requires the Fishjam ID and management token that can be retrieved from the Fishjam Dashboard.
|
|
725
756
|
* @category Client
|
|
726
757
|
*/
|
|
727
758
|
declare class FishjamClient {
|
|
@@ -735,7 +766,7 @@ declare class FishjamClient {
|
|
|
735
766
|
* Example usage:
|
|
736
767
|
* ```
|
|
737
768
|
* const fishjamClient = new FishjamClient({
|
|
738
|
-
*
|
|
769
|
+
* fishjamId: fastify.config.FISHJAM_ID,
|
|
739
770
|
* managementToken: fastify.config.FISHJAM_MANAGEMENT_TOKEN,
|
|
740
771
|
* });
|
|
741
772
|
* ```
|
|
@@ -775,6 +806,16 @@ declare class FishjamClient {
|
|
|
775
806
|
* Delete a peer - this will also disconnect the peer from the room.
|
|
776
807
|
*/
|
|
777
808
|
deletePeer(roomId: RoomId, peerId: PeerId): Promise<void>;
|
|
809
|
+
/**
|
|
810
|
+
* Subscribe a peer to another peer - this will make all tracks from the publisher available to the subscriber.
|
|
811
|
+
* Using this function only makes sense if subscribeMode is set to manual
|
|
812
|
+
*/
|
|
813
|
+
subscribePeer(roomId: RoomId, subscriberPeerId: PeerId, publisherPeerId: PeerId): Promise<void>;
|
|
814
|
+
/**
|
|
815
|
+
* Subscribe a peer to specific tracks from another peer - this will make only the specified tracks from the publisher available to the subscriber.
|
|
816
|
+
* Using this function only makes sense if subscribeMode is set to manual
|
|
817
|
+
*/
|
|
818
|
+
subscribeTracks(roomId: RoomId, subscriberPeerId: PeerId, tracks: TrackId[]): Promise<void>;
|
|
778
819
|
/**
|
|
779
820
|
* Refresh the peer token for an already existing peer.
|
|
780
821
|
* If an already created peer has not been connected to the room for more than 24 hours, the token will become invalid. This method can be used to generate a new peer token for the existing peer.
|