@fishjam-cloud/js-server-sdk 0.17.1 → 0.20.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.ts CHANGED
@@ -89,19 +89,13 @@ interface RoomConfig {
89
89
  */
90
90
  'maxPeers'?: number | null;
91
91
  /**
92
- * Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled.
93
- * @type {number}
94
- * @memberof RoomConfig
95
- */
96
- 'peerDisconnectedTimeout'?: number | null;
97
- /**
98
- * Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled.
99
- * @type {number}
92
+ * True if livestream viewers can omit specifying a token.
93
+ * @type {boolean}
100
94
  * @memberof RoomConfig
101
95
  */
102
- 'peerlessPurgeTimeout'?: number | null;
96
+ 'public'?: boolean;
103
97
  /**
104
- * The use-case of the room. If not provided, this defaults to full_feature.
98
+ * The use-case of the room. If not provided, this defaults to conference.
105
99
  * @type {string}
106
100
  * @memberof RoomConfig
107
101
  */
@@ -123,6 +117,8 @@ declare const RoomConfigRoomTypeEnum: {
123
117
  readonly FullFeature: "full_feature";
124
118
  readonly AudioOnly: "audio_only";
125
119
  readonly Broadcaster: "broadcaster";
120
+ readonly Livestream: "livestream";
121
+ readonly Conference: "conference";
126
122
  };
127
123
  type RoomConfigRoomTypeEnum = typeof RoomConfigRoomTypeEnum[keyof typeof RoomConfigRoomTypeEnum];
128
124
  declare const RoomConfigVideoCodecEnum: {
@@ -130,6 +126,19 @@ declare const RoomConfigVideoCodecEnum: {
130
126
  readonly Vp8: "vp8";
131
127
  };
132
128
  type RoomConfigVideoCodecEnum = typeof RoomConfigVideoCodecEnum[keyof typeof RoomConfigVideoCodecEnum];
129
+ /**
130
+ * Token for authorizing broadcaster streamer connection
131
+ * @export
132
+ * @interface StreamerToken
133
+ */
134
+ interface StreamerToken {
135
+ /**
136
+ *
137
+ * @type {string}
138
+ * @memberof StreamerToken
139
+ */
140
+ 'token': string;
141
+ }
133
142
  /**
134
143
  * Describes media track of a Peer or Component
135
144
  * @export
@@ -171,7 +180,7 @@ interface ViewerToken {
171
180
  * @type {string}
172
181
  * @memberof ViewerToken
173
182
  */
174
- 'token'?: string;
183
+ 'token': string;
175
184
  }
176
185
 
177
186
  type EventMap = {
@@ -238,44 +247,13 @@ type Peer = Omit<Peer$1, 'id'> & {
238
247
  type Room = {
239
248
  id: RoomId;
240
249
  peers: Peer[];
241
- config: RoomOptions;
250
+ config: RoomConfig;
242
251
  };
243
252
  type FishjamConfig = {
244
- fishjamUrl: string;
253
+ fishjamId?: string;
254
+ fishjamUrl?: string;
245
255
  managementToken: string;
246
256
  };
247
- type RoomOptions = {
248
- /**
249
- * Maximum amount of peers allowed into the room
250
- * @type {number}
251
- */
252
- maxPeers?: number | null;
253
- /**
254
- * Duration (in seconds) after which the peer will be removed if it is disconnected. If not provided, this feature is disabled.
255
- * @type {number}
256
- */
257
- peerDisconnectedTimeout?: number | null;
258
- /**
259
- * Duration (in seconds) after which the room will be removed if no peers are connected. If not provided, this feature is disabled.
260
- * @type {number}
261
- */
262
- peerlessPurgeTimeout?: number | null;
263
- /**
264
- * The use-case of the room. If not provided, this defaults to full_feature.
265
- * @type {string}
266
- */
267
- roomType?: RoomConfigRoomTypeEnum | 'livestream';
268
- /**
269
- * Enforces video codec for each peer in the room
270
- * @type {string}
271
- */
272
- videoCodec?: RoomConfigVideoCodecEnum | null;
273
- /**
274
- * URL where Fishjam notifications will be sent
275
- * @type {string}
276
- */
277
- webhookUrl?: string | null;
278
- };
279
257
 
280
258
  type ExpectedEvents = 'roomCreated' | 'roomDeleted' | 'roomCrashed' | 'peerAdded' | 'peerDeleted' | 'peerConnected' | 'peerDisconnected' | 'peerMetadataUpdated' | 'peerCrashed' | 'trackAdded' | 'trackRemoved' | 'trackMetadataUpdated';
281
259
  type ErrorEventHandler = (msg: Error) => void;
@@ -302,6 +280,7 @@ declare class FishjamWSNotifier extends FishjamWSNotifier_base {
302
280
  declare class FishjamClient {
303
281
  private readonly roomApi;
304
282
  private readonly viewerApi;
283
+ private readonly streamerApi;
305
284
  /**
306
285
  * Create new instance of Fishjam Client.
307
286
  *
@@ -317,7 +296,7 @@ declare class FishjamClient {
317
296
  /**
318
297
  * Create a new room. All peers connected to the same room will be able to send/receive streams to each other.
319
298
  */
320
- createRoom(config?: RoomOptions): Promise<Room>;
299
+ createRoom(config?: RoomConfig): Promise<Room>;
321
300
  /**
322
301
  * Delete an existing room. All peers connected to this room will be disconnected and removed.
323
302
  */
@@ -352,8 +331,16 @@ declare class FishjamClient {
352
331
  * @returns a livestream viewer token
353
332
  */
354
333
  createLivestreamViewerToken(roomId: RoomId): Promise<ViewerToken>;
334
+ /**
335
+ * Creates a livestream streamer token for the given room.
336
+ * @returns a livestream streamer token
337
+ */
338
+ createLivestreamStreamerToken(roomId: RoomId): Promise<StreamerToken>;
355
339
  }
356
340
 
341
+ declare class MissingFishjamIdException extends Error {
342
+ constructor();
343
+ }
357
344
  declare class FishjamBaseException extends Error {
358
345
  statusCode: number;
359
346
  axiosCode?: string;
@@ -377,4 +364,4 @@ declare class ServiceUnavailableException extends FishjamBaseException {
377
364
  declare class UnknownException extends FishjamBaseException {
378
365
  }
379
366
 
380
- export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, type RoomOptions, ServiceUnavailableException, UnauthorizedException, UnknownException, type ViewerToken };
367
+ export { BadRequestException, type Brand, type CloseEventHandler, type ErrorEventHandler, type ExpectedEvents, FishjamBaseException, FishjamClient, type FishjamConfig, FishjamNotFoundException, FishjamWSNotifier, ForbiddenException, MissingFishjamIdException, type NotificationEvents, type Peer, type PeerId, PeerNotFoundException, type PeerOptions, PeerStatus, type Room, type RoomConfig, RoomConfigRoomTypeEnum, RoomConfigVideoCodecEnum, type RoomId, RoomNotFoundException, ServiceUnavailableException, type StreamerToken, UnauthorizedException, UnknownException, type ViewerToken };