@hivegpt/hiveai-angular 0.0.456 → 0.0.458

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.
@@ -1334,6 +1334,7 @@
1334
1334
  return [4 /*yield*/, callObject.join(joinOptions)];
1335
1335
  case 4:
1336
1336
  _e.sent();
1337
+ console.log("[VoiceDebug] Room connected (Daily join complete) \u2014 " + new Date().toISOString());
1337
1338
  participants = callObject.participants();
1338
1339
  if (participants === null || participants === void 0 ? void 0 : participants.local) {
1339
1340
  this.localSessionId = participants.local.session_id;
@@ -1368,9 +1369,8 @@
1368
1369
  _this.speakingSubject.next(!isLocal);
1369
1370
  });
1370
1371
  });
1371
- // track-started / track-stopped: play remote (bot) audio explicitly and update speaking state.
1372
- // Browsers often do not auto-play remote WebRTC audio; attaching to an HTMLAudioElement and
1373
- // calling play() ensures the user hears the agent.
1372
+ // track-started / track-stopped: set up remote audio playback only.
1373
+ // Speaking state is driven by active-speaker-change (actual audio energy), NOT track lifecycle.
1374
1374
  call.on('track-started', function (event) {
1375
1375
  _this.ngZone.run(function () {
1376
1376
  var _a, _b, _c, _d;
@@ -1378,7 +1378,7 @@
1378
1378
  var type = (_a = event === null || event === void 0 ? void 0 : event.type) !== null && _a !== void 0 ? _a : (_b = event === null || event === void 0 ? void 0 : event.track) === null || _b === void 0 ? void 0 : _b.kind;
1379
1379
  var track = event === null || event === void 0 ? void 0 : event.track;
1380
1380
  if (p && !p.local && type === 'audio') {
1381
- _this.speakingSubject.next(true);
1381
+ console.log("[VoiceDebug] Got audio track from backend (track-started) \u2014 readyState=" + (track === null || track === void 0 ? void 0 : track.readyState) + ", muted=" + (track === null || track === void 0 ? void 0 : track.muted) + " \u2014 " + new Date().toISOString());
1382
1382
  var audioTrack = track !== null && track !== void 0 ? track : (_d = (_c = p.tracks) === null || _c === void 0 ? void 0 : _c.audio) === null || _d === void 0 ? void 0 : _d.track;
1383
1383
  if (audioTrack && typeof audioTrack === 'object') {
1384
1384
  _this.playRemoteTrack(audioTrack);
@@ -1392,7 +1392,6 @@
1392
1392
  var p = event === null || event === void 0 ? void 0 : event.participant;
1393
1393
  var type = (_a = event === null || event === void 0 ? void 0 : event.type) !== null && _a !== void 0 ? _a : (_b = event === null || event === void 0 ? void 0 : event.track) === null || _b === void 0 ? void 0 : _b.kind;
1394
1394
  if (p && !p.local && type === 'audio') {
1395
- _this.speakingSubject.next(false);
1396
1395
  _this.stopRemoteAudio();
1397
1396
  }
1398
1397
  });
@@ -1415,14 +1414,30 @@
1415
1414
  DailyVoiceClientService.prototype.playRemoteTrack = function (track) {
1416
1415
  this.stopRemoteAudio();
1417
1416
  try {
1417
+ console.log("[VoiceDebug] playRemoteTrack called \u2014 track.readyState=" + track.readyState + ", track.muted=" + track.muted + " \u2014 " + new Date().toISOString());
1418
+ track.onunmute = function () {
1419
+ console.log("[VoiceDebug] Remote audio track UNMUTED (audio data arriving) \u2014 " + new Date().toISOString());
1420
+ };
1418
1421
  var stream = new MediaStream([track]);
1419
1422
  var audio = new Audio();
1420
1423
  audio.autoplay = true;
1421
1424
  audio.srcObject = stream;
1422
1425
  this.remoteAudioElement = audio;
1426
+ audio.onplaying = function () {
1427
+ console.log("[VoiceDebug] Audio element PLAYING (browser started playback) \u2014 " + new Date().toISOString());
1428
+ };
1429
+ var firstTimeUpdate_1 = true;
1430
+ audio.ontimeupdate = function () {
1431
+ if (firstTimeUpdate_1) {
1432
+ firstTimeUpdate_1 = false;
1433
+ console.log("[VoiceDebug] Audio element first TIMEUPDATE (actual audio output) \u2014 " + new Date().toISOString());
1434
+ }
1435
+ };
1423
1436
  var p = audio.play();
1424
- if (p && typeof p.catch === 'function') {
1425
- p.catch(function (err) {
1437
+ if (p && typeof p.then === 'function') {
1438
+ p.then(function () {
1439
+ console.log("[VoiceDebug] audio.play() resolved \u2014 " + new Date().toISOString());
1440
+ }).catch(function (err) {
1426
1441
  console.warn('DailyVoiceClient: remote audio play failed (may need user gesture)', err);
1427
1442
  });
1428
1443
  }
@@ -1690,6 +1705,7 @@
1690
1705
  _this.callStateSubject.next('listening');
1691
1706
  }
1692
1707
  else if (bot) {
1708
+ console.log("[VoiceDebug] Agent starts speaking (callState \u2192 talking) \u2014 " + new Date().toISOString());
1693
1709
  _this.callStateSubject.next('talking');
1694
1710
  }
1695
1711
  else if (_this.callStateSubject.value === 'talking' ||
@@ -1698,6 +1714,7 @@
1698
1714
  }
1699
1715
  }));
1700
1716
  this.subscriptions.add(this.dailyClient.micMuted$.subscribe(function (muted) { return _this.isMicMutedSubject.next(muted); }));
1717
+ console.log("[VoiceDebug] Room fully connected (callState \u2192 connected) \u2014 " + new Date().toISOString());
1701
1718
  this.callStateSubject.next('connected');
1702
1719
  this.statusTextSubject.next('Connected');
1703
1720
  this.callStartTime = Date.now();