@pipecat-ai/daily-transport 0.3.9 → 0.4.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.
@@ -2,6 +2,10 @@ import $7zbD8$dailycodailyjs from "@daily-co/daily-js";
2
2
  import {logger as $7zbD8$logger, RTVIError as $7zbD8$RTVIError, TransportStartError as $7zbD8$TransportStartError, RTVIMessage as $7zbD8$RTVIMessage, Transport as $7zbD8$Transport} from "@pipecat-ai/client-js";
3
3
 
4
4
 
5
+ function $parcel$interopDefault(a) {
6
+ return a && a.__esModule ? a.default : a;
7
+ }
8
+
5
9
  function $parcel$export(e, n, v, s) {
6
10
  Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
7
11
  }
@@ -1422,6 +1426,10 @@ globalThis.WavRecorder = WavRecorder;
1422
1426
 
1423
1427
 
1424
1428
 
1429
+ var $58d19ff082af5e5c$exports = {};
1430
+ $58d19ff082af5e5c$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\"}");
1431
+
1432
+
1425
1433
  var $683f111f61e07358$export$ef180de88fd317cc;
1426
1434
  (function(DailyRTVIMessageType) {
1427
1435
  DailyRTVIMessageType["AUDIO_BUFFERING_STARTED"] = "audio-buffering-started";
@@ -1441,7 +1449,7 @@ class $683f111f61e07358$var$DailyCallWrapper {
1441
1449
  errMsg = `Calls to preAuth() are disabled. Please use Transport.preAuth()`;
1442
1450
  break;
1443
1451
  case "startCamera":
1444
- errMsg = `Calls to startCamera() are disabled. Please use RTVIClient.initDevices() or Transport.initDevices()`;
1452
+ errMsg = `Calls to startCamera() are disabled. Please use RTVIClient.initDevices()`;
1445
1453
  break;
1446
1454
  case "join":
1447
1455
  errMsg = `Calls to join() are disabled. Please use RTVIClient.connect()`;
@@ -1537,7 +1545,7 @@ class $683f111f61e07358$export$b1ca982aa1e488c1 extends (0, $7zbD8$Transport) {
1537
1545
  this._dailyFactoryOptions.startAudioOff = !(options.enableMic ?? true);
1538
1546
  this.attachEventListeners();
1539
1547
  this.state = "disconnected";
1540
- (0, $7zbD8$logger).debug("[RTVI Transport] Initialized");
1548
+ (0, $7zbD8$logger).debug("[RTVI Transport] Initialized", (0, (/*@__PURE__*/$parcel$interopDefault($58d19ff082af5e5c$exports))).version);
1541
1549
  }
1542
1550
  get dailyCallClient() {
1543
1551
  return this._dailyWrapper.proxy;
@@ -1692,19 +1700,33 @@ class $683f111f61e07358$export$b1ca982aa1e488c1 extends (0, $7zbD8$Transport) {
1692
1700
  }
1693
1701
  async sendReadyMessage() {
1694
1702
  return new Promise((resolve)=>{
1695
- (async ()=>{
1696
- const readyHandler = (ev)=>{
1697
- if (!ev.participant?.local) {
1698
- this.state = "ready";
1699
- this.flushAudioQueue();
1700
- this.sendMessage((0, $7zbD8$RTVIMessage).clientReady());
1701
- this.stopRecording();
1702
- this._daily.off("track-started", readyHandler);
1703
- resolve();
1704
- }
1705
- };
1706
- this._daily.on("track-started", readyHandler);
1707
- })();
1703
+ // Detect iOS devices
1704
+ const isIOS = ()=>{
1705
+ const userAgent = navigator.userAgent;
1706
+ return /iPad|iPhone|iPod/.test(userAgent) || /Macintosh/.test(userAgent) && "ontouchend" in document;
1707
+ };
1708
+ const sendReadyMessage = ()=>{
1709
+ this.state = "ready";
1710
+ this.flushAudioQueue();
1711
+ this.sendMessage((0, $7zbD8$RTVIMessage).clientReady());
1712
+ this.stopRecording();
1713
+ resolve();
1714
+ };
1715
+ const readyHandler = (ev)=>{
1716
+ if (!ev.participant?.local) {
1717
+ this._daily.off("track-started", readyHandler);
1718
+ // Check if it's an iOS device
1719
+ if (isIOS()) {
1720
+ (0, $7zbD8$logger).debug("[RTVI Transport] iOS device detected, adding 0.5 second delay before sending ready message");
1721
+ // Add 500ms delay for iOS devices:
1722
+ // This is a workaround for iOS devices clipping a portion
1723
+ // of the audio after the track becomes playable.
1724
+ setTimeout(sendReadyMessage, 500);
1725
+ } else // Non-iOS device, send ready message immediately
1726
+ sendReadyMessage();
1727
+ }
1728
+ };
1729
+ this._daily.on("track-started", readyHandler);
1708
1730
  });
1709
1731
  }
1710
1732
  stopRecording() {