@pipecat-ai/daily-transport 0.4.0 → 1.0.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
@@ -1,25 +1,32 @@
1
- import { DailyCall, DailyFactoryOptions, DailyMediaDeviceInfo } from "@daily-co/daily-js";
2
- import { RTVIClientOptions, RTVIMessage, Tracks, Transport, TransportState } from "@pipecat-ai/client-js";
3
- export interface DailyTransportAuthBundle {
4
- room_url: string;
5
- token: string;
1
+ import { DailyCall, DailyCallOptions, DailyFactoryOptions, DailyMeetingSessionSummary, DailyMediaDeviceInfo } from "@daily-co/daily-js";
2
+ import { PipecatClientOptions, RTVIEventCallbacks, RTVIMessage, Tracks, Transport, TransportState } from "@pipecat-ai/client-js";
3
+ export interface DailyConnectionEndpoint {
4
+ endpoint: string;
5
+ headers?: Headers;
6
+ requestData?: object;
7
+ timeout?: number;
6
8
  }
7
- export interface DailyTransportConstructorOptions {
9
+ export interface DailyTransportConstructorOptions extends DailyFactoryOptions {
8
10
  bufferLocalAudioUntilBotReady?: boolean;
9
- dailyFactoryOptions?: DailyFactoryOptions;
10
11
  }
11
12
  export enum DailyRTVIMessageType {
12
13
  AUDIO_BUFFERING_STARTED = "audio-buffering-started",
13
14
  AUDIO_BUFFERING_STOPPED = "audio-buffering-stopped"
14
15
  }
16
+ export type DailyEventCallbacks = RTVIEventCallbacks & Partial<{
17
+ onAudioBufferingStarted: () => void;
18
+ onAudioBufferingStopped: () => void;
19
+ }>;
15
20
  export class DailyTransport extends Transport {
16
- constructor({ dailyFactoryOptions, bufferLocalAudioUntilBotReady, }?: DailyTransportConstructorOptions);
21
+ protected _callbacks: DailyEventCallbacks;
22
+ constructor(opts?: DailyTransportConstructorOptions);
17
23
  handleUserAudioStream(data: ArrayBuffer): void;
18
24
  _sendAudioBatch(dataBatch: ArrayBuffer[]): void;
19
- initialize(options: RTVIClientOptions, messageHandler: (ev: RTVIMessage) => void): void;
25
+ initialize(options: PipecatClientOptions, messageHandler: (ev: RTVIMessage) => void): void;
20
26
  get dailyCallClient(): DailyCall;
21
27
  get state(): TransportState;
22
28
  private set state(value);
29
+ getSessionInfo(): DailyMeetingSessionSummary;
23
30
  getAllCams(): Promise<DailyMediaDeviceInfo[]>;
24
31
  updateCam(camId: string): void;
25
32
  get selectedCam(): MediaDeviceInfo | Record<string, never>;
@@ -36,11 +43,12 @@ export class DailyTransport extends Transport {
36
43
  enableScreenShare(enable: boolean): void;
37
44
  get isSharingScreen(): boolean;
38
45
  tracks(): Tracks;
39
- preAuth(dailyFactoryOptions: DailyFactoryOptions): Promise<void>;
46
+ preAuth(dailyCallOptions: DailyCallOptions): Promise<void>;
40
47
  initDevices(): Promise<void>;
41
- connect(authBundle: DailyTransportAuthBundle, abortController: AbortController): Promise<void>;
48
+ _validateConnectionParams(connectParams?: unknown): DailyCallOptions | undefined;
49
+ _connect(connectParams?: DailyCallOptions): Promise<void>;
42
50
  sendReadyMessage(): Promise<void>;
43
- disconnect(): Promise<void>;
51
+ _disconnect(): Promise<void>;
44
52
  sendMessage(message: RTVIMessage): void;
45
53
  }
46
54
 
@@ -1 +1 @@
1
- {"mappings":";;ASgCA;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;IACE,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC,mBAAmB,CAAC,EAAE,mBAAmB,CAAC;CAC3C;AAED;IACE,uBAAuB,4BAA4B;IACnD,uBAAuB,4BAA4B;CACpD;AAoDD,2BAA4B,SAAQ,SAAS;gBAiB/B,EACV,mBAAwB,EACxB,6BAAqC,GACtC,GAAE,gCAAqC;IAoBxC,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA2B9C,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI;IAoBxC,UAAU,CACf,OAAO,EAAE,iBAAiB,EAC1B,cAAc,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,GACxC,IAAI;IA8BP,IAAI,eAAe,IAAI,SAAS,CAE/B;IAED,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,OAAO,KAAK,KAAK,QAKhB;IAEK,UAAU;IAKhB,SAAS,CAAC,KAAK,EAAE,MAAM;IAUvB,IAAI,WAAW,4CAEd;IAEK,UAAU;IAKhB,SAAS,CAAC,KAAK,EAAE,MAAM;IAUvB,IAAI,WAAW,4CAEd;IAEK,cAAc;IAKpB,aAAa,CAAC,SAAS,EAAE,MAAM;IAQ/B,IAAI,eAAe,4CAElB;IAED,SAAS,CAAC,MAAM,EAAE,OAAO;IAIzB,IAAI,YAAY,YAEf;IAED,SAAS,CAAC,MAAM,EAAE,OAAO;IAIzB,IAAI,YAAY,YAEf;IAEM,iBAAiB,CAAC,MAAM,EAAE,OAAO;IAQxC,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,MAAM;IA0CA,OAAO,CAAC,mBAAmB,EAAE,mBAAmB;IAKhD,WAAW;IAgCX,OAAO,CACX,UAAU,EAAE,wBAAwB,EACpC,eAAe,EAAE,eAAe;IAmC5B,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAsFjC,UAAU;IAYT,WAAW,CAAC,OAAO,EAAE,WAAW;CAiLxC","sources":["transports/lib/wavtools/lib/wav_packer.js","transports/lib/wavtools/lib/analysis/constants.js","transports/lib/wavtools/lib/analysis/audio_analysis.js","transports/lib/wavtools/lib/worklets/stream_processor.js","transports/lib/wavtools/lib/wav_stream_player.js","transports/lib/wavtools/lib/worklets/audio_processor.js","transports/lib/wavtools/lib/wav_recorder.js","transports/lib/wavtools/lib/mediastream_recorder.js","transports/lib/wavtools/index.js","transports/daily/src/src/transport.ts","transports/daily/src/src/index.ts","transports/daily/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"export * from \"./transport\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
1
+ {"mappings":";;ASiCA;IACE,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iDAAkD,SAAQ,mBAAmB;IAC3E,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;IACE,uBAAuB,4BAA4B;IACnD,uBAAuB,4BAA4B;CACpD;AAED,kCAAkC,kBAAkB,GAClD,OAAO,CAAC;IACN,uBAAuB,EAAE,MAAM,IAAI,CAAC;IACpC,uBAAuB,EAAE,MAAM,IAAI,CAAC;CACrC,CAAC,CAAC;AAoDL,2BAA4B,SAAQ,SAAS;IAE3C,UAAkB,UAAU,EAAE,mBAAmB,CAAC;gBAkBtC,IAAI,GAAE,gCAAqC;IAuBvD,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IA2B9C,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI;IAoBxC,UAAU,CACf,OAAO,EAAE,oBAAoB,EAC7B,cAAc,EAAE,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,GACxC,IAAI;IA8BP,IAAI,eAAe,IAAI,SAAS,CAE/B;IAED,IAAI,KAAK,IAAI,cAAc,CAE1B;IAED,OAAO,KAAK,KAAK,QAKhB;IAED,cAAc;IAIR,UAAU;IAKhB,SAAS,CAAC,KAAK,EAAE,MAAM;IAUvB,IAAI,WAAW,4CAEd;IAEK,UAAU;IAKhB,SAAS,CAAC,KAAK,EAAE,MAAM;IAUvB,IAAI,WAAW,4CAEd;IAEK,cAAc;IAKpB,aAAa,CAAC,SAAS,EAAE,MAAM;IAQ/B,IAAI,eAAe,4CAElB;IAED,SAAS,CAAC,MAAM,EAAE,OAAO;IAIzB,IAAI,YAAY,YAEf;IAED,SAAS,CAAC,MAAM,EAAE,OAAO;IAIzB,IAAI,YAAY,YAEf;IAEM,iBAAiB,CAAC,MAAM,EAAE,OAAO;IAQxC,IAAW,eAAe,IAAI,OAAO,CAEpC;IAED,MAAM;IAuCA,OAAO,CAAC,gBAAgB,EAAE,gBAAgB;IAK1C,WAAW;IAgCjB,yBAAyB,CACvB,aAAa,CAAC,EAAE,OAAO,GACtB,gBAAgB,GAAG,SAAS;IAsBzB,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB;IA6BzC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6FjC,WAAW;IAYV,WAAW,CAAC,OAAO,EAAE,WAAW;CAiLxC","sources":["transports/lib/wavtools/lib/wav_packer.js","transports/lib/wavtools/lib/analysis/constants.js","transports/lib/wavtools/lib/analysis/audio_analysis.js","transports/lib/wavtools/lib/worklets/stream_processor.js","transports/lib/wavtools/lib/wav_stream_player.js","transports/lib/wavtools/lib/worklets/audio_processor.js","transports/lib/wavtools/lib/wav_recorder.js","transports/lib/wavtools/lib/mediastream_recorder.js","transports/lib/wavtools/index.js","transports/daily/src/src/transport.ts","transports/daily/src/src/index.ts","transports/daily/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,"export * from \"./transport\";\n"],"names":[],"version":3,"file":"index.d.ts.map"}
package/dist/index.js CHANGED
@@ -1444,7 +1444,7 @@ globalThis.WavRecorder = WavRecorder;
1444
1444
 
1445
1445
 
1446
1446
  var $c2e964a535c1120e$exports = {};
1447
- $c2e964a535c1120e$exports = JSON.parse("{\"name\":\"@pipecat-ai/daily-transport\",\"version\":\"0.4.0\",\"license\":\"BSD-2-Clause\",\"main\":\"dist/index.js\",\"module\":\"dist/index.module.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.ts\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git\"},\"files\":[\"dist\",\"package.json\",\"README.md\"],\"scripts\":{\"build\":\"parcel build --no-cache\",\"dev\":\"parcel watch\",\"lint\":\"eslint . --ext ts --report-unused-disable-directives --max-warnings 0\"},\"devDependencies\":{\"@pipecat-ai/client-js\":\"^0.4.0\",\"eslint\":\"9.11.1\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-plugin-simple-import-sort\":\"^12.1.1\"},\"peerDependencies\":{\"@pipecat-ai/client-js\":\"~0.4.0\"},\"dependencies\":{\"@daily-co/daily-js\":\"^0.77.0\"},\"description\":\"Pipecat Daily Transport Package\",\"author\":\"Daily.co\",\"bugs\":{\"url\":\"https://github.com/pipecat-ai/pipecat-client-web-transports/issues\"},\"homepage\":\"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md\"}");
1447
+ $c2e964a535c1120e$exports = JSON.parse("{\"name\":\"@pipecat-ai/daily-transport\",\"version\":\"1.0.0\",\"license\":\"BSD-2-Clause\",\"main\":\"dist/index.js\",\"module\":\"dist/index.module.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.ts\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pipecat-ai/pipecat-client-web-transports.git\"},\"files\":[\"dist\",\"package.json\",\"README.md\"],\"scripts\":{\"build\":\"parcel build --no-cache\",\"dev\":\"parcel watch\",\"lint\":\"eslint . --ext ts --report-unused-disable-directives --max-warnings 0\"},\"devDependencies\":{\"@pipecat-ai/client-js\":\"^1.0.0\",\"eslint\":\"9.11.1\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-plugin-simple-import-sort\":\"^12.1.1\"},\"peerDependencies\":{\"@pipecat-ai/client-js\":\"~1.0.0\"},\"dependencies\":{\"@daily-co/daily-js\":\"^0.77.0\"},\"description\":\"Pipecat Daily Transport Package\",\"author\":\"Daily.co\",\"bugs\":{\"url\":\"https://github.com/pipecat-ai/pipecat-client-web-transports/issues\"},\"homepage\":\"https://github.com/pipecat-ai/pipecat-client-web-transports/blob/main/transports/daily-webrtc/README.md\"}");
1448
1448
 
1449
1449
 
1450
1450
  var $28bdeb35415d61e8$export$ef180de88fd317cc;
@@ -1461,18 +1461,18 @@ class $28bdeb35415d61e8$var$DailyCallWrapper {
1461
1461
  let errMsg;
1462
1462
  switch(String(prop)){
1463
1463
  // Disable methods that modify the lifecycle of the call. These operations
1464
- // should be performed via the RTVI client in order to keep state in sync.
1464
+ // should be performed via the PipecatClient in order to keep state in sync.
1465
1465
  case "preAuth":
1466
1466
  errMsg = `Calls to preAuth() are disabled. Please use Transport.preAuth()`;
1467
1467
  break;
1468
1468
  case "startCamera":
1469
- errMsg = `Calls to startCamera() are disabled. Please use RTVIClient.initDevices()`;
1469
+ errMsg = `Calls to startCamera() are disabled. Please use PipecatClient.initDevices()`;
1470
1470
  break;
1471
1471
  case "join":
1472
- errMsg = `Calls to join() are disabled. Please use RTVIClient.connect()`;
1472
+ errMsg = `Calls to join() are disabled. Please use PipecatClient.connect()`;
1473
1473
  break;
1474
1474
  case "leave":
1475
- errMsg = `Calls to leave() are disabled. Please use RTVIClient.disconnect()`;
1475
+ errMsg = `Calls to leave() are disabled. Please use PipecatClient.disconnect()`;
1476
1476
  break;
1477
1477
  case "destroy":
1478
1478
  errMsg = `Calls to destroy() are disabled.`;
@@ -1496,7 +1496,7 @@ class $28bdeb35415d61e8$var$DailyCallWrapper {
1496
1496
  }
1497
1497
  }
1498
1498
  class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclientjs.Transport) {
1499
- constructor({ dailyFactoryOptions: dailyFactoryOptions = {}, bufferLocalAudioUntilBotReady: bufferLocalAudioUntilBotReady = false } = {}){
1499
+ constructor(opts = {}){
1500
1500
  super();
1501
1501
  this._botId = "";
1502
1502
  this._selectedCam = {};
@@ -1505,8 +1505,9 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1505
1505
  this._currentAudioTrack = null;
1506
1506
  this._audioQueue = [];
1507
1507
  this._callbacks = {};
1508
- this._dailyFactoryOptions = dailyFactoryOptions;
1509
- this._bufferLocalAudioUntilBotReady = bufferLocalAudioUntilBotReady;
1508
+ const { bufferLocalAudioUntilBotReady: bufferLocalAudioUntilBotReady, ...dailyOpts } = opts;
1509
+ this._dailyFactoryOptions = dailyOpts;
1510
+ this._bufferLocalAudioUntilBotReady = bufferLocalAudioUntilBotReady || false;
1510
1511
  this._daily = (0, ($parcel$interopDefault($jrPAn$dailycodailyjs))).createCallObject({
1511
1512
  ...this._dailyFactoryOptions,
1512
1513
  allowMultipleCallInstances: true
@@ -1540,7 +1541,7 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1540
1541
  const pcmByteArray = new Uint8Array(data);
1541
1542
  return btoa(String.fromCharCode(...pcmByteArray));
1542
1543
  });
1543
- const rtviMessage = {
1544
+ const audioMessage = {
1544
1545
  id: "raw-audio-batch",
1545
1546
  label: "rtvi-ai",
1546
1547
  type: "raw-audio-batch",
@@ -1550,7 +1551,7 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1550
1551
  numChannels: 1
1551
1552
  }
1552
1553
  };
1553
- this.sendMessage(rtviMessage);
1554
+ this.sendMessage(audioMessage);
1554
1555
  }
1555
1556
  initialize(options, messageHandler) {
1556
1557
  if (this._bufferLocalAudioUntilBotReady) this.setupRecorder();
@@ -1562,7 +1563,7 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1562
1563
  this._dailyFactoryOptions.startAudioOff = !(options.enableMic ?? true);
1563
1564
  this.attachEventListeners();
1564
1565
  this.state = "disconnected";
1565
- (0, $jrPAn$pipecataiclientjs.logger).debug("[RTVI Transport] Initialized", (0, (/*@__PURE__*/$parcel$interopDefault($c2e964a535c1120e$exports))).version);
1566
+ (0, $jrPAn$pipecataiclientjs.logger).debug("[Daily Transport] Initialized", (0, (/*@__PURE__*/$parcel$interopDefault($c2e964a535c1120e$exports))).version);
1566
1567
  }
1567
1568
  get dailyCallClient() {
1568
1569
  return this._dailyWrapper.proxy;
@@ -1575,6 +1576,9 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1575
1576
  this._state = state;
1576
1577
  this._callbacks.onTransportStateChanged?.(state);
1577
1578
  }
1579
+ getSessionInfo() {
1580
+ return this._daily.meetingSessionSummary();
1581
+ }
1578
1582
  async getAllCams() {
1579
1583
  const { devices: devices } = await this._daily.enumerateDevices();
1580
1584
  return devices.filter((d)=>d.kind === "videoinput");
@@ -1655,23 +1659,20 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1655
1659
  }
1656
1660
  async startRecording() {
1657
1661
  try {
1658
- (0, $jrPAn$pipecataiclientjs.logger).info("[RTVI Transport] Initializing recording");
1662
+ (0, $jrPAn$pipecataiclientjs.logger).info("[Daily Transport] Initializing recording");
1659
1663
  await this._mediaStreamRecorder.record((data)=>{
1660
1664
  this.handleUserAudioStream(data.mono);
1661
1665
  }, $28bdeb35415d61e8$export$b1ca982aa1e488c1.RECORDER_CHUNK_SIZE);
1662
- this._onMessage({
1663
- type: $28bdeb35415d61e8$export$ef180de88fd317cc.AUDIO_BUFFERING_STARTED,
1664
- data: {}
1665
- });
1666
- (0, $jrPAn$pipecataiclientjs.logger).info("[RTVI Transport] Recording Initialized");
1666
+ this._callbacks.onAudioBufferingStarted?.();
1667
+ (0, $jrPAn$pipecataiclientjs.logger).info("[Daily Transport] Recording Initialized");
1667
1668
  } catch (e) {
1668
1669
  const err = e;
1669
1670
  if (!err.message.includes("Already recording")) (0, $jrPAn$pipecataiclientjs.logger).error("Error starting recording", e);
1670
1671
  }
1671
1672
  }
1672
- async preAuth(dailyFactoryOptions) {
1673
- this._dailyFactoryOptions = dailyFactoryOptions;
1674
- await this._daily.preAuth(dailyFactoryOptions);
1673
+ async preAuth(dailyCallOptions) {
1674
+ this._dailyFactoryOptions = dailyCallOptions;
1675
+ await this._daily.preAuth(dailyCallOptions);
1675
1676
  }
1676
1677
  async initDevices() {
1677
1678
  if (!this._daily) throw new (0, $jrPAn$pipecataiclientjs.RTVIError)("Transport instance not initialized");
@@ -1695,23 +1696,33 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1695
1696
  if (!this._daily.isRemoteParticipantsAudioLevelObserverRunning()) await this._daily.startRemoteParticipantsAudioLevelObserver(100);
1696
1697
  this.state = "initialized";
1697
1698
  }
1698
- async connect(authBundle, abortController) {
1699
+ _validateConnectionParams(connectParams) {
1700
+ if (connectParams === undefined || connectParams === null) return undefined;
1701
+ if (typeof connectParams !== "object") throw new (0, $jrPAn$pipecataiclientjs.RTVIError)("Invalid connection parameters");
1702
+ const tmpParams = connectParams;
1703
+ if (tmpParams.room_url) {
1704
+ tmpParams.url = tmpParams.room_url;
1705
+ delete tmpParams.room_url;
1706
+ }
1707
+ if (!tmpParams.token) // Daily doesn't like token being in the map and undefined or null
1708
+ delete tmpParams.token;
1709
+ return tmpParams;
1710
+ }
1711
+ async _connect(connectParams) {
1699
1712
  if (!this._daily) throw new (0, $jrPAn$pipecataiclientjs.RTVIError)("Transport instance not initialized");
1700
- if (abortController.signal.aborted) return;
1713
+ if (connectParams) this._dailyFactoryOptions = {
1714
+ ...this._dailyFactoryOptions,
1715
+ ...connectParams
1716
+ };
1701
1717
  this.state = "connecting";
1702
- const opts = this._dailyFactoryOptions;
1703
- opts.url = authBundle.room_url ?? opts.url;
1704
- if (authBundle.token != null) opts.token = authBundle.token;
1705
1718
  try {
1706
- await this._daily.join(opts);
1707
- const room = await this._daily.room();
1708
- if (room && "id" in room) this._expiry = room.config?.exp;
1719
+ await this._daily.join(this._dailyFactoryOptions);
1709
1720
  } catch (e) {
1710
1721
  (0, $jrPAn$pipecataiclientjs.logger).error("Failed to join room", e);
1711
1722
  this.state = "error";
1712
1723
  throw new (0, $jrPAn$pipecataiclientjs.TransportStartError)();
1713
1724
  }
1714
- if (abortController.signal.aborted) return;
1725
+ if (this._abortController?.signal.aborted) return;
1715
1726
  this.state = "connected";
1716
1727
  this._callbacks.onConnected?.();
1717
1728
  }
@@ -1729,12 +1740,21 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1729
1740
  this.stopRecording();
1730
1741
  resolve();
1731
1742
  };
1743
+ for(const id in this._daily.participants()){
1744
+ const p = this._daily.participants()[id];
1745
+ if (!p.local && p.tracks?.audio?.persistentTrack) {
1746
+ // If we already have a remote audio track, we can send the ready message immediately
1747
+ sendReadyMessage();
1748
+ resolve();
1749
+ return;
1750
+ }
1751
+ }
1732
1752
  const readyHandler = (ev)=>{
1733
1753
  if (!ev.participant?.local) {
1734
1754
  this._daily.off("track-started", readyHandler);
1735
1755
  // Check if it's an iOS device
1736
1756
  if (isIOS()) {
1737
- (0, $jrPAn$pipecataiclientjs.logger).debug("[RTVI Transport] iOS device detected, adding 0.5 second delay before sending ready message");
1757
+ (0, $jrPAn$pipecataiclientjs.logger).debug("[Daily Transport] iOS device detected, adding 0.5 second delay before sending ready message");
1738
1758
  // Add 500ms delay for iOS devices:
1739
1759
  // This is a workaround for iOS devices clipping a portion
1740
1760
  // of the audio after the track becomes playable.
@@ -1750,10 +1770,7 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1750
1770
  if (this._mediaStreamRecorder && this._mediaStreamRecorder.getStatus() !== "ended") {
1751
1771
  // disconnecting, we don't need to record anymore
1752
1772
  this._mediaStreamRecorder.end();
1753
- this._onMessage({
1754
- type: $28bdeb35415d61e8$export$ef180de88fd317cc.AUDIO_BUFFERING_STOPPED,
1755
- data: {}
1756
- });
1773
+ this._callbacks.onAudioBufferingStopped?.();
1757
1774
  }
1758
1775
  }
1759
1776
  attachEventListeners() {
@@ -1770,7 +1787,7 @@ class $28bdeb35415d61e8$export$b1ca982aa1e488c1 extends (0, $jrPAn$pipecataiclie
1770
1787
  this._daily.on("error", this.handleFatalError.bind(this));
1771
1788
  this._daily.on("nonfatal-error", this.handleNonFatalError.bind(this));
1772
1789
  }
1773
- async disconnect() {
1790
+ async _disconnect() {
1774
1791
  this.state = "disconnecting";
1775
1792
  this._daily.stopLocalAudioLevelObserver();
1776
1793
  this._daily.stopRemoteParticipantsAudioLevelObserver();