@hivegpt/hiveai-angular 0.0.457 → 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.
@@ -1369,9 +1369,8 @@
1369
1369
  _this.speakingSubject.next(!isLocal);
1370
1370
  });
1371
1371
  });
1372
- // track-started / track-stopped: play remote (bot) audio explicitly and update speaking state.
1373
- // Browsers often do not auto-play remote WebRTC audio; attaching to an HTMLAudioElement and
1374
- // 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.
1375
1374
  call.on('track-started', function (event) {
1376
1375
  _this.ngZone.run(function () {
1377
1376
  var _a, _b, _c, _d;
@@ -1379,8 +1378,7 @@
1379
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;
1380
1379
  var track = event === null || event === void 0 ? void 0 : event.track;
1381
1380
  if (p && !p.local && type === 'audio') {
1382
- console.log("[VoiceDebug] Got audio track from backend (track-started) \u2014 " + new Date().toISOString());
1383
- _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());
1384
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;
1385
1383
  if (audioTrack && typeof audioTrack === 'object') {
1386
1384
  _this.playRemoteTrack(audioTrack);
@@ -1394,7 +1392,6 @@
1394
1392
  var p = event === null || event === void 0 ? void 0 : event.participant;
1395
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;
1396
1394
  if (p && !p.local && type === 'audio') {
1397
- _this.speakingSubject.next(false);
1398
1395
  _this.stopRemoteAudio();
1399
1396
  }
1400
1397
  });
@@ -1417,14 +1414,30 @@
1417
1414
  DailyVoiceClientService.prototype.playRemoteTrack = function (track) {
1418
1415
  this.stopRemoteAudio();
1419
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
+ };
1420
1421
  var stream = new MediaStream([track]);
1421
1422
  var audio = new Audio();
1422
1423
  audio.autoplay = true;
1423
1424
  audio.srcObject = stream;
1424
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
+ };
1425
1436
  var p = audio.play();
1426
- if (p && typeof p.catch === 'function') {
1427
- 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) {
1428
1441
  console.warn('DailyVoiceClient: remote audio play failed (may need user gesture)', err);
1429
1442
  });
1430
1443
  }