Hugo.V commited on
Commit
4492f35
·
2 Parent(s): c8275ddd2e5e94

Merge branch 'main' of https://huggingface.co/spaces/Jarilo-Project/jericho

Browse files
Files changed (2) hide show
  1. jericho/main.py +6 -3
  2. jericho/static/main.js +3 -9
jericho/main.py CHANGED
@@ -241,8 +241,8 @@ class RobotAudioStreamer:
241
  SAMPLE_RATE = 16000
242
  CHANNELS = 2
243
  CHUNK_SECONDS = 0.08
244
- QUEUE_AHEAD_SECONDS = 0.20
245
- RESYNC_THRESHOLD_SECONDS = 0.25
246
 
247
  def __init__(self, app: "Jericho"):
248
  self.app = app
@@ -309,7 +309,10 @@ class RobotAudioStreamer:
309
  media.start_playing()
310
  for obj in (media, getattr(media, "audio", None)):
311
  if obj is not None and hasattr(obj, "set_max_output_buffers"):
312
- obj.set_max_output_buffers(3) # limite latence tampons
 
 
 
313
  self.output_started = True
314
  except Exception as exc:
315
  self.audio_available = False
 
241
  SAMPLE_RATE = 16000
242
  CHANNELS = 2
243
  CHUNK_SECONDS = 0.08
244
+ QUEUE_AHEAD_SECONDS = 0.40
245
+ RESYNC_THRESHOLD_SECONDS = 0.50
246
 
247
  def __init__(self, app: "Jericho"):
248
  self.app = app
 
309
  media.start_playing()
310
  for obj in (media, getattr(media, "audio", None)):
311
  if obj is not None and hasattr(obj, "set_max_output_buffers"):
312
+ try:
313
+ obj.set_max_output_buffers(3) # limite latence tampons
314
+ except Exception:
315
+ pass # non bloquant si echec
316
  self.output_started = True
317
  except Exception as exc:
318
  self.audio_available = False
jericho/static/main.js CHANGED
@@ -1,7 +1,7 @@
1
  let currentLoadedProject = null;
2
  let syncTimer = null;
3
  let lastSyncSent = 0;
4
- const SYNC_INTERVAL_MS = 250;
5
 
6
  const robotStatus = document.getElementById('robot-status');
7
  const videoPlayer = document.getElementById('video-player');
@@ -336,13 +336,7 @@ videoPlayer.addEventListener('seeked', () => {
336
  });
337
 
338
  videoPlayer.addEventListener('timeupdate', () => {
339
- if (!currentLoadedProject || videoPlayer.paused || videoPlayer.ended) return;
340
-
341
- const now = Date.now();
342
- if (now - lastSyncSent >= SYNC_INTERVAL_MS) {
343
- lastSyncSent = now;
344
- sendPlayback('sync', { playing: true });
345
- }
346
  });
347
 
348
  videoPlayer.addEventListener('ended', () => {
@@ -380,7 +374,7 @@ function createEmotionRow() {
380
 
381
  const btnRemove = document.createElement('button');
382
  btnRemove.textContent = '✗';
383
- btnRemove.style.background = '#c77981';
384
  btnRemove.style.color = 'white';
385
  btnRemove.style.border = 'none';
386
  btnRemove.style.cursor = 'pointer';
 
1
  let currentLoadedProject = null;
2
  let syncTimer = null;
3
  let lastSyncSent = 0;
4
+ const SYNC_INTERVAL_MS = 500;
5
 
6
  const robotStatus = document.getElementById('robot-status');
7
  const videoPlayer = document.getElementById('video-player');
 
336
  });
337
 
338
  videoPlayer.addEventListener('timeupdate', () => {
339
+ // synchro geree par startSyncLoop(), ici pas de double envoi
 
 
 
 
 
 
340
  });
341
 
342
  videoPlayer.addEventListener('ended', () => {
 
374
 
375
  const btnRemove = document.createElement('button');
376
  btnRemove.textContent = '✗';
377
+ btnRemove.style.background = '#e74c3c';
378
  btnRemove.style.color = 'white';
379
  btnRemove.style.border = 'none';
380
  btnRemove.style.cursor = 'pointer';