@fishjam-cloud/js-server-sdk 0.22.1 → 0.24.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.js CHANGED
@@ -10787,19 +10787,16 @@ var require_dist = __commonJS({
10787
10787
  });
10788
10788
  var index_exports2 = {};
10789
10789
  __export2(index_exports2, {
10790
+ AudioFormat: () => AudioFormat,
10791
+ AudioSampleRate: () => AudioSampleRate,
10790
10792
  Configuration: () => Configuration,
10791
- PeerOptionsAgentOutputAudioFormatEnum: () => PeerOptionsAgentOutputAudioFormatEnum,
10792
- PeerOptionsAgentOutputAudioSampleRateEnum: () => PeerOptionsAgentOutputAudioSampleRateEnum,
10793
- PeerOptionsAgentSubscribeModeEnum: () => PeerOptionsAgentSubscribeModeEnum,
10794
- PeerOptionsWebRTCSubscribeModeEnum: () => PeerOptionsWebRTCSubscribeModeEnum,
10795
10793
  PeerStatus: () => PeerStatus2,
10796
10794
  PeerType: () => PeerType,
10797
10795
  RoomApi: () => RoomApi2,
10798
10796
  RoomApiAxiosParamCreator: () => RoomApiAxiosParamCreator,
10799
10797
  RoomApiFactory: () => RoomApiFactory,
10800
10798
  RoomApiFp: () => RoomApiFp,
10801
- RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10802
- RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10799
+ RoomType: () => RoomType2,
10803
10800
  StreamApi: () => StreamApi,
10804
10801
  StreamApiAxiosParamCreator: () => StreamApiAxiosParamCreator,
10805
10802
  StreamApiFactory: () => StreamApiFactory,
@@ -10810,7 +10807,8 @@ var require_dist = __commonJS({
10810
10807
  StreamerApiFp: () => StreamerApiFp,
10811
10808
  StreamerStatusEnum: () => StreamerStatusEnum,
10812
10809
  SubscribeMode: () => SubscribeMode,
10813
- TrackTypeEnum: () => TrackTypeEnum,
10810
+ TrackType: () => TrackType,
10811
+ VideoCodec: () => VideoCodec2,
10814
10812
  ViewerApi: () => ViewerApi2,
10815
10813
  ViewerApiAxiosParamCreator: () => ViewerApiAxiosParamCreator,
10816
10814
  ViewerApiFactory: () => ViewerApiFactory,
@@ -14055,21 +14053,13 @@ var require_dist = __commonJS({
14055
14053
  return axios22.request(axiosRequestArgs);
14056
14054
  };
14057
14055
  };
14058
- var PeerOptionsAgentSubscribeModeEnum = {
14059
- Auto: "auto",
14060
- Manual: "manual"
14061
- };
14062
- var PeerOptionsAgentOutputAudioFormatEnum = {
14056
+ var AudioFormat = {
14063
14057
  Pcm16: "pcm16"
14064
14058
  };
14065
- var PeerOptionsAgentOutputAudioSampleRateEnum = {
14059
+ var AudioSampleRate = {
14066
14060
  NUMBER_16000: 16e3,
14067
14061
  NUMBER_24000: 24e3
14068
14062
  };
14069
- var PeerOptionsWebRTCSubscribeModeEnum = {
14070
- Auto: "auto",
14071
- Manual: "manual"
14072
- };
14073
14063
  var PeerStatus2 = {
14074
14064
  Connected: "connected",
14075
14065
  Disconnected: "disconnected"
@@ -14078,7 +14068,7 @@ var require_dist = __commonJS({
14078
14068
  Webrtc: "webrtc",
14079
14069
  Agent: "agent"
14080
14070
  };
14081
- var RoomConfigRoomTypeEnum2 = {
14071
+ var RoomType2 = {
14082
14072
  FullFeature: "full_feature",
14083
14073
  AudioOnly: "audio_only",
14084
14074
  Broadcaster: "broadcaster",
@@ -14086,10 +14076,6 @@ var require_dist = __commonJS({
14086
14076
  Conference: "conference",
14087
14077
  AudioOnlyLivestream: "audio_only_livestream"
14088
14078
  };
14089
- var RoomConfigVideoCodecEnum2 = {
14090
- H264: "h264",
14091
- Vp8: "vp8"
14092
- };
14093
14079
  var StreamerStatusEnum = {
14094
14080
  Connected: "connected",
14095
14081
  Disconnected: "disconnected"
@@ -14098,10 +14084,14 @@ var require_dist = __commonJS({
14098
14084
  Auto: "auto",
14099
14085
  Manual: "manual"
14100
14086
  };
14101
- var TrackTypeEnum = {
14087
+ var TrackType = {
14102
14088
  Audio: "audio",
14103
14089
  Video: "video"
14104
14090
  };
14091
+ var VideoCodec2 = {
14092
+ H264: "h264",
14093
+ Vp8: "vp8"
14094
+ };
14105
14095
  var ViewerStatusEnum = {
14106
14096
  Connected: "connected",
14107
14097
  Disconnected: "disconnected"
@@ -19424,16 +19414,18 @@ __export(index_exports, {
19424
19414
  MissingFishjamIdException: () => MissingFishjamIdException,
19425
19415
  PeerNotFoundException: () => PeerNotFoundException,
19426
19416
  PeerOptions: () => import_fishjam_openapi2.PeerOptions,
19417
+ PeerOptionsAgent: () => import_fishjam_openapi2.PeerOptionsAgent,
19418
+ PeerOptionsWebRTC: () => import_fishjam_openapi2.PeerOptionsWebRTC,
19427
19419
  PeerStatus: () => import_fishjam_openapi2.PeerStatus,
19428
19420
  RoomConfig: () => import_fishjam_openapi2.RoomConfig,
19429
- RoomConfigRoomTypeEnum: () => import_fishjam_openapi2.RoomConfigRoomTypeEnum,
19430
- RoomConfigVideoCodecEnum: () => import_fishjam_openapi2.RoomConfigVideoCodecEnum,
19431
19421
  RoomNotFoundException: () => RoomNotFoundException,
19422
+ RoomType: () => import_fishjam_openapi2.RoomType,
19432
19423
  ServerMessage: () => import_fishjam_proto3.ServerMessage,
19433
19424
  ServiceUnavailableException: () => ServiceUnavailableException,
19434
19425
  StreamerToken: () => import_fishjam_openapi2.StreamerToken,
19435
19426
  UnauthorizedException: () => UnauthorizedException,
19436
19427
  UnknownException: () => UnknownException,
19428
+ VideoCodec: () => import_fishjam_openapi2.VideoCodec,
19437
19429
  ViewerToken: () => import_fishjam_openapi2.ViewerToken
19438
19430
  });
19439
19431
  module.exports = __toCommonJS(index_exports);
@@ -19556,6 +19548,8 @@ var import_fishjam_proto2 = __toESM(require_dist2());
19556
19548
  var expectedEventsList2 = ["trackData"];
19557
19549
  var FishjamAgent = class extends import_events2.EventEmitter {
19558
19550
  client;
19551
+ resolveConnectionPromise = null;
19552
+ connectionPromise;
19559
19553
  constructor(config, agentToken, callbacks) {
19560
19554
  super();
19561
19555
  const fishjamUrl = getFishjamUrl(config);
@@ -19566,6 +19560,15 @@ var FishjamAgent = class extends import_events2.EventEmitter {
19566
19560
  this.client.onerror = (message) => callbacks?.onError?.(message);
19567
19561
  this.client.onmessage = (message) => this.dispatchNotification(message);
19568
19562
  this.client.onopen = () => this.setupConnection(agentToken);
19563
+ this.connectionPromise = new Promise((resolve) => {
19564
+ this.resolveConnectionPromise = resolve;
19565
+ });
19566
+ }
19567
+ /**
19568
+ * Await Agent connection to Fishjam.
19569
+ */
19570
+ async awaitConnected() {
19571
+ return this.connectionPromise;
19569
19572
  }
19570
19573
  /**
19571
19574
  * Creates an outgoing audio track for the agent
@@ -19583,7 +19586,7 @@ var FishjamAgent = class extends import_events2.EventEmitter {
19583
19586
  return track;
19584
19587
  }
19585
19588
  /**
19586
- * Interrupt track indentified by `trackId`.
19589
+ * Interrupt track identified by `trackId`.
19587
19590
  *
19588
19591
  * Any audio that has been sent by the agent, but not played
19589
19592
  * by Fishjam will be cleared and be prevented from playing.
@@ -19625,6 +19628,10 @@ var FishjamAgent = class extends import_events2.EventEmitter {
19625
19628
  setupConnection(agentToken) {
19626
19629
  const auth = import_fishjam_proto2.AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
19627
19630
  this.client.send(auth);
19631
+ if (this.resolveConnectionPromise) {
19632
+ this.resolveConnectionPromise();
19633
+ this.resolveConnectionPromise = null;
19634
+ }
19628
19635
  }
19629
19636
  isExpectedEvent(notification) {
19630
19637
  return expectedEventsList2.includes(notification);
@@ -19765,6 +19772,7 @@ var FishjamClient = class {
19765
19772
  data: { data }
19766
19773
  } = response;
19767
19774
  const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
19775
+ await agent.awaitConnected();
19768
19776
  return { agent, peer: data.peer };
19769
19777
  } catch (error) {
19770
19778
  throw mapException(error);
@@ -19863,16 +19871,18 @@ var FishjamClient = class {
19863
19871
  MissingFishjamIdException,
19864
19872
  PeerNotFoundException,
19865
19873
  PeerOptions,
19874
+ PeerOptionsAgent,
19875
+ PeerOptionsWebRTC,
19866
19876
  PeerStatus,
19867
19877
  RoomConfig,
19868
- RoomConfigRoomTypeEnum,
19869
- RoomConfigVideoCodecEnum,
19870
19878
  RoomNotFoundException,
19879
+ RoomType,
19871
19880
  ServerMessage,
19872
19881
  ServiceUnavailableException,
19873
19882
  StreamerToken,
19874
19883
  UnauthorizedException,
19875
19884
  UnknownException,
19885
+ VideoCodec,
19876
19886
  ViewerToken
19877
19887
  });
19878
19888
  /*! Bundled license information:
package/dist/index.mjs CHANGED
@@ -1,69 +1,43 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
- }) : x)(function(x) {
10
- if (typeof require !== "undefined") return require.apply(this, arguments);
11
- throw Error('Dynamic require of "' + x + '" is not supported');
12
- });
13
- var __commonJS = (cb, mod) => function __require2() {
14
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") {
18
- for (let key of __getOwnPropNames(from))
19
- if (!__hasOwnProp.call(to, key) && key !== except)
20
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
- }
22
- return to;
23
- };
24
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
25
- // If the importer is in node compatibility mode or this is not an ESM
26
- // file that has been converted to a CommonJS file using a Babel-
27
- // compatible transform (i.e. "__esModule" has not been set), then set
28
- // "default" to the CommonJS "module.exports" for node compatibility.
29
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
30
- mod
31
- ));
1
+ import {
2
+ __commonJS,
3
+ __require,
4
+ __toESM
5
+ } from "./chunk-6DZX6EAA.mjs";
32
6
 
33
7
  // ../fishjam-openapi/dist/index.js
34
8
  var require_dist = __commonJS({
35
9
  "../fishjam-openapi/dist/index.js"(exports, module) {
36
10
  "use strict";
37
- var __create2 = Object.create;
38
- var __defProp2 = Object.defineProperty;
39
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
40
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
41
- var __getProtoOf2 = Object.getPrototypeOf;
42
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
11
+ var __create = Object.create;
12
+ var __defProp = Object.defineProperty;
13
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
14
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15
+ var __getProtoOf = Object.getPrototypeOf;
16
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
43
17
  var __commonJS2 = (cb, mod) => function __require2() {
44
- return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
45
19
  };
46
20
  var __export = (target, all3) => {
47
21
  for (var name in all3)
48
- __defProp2(target, name, { get: all3[name], enumerable: true });
22
+ __defProp(target, name, { get: all3[name], enumerable: true });
49
23
  };
50
- var __copyProps2 = (to, from, except, desc) => {
24
+ var __copyProps = (to, from, except, desc) => {
51
25
  if (from && typeof from === "object" || typeof from === "function") {
52
- for (let key of __getOwnPropNames2(from))
53
- if (!__hasOwnProp2.call(to, key) && key !== except)
54
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
26
+ for (let key of __getOwnPropNames(from))
27
+ if (!__hasOwnProp.call(to, key) && key !== except)
28
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
55
29
  }
56
30
  return to;
57
31
  };
58
- var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
32
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
59
33
  // If the importer is in node compatibility mode or this is not an ESM
60
34
  // file that has been converted to a CommonJS file using a Babel-
61
35
  // compatible transform (i.e. "__esModule" has not been set), then set
62
36
  // "default" to the CommonJS "module.exports" for node compatibility.
63
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
37
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
64
38
  mod
65
39
  ));
66
- var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
40
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
67
41
  var require_delayed_stream = __commonJS2({
68
42
  "../../node_modules/delayed-stream/lib/delayed_stream.js"(exports2, module2) {
69
43
  "use strict";
@@ -10787,19 +10761,16 @@ var require_dist = __commonJS({
10787
10761
  });
10788
10762
  var index_exports = {};
10789
10763
  __export(index_exports, {
10764
+ AudioFormat: () => AudioFormat,
10765
+ AudioSampleRate: () => AudioSampleRate,
10790
10766
  Configuration: () => Configuration,
10791
- PeerOptionsAgentOutputAudioFormatEnum: () => PeerOptionsAgentOutputAudioFormatEnum,
10792
- PeerOptionsAgentOutputAudioSampleRateEnum: () => PeerOptionsAgentOutputAudioSampleRateEnum,
10793
- PeerOptionsAgentSubscribeModeEnum: () => PeerOptionsAgentSubscribeModeEnum,
10794
- PeerOptionsWebRTCSubscribeModeEnum: () => PeerOptionsWebRTCSubscribeModeEnum,
10795
10767
  PeerStatus: () => PeerStatus2,
10796
10768
  PeerType: () => PeerType,
10797
10769
  RoomApi: () => RoomApi2,
10798
10770
  RoomApiAxiosParamCreator: () => RoomApiAxiosParamCreator,
10799
10771
  RoomApiFactory: () => RoomApiFactory,
10800
10772
  RoomApiFp: () => RoomApiFp,
10801
- RoomConfigRoomTypeEnum: () => RoomConfigRoomTypeEnum2,
10802
- RoomConfigVideoCodecEnum: () => RoomConfigVideoCodecEnum2,
10773
+ RoomType: () => RoomType2,
10803
10774
  StreamApi: () => StreamApi,
10804
10775
  StreamApiAxiosParamCreator: () => StreamApiAxiosParamCreator,
10805
10776
  StreamApiFactory: () => StreamApiFactory,
@@ -10810,7 +10781,8 @@ var require_dist = __commonJS({
10810
10781
  StreamerApiFp: () => StreamerApiFp,
10811
10782
  StreamerStatusEnum: () => StreamerStatusEnum,
10812
10783
  SubscribeMode: () => SubscribeMode,
10813
- TrackTypeEnum: () => TrackTypeEnum,
10784
+ TrackType: () => TrackType,
10785
+ VideoCodec: () => VideoCodec2,
10814
10786
  ViewerApi: () => ViewerApi2,
10815
10787
  ViewerApiAxiosParamCreator: () => ViewerApiAxiosParamCreator,
10816
10788
  ViewerApiFactory: () => ViewerApiFactory,
@@ -14055,21 +14027,13 @@ var require_dist = __commonJS({
14055
14027
  return axios22.request(axiosRequestArgs);
14056
14028
  };
14057
14029
  };
14058
- var PeerOptionsAgentSubscribeModeEnum = {
14059
- Auto: "auto",
14060
- Manual: "manual"
14061
- };
14062
- var PeerOptionsAgentOutputAudioFormatEnum = {
14030
+ var AudioFormat = {
14063
14031
  Pcm16: "pcm16"
14064
14032
  };
14065
- var PeerOptionsAgentOutputAudioSampleRateEnum = {
14033
+ var AudioSampleRate = {
14066
14034
  NUMBER_16000: 16e3,
14067
14035
  NUMBER_24000: 24e3
14068
14036
  };
14069
- var PeerOptionsWebRTCSubscribeModeEnum = {
14070
- Auto: "auto",
14071
- Manual: "manual"
14072
- };
14073
14037
  var PeerStatus2 = {
14074
14038
  Connected: "connected",
14075
14039
  Disconnected: "disconnected"
@@ -14078,7 +14042,7 @@ var require_dist = __commonJS({
14078
14042
  Webrtc: "webrtc",
14079
14043
  Agent: "agent"
14080
14044
  };
14081
- var RoomConfigRoomTypeEnum2 = {
14045
+ var RoomType2 = {
14082
14046
  FullFeature: "full_feature",
14083
14047
  AudioOnly: "audio_only",
14084
14048
  Broadcaster: "broadcaster",
@@ -14086,10 +14050,6 @@ var require_dist = __commonJS({
14086
14050
  Conference: "conference",
14087
14051
  AudioOnlyLivestream: "audio_only_livestream"
14088
14052
  };
14089
- var RoomConfigVideoCodecEnum2 = {
14090
- H264: "h264",
14091
- Vp8: "vp8"
14092
- };
14093
14053
  var StreamerStatusEnum = {
14094
14054
  Connected: "connected",
14095
14055
  Disconnected: "disconnected"
@@ -14098,10 +14058,14 @@ var require_dist = __commonJS({
14098
14058
  Auto: "auto",
14099
14059
  Manual: "manual"
14100
14060
  };
14101
- var TrackTypeEnum = {
14061
+ var TrackType = {
14102
14062
  Audio: "audio",
14103
14063
  Video: "video"
14104
14064
  };
14065
+ var VideoCodec2 = {
14066
+ H264: "h264",
14067
+ Vp8: "vp8"
14068
+ };
14105
14069
  var ViewerStatusEnum = {
14106
14070
  Connected: "connected",
14107
14071
  Disconnected: "disconnected"
@@ -15459,23 +15423,23 @@ var require_dist = __commonJS({
15459
15423
  var require_dist2 = __commonJS({
15460
15424
  "../fishjam-proto/dist/index.js"(exports, module) {
15461
15425
  "use strict";
15462
- var __defProp2 = Object.defineProperty;
15463
- var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
15464
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
15465
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
15426
+ var __defProp = Object.defineProperty;
15427
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
15428
+ var __getOwnPropNames = Object.getOwnPropertyNames;
15429
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
15466
15430
  var __export = (target, all) => {
15467
15431
  for (var name in all)
15468
- __defProp2(target, name, { get: all[name], enumerable: true });
15432
+ __defProp(target, name, { get: all[name], enumerable: true });
15469
15433
  };
15470
- var __copyProps2 = (to, from, except, desc) => {
15434
+ var __copyProps = (to, from, except, desc) => {
15471
15435
  if (from && typeof from === "object" || typeof from === "function") {
15472
- for (let key of __getOwnPropNames2(from))
15473
- if (!__hasOwnProp2.call(to, key) && key !== except)
15474
- __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
15436
+ for (let key of __getOwnPropNames(from))
15437
+ if (!__hasOwnProp.call(to, key) && key !== except)
15438
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15475
15439
  }
15476
15440
  return to;
15477
15441
  };
15478
- var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
15442
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15479
15443
  var index_exports = {};
15480
15444
  __export(index_exports, {
15481
15445
  AgentRequest: () => AgentRequest2,
@@ -19531,6 +19495,8 @@ import { v4 as uuid4 } from "uuid";
19531
19495
  var expectedEventsList2 = ["trackData"];
19532
19496
  var FishjamAgent = class extends EventEmitter2 {
19533
19497
  client;
19498
+ resolveConnectionPromise = null;
19499
+ connectionPromise;
19534
19500
  constructor(config, agentToken, callbacks) {
19535
19501
  super();
19536
19502
  const fishjamUrl = getFishjamUrl(config);
@@ -19541,6 +19507,15 @@ var FishjamAgent = class extends EventEmitter2 {
19541
19507
  this.client.onerror = (message) => callbacks?.onError?.(message);
19542
19508
  this.client.onmessage = (message) => this.dispatchNotification(message);
19543
19509
  this.client.onopen = () => this.setupConnection(agentToken);
19510
+ this.connectionPromise = new Promise((resolve) => {
19511
+ this.resolveConnectionPromise = resolve;
19512
+ });
19513
+ }
19514
+ /**
19515
+ * Await Agent connection to Fishjam.
19516
+ */
19517
+ async awaitConnected() {
19518
+ return this.connectionPromise;
19544
19519
  }
19545
19520
  /**
19546
19521
  * Creates an outgoing audio track for the agent
@@ -19558,7 +19533,7 @@ var FishjamAgent = class extends EventEmitter2 {
19558
19533
  return track;
19559
19534
  }
19560
19535
  /**
19561
- * Interrupt track indentified by `trackId`.
19536
+ * Interrupt track identified by `trackId`.
19562
19537
  *
19563
19538
  * Any audio that has been sent by the agent, but not played
19564
19539
  * by Fishjam will be cleared and be prevented from playing.
@@ -19600,6 +19575,10 @@ var FishjamAgent = class extends EventEmitter2 {
19600
19575
  setupConnection(agentToken) {
19601
19576
  const auth = import_fishjam_proto2.AgentRequest.encode({ authRequest: { token: agentToken } }).finish();
19602
19577
  this.client.send(auth);
19578
+ if (this.resolveConnectionPromise) {
19579
+ this.resolveConnectionPromise();
19580
+ this.resolveConnectionPromise = null;
19581
+ }
19603
19582
  }
19604
19583
  isExpectedEvent(notification) {
19605
19584
  return expectedEventsList2.includes(notification);
@@ -19740,6 +19719,7 @@ var FishjamClient = class {
19740
19719
  data: { data }
19741
19720
  } = response;
19742
19721
  const agent = new FishjamAgent(this.fishjamConfig, data.token, callbacks);
19722
+ await agent.awaitConnected();
19743
19723
  return { agent, peer: data.peer };
19744
19724
  } catch (error) {
19745
19725
  throw mapException(error);
@@ -19827,12 +19807,14 @@ var FishjamClient = class {
19827
19807
  }
19828
19808
  };
19829
19809
  var export_PeerOptions = import_fishjam_openapi2.PeerOptions;
19810
+ var export_PeerOptionsAgent = import_fishjam_openapi2.PeerOptionsAgent;
19811
+ var export_PeerOptionsWebRTC = import_fishjam_openapi2.PeerOptionsWebRTC;
19830
19812
  var export_PeerStatus = import_fishjam_openapi2.PeerStatus;
19831
19813
  var export_RoomConfig = import_fishjam_openapi2.RoomConfig;
19832
- var export_RoomConfigRoomTypeEnum = import_fishjam_openapi2.RoomConfigRoomTypeEnum;
19833
- var export_RoomConfigVideoCodecEnum = import_fishjam_openapi2.RoomConfigVideoCodecEnum;
19814
+ var export_RoomType = import_fishjam_openapi2.RoomType;
19834
19815
  var export_ServerMessage = import_fishjam_proto3.ServerMessage;
19835
19816
  var export_StreamerToken = import_fishjam_openapi2.StreamerToken;
19817
+ var export_VideoCodec = import_fishjam_openapi2.VideoCodec;
19836
19818
  var export_ViewerToken = import_fishjam_openapi2.ViewerToken;
19837
19819
  export {
19838
19820
  BadRequestException,
@@ -19845,16 +19827,18 @@ export {
19845
19827
  MissingFishjamIdException,
19846
19828
  PeerNotFoundException,
19847
19829
  export_PeerOptions as PeerOptions,
19830
+ export_PeerOptionsAgent as PeerOptionsAgent,
19831
+ export_PeerOptionsWebRTC as PeerOptionsWebRTC,
19848
19832
  export_PeerStatus as PeerStatus,
19849
19833
  export_RoomConfig as RoomConfig,
19850
- export_RoomConfigRoomTypeEnum as RoomConfigRoomTypeEnum,
19851
- export_RoomConfigVideoCodecEnum as RoomConfigVideoCodecEnum,
19852
19834
  RoomNotFoundException,
19835
+ export_RoomType as RoomType,
19853
19836
  export_ServerMessage as ServerMessage,
19854
19837
  ServiceUnavailableException,
19855
19838
  export_StreamerToken as StreamerToken,
19856
19839
  UnauthorizedException,
19857
19840
  UnknownException,
19841
+ export_VideoCodec as VideoCodec,
19858
19842
  export_ViewerToken as ViewerToken
19859
19843
  };
19860
19844
  /*! Bundled license information:
@@ -0,0 +1,39 @@
1
+ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
2
+
3
+ /**
4
+ * A collection of settings for Google Gemini integration.
5
+ */
6
+ declare const _default: {
7
+ /**
8
+ * Creates a GoogleGenAI client.
9
+ * This function dynamically imports the "@google/genai" module,
10
+ * so it will only be loaded when this function is called.
11
+ *
12
+ * @param options Configuration for the GoogleGenAI client.
13
+ * @returns A GoogleGenAI instance.
14
+ */
15
+ createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Predefined audio settings for the agent's output track,
18
+ * configured for Gemini's 24kHz audio output.
19
+ */
20
+ geminiOutputAudioSettings: {
21
+ readonly encoding: "pcm16";
22
+ readonly channels: 1;
23
+ readonly sampleRate: 24000;
24
+ };
25
+ /**
26
+ * Predefined audio settings for subscribing to room audio,
27
+ * configured for Gemini's 16kHz audio input.
28
+ */
29
+ geminiInputAudioSettings: {
30
+ readonly audioFormat: "pcm16";
31
+ readonly audioSampleRate: 16000;
32
+ };
33
+ /**
34
+ * The MIME type for the audio data sent to Gemini.
35
+ */
36
+ inputMimeType: "audio/pcm;rate=16000";
37
+ };
38
+
39
+ export { _default as default };
@@ -0,0 +1,39 @@
1
+ import { GoogleGenAIOptions, GoogleGenAI } from '@google/genai';
2
+
3
+ /**
4
+ * A collection of settings for Google Gemini integration.
5
+ */
6
+ declare const _default: {
7
+ /**
8
+ * Creates a GoogleGenAI client.
9
+ * This function dynamically imports the "@google/genai" module,
10
+ * so it will only be loaded when this function is called.
11
+ *
12
+ * @param options Configuration for the GoogleGenAI client.
13
+ * @returns A GoogleGenAI instance.
14
+ */
15
+ createClient: (options: GoogleGenAIOptions) => GoogleGenAI;
16
+ /**
17
+ * Predefined audio settings for the agent's output track,
18
+ * configured for Gemini's 24kHz audio output.
19
+ */
20
+ geminiOutputAudioSettings: {
21
+ readonly encoding: "pcm16";
22
+ readonly channels: 1;
23
+ readonly sampleRate: 24000;
24
+ };
25
+ /**
26
+ * Predefined audio settings for subscribing to room audio,
27
+ * configured for Gemini's 16kHz audio input.
28
+ */
29
+ geminiInputAudioSettings: {
30
+ readonly audioFormat: "pcm16";
31
+ readonly audioSampleRate: 16000;
32
+ };
33
+ /**
34
+ * The MIME type for the audio data sent to Gemini.
35
+ */
36
+ inputMimeType: "audio/pcm;rate=16000";
37
+ };
38
+
39
+ export { _default as default };