Fix listener chunksReceived ReferenceError
This commit is contained in:
parent
1612c21c8e
commit
a5223a01fc
|
|
@ -1545,6 +1545,7 @@ let isBroadcasting = false;
|
||||||
let autoStartStream = false;
|
let autoStartStream = false;
|
||||||
let listenerAudioContext = null;
|
let listenerAudioContext = null;
|
||||||
let listenerGainNode = null;
|
let listenerGainNode = null;
|
||||||
|
let listenerChunksReceived = 0;
|
||||||
|
|
||||||
// Initialize SocketIO connection
|
// Initialize SocketIO connection
|
||||||
function initSocket() {
|
function initSocket() {
|
||||||
|
|
@ -2206,6 +2207,7 @@ function initListenerMode() {
|
||||||
hasHeader = true; // No header request needed for WebM relay
|
hasHeader = true; // No header request needed for WebM relay
|
||||||
|
|
||||||
chunksReceived++;
|
chunksReceived++;
|
||||||
|
listenerChunksReceived = chunksReceived;
|
||||||
audioQueue.push(data);
|
audioQueue.push(data);
|
||||||
|
|
||||||
// JITTER BUFFER: Reduced to 1 segments (buffered) for WebM/Opus
|
// JITTER BUFFER: Reduced to 1 segments (buffered) for WebM/Opus
|
||||||
|
|
@ -2352,8 +2354,9 @@ async function enableListenerAudio() {
|
||||||
// If no buffered data yet, show status but don't block playback
|
// If no buffered data yet, show status but don't block playback
|
||||||
if (!hasBufferedData()) {
|
if (!hasBufferedData()) {
|
||||||
console.log('⏳ Waiting for audio data to buffer...');
|
console.log('⏳ Waiting for audio data to buffer...');
|
||||||
|
const chunkCount = Number.isFinite(listenerChunksReceived) ? listenerChunksReceived : 0;
|
||||||
if (audioText) {
|
if (audioText) {
|
||||||
audioText.textContent = chunksReceived > 0 ? 'BUFFERING...' : 'WAITING FOR STREAM...';
|
audioText.textContent = chunkCount > 0 ? 'BUFFERING...' : 'WAITING FOR STREAM...';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a background checker to update UI
|
// Start a background checker to update UI
|
||||||
|
|
@ -2361,7 +2364,8 @@ async function enableListenerAudio() {
|
||||||
if (hasBufferedData()) {
|
if (hasBufferedData()) {
|
||||||
clearInterval(checkInterval);
|
clearInterval(checkInterval);
|
||||||
console.log('✅ Audio data buffered');
|
console.log('✅ Audio data buffered');
|
||||||
} else if (audioText && chunksReceived > 0 && audioText.textContent === 'WAITING FOR STREAM...') {
|
const chunkCount = Number.isFinite(listenerChunksReceived) ? listenerChunksReceived : 0;
|
||||||
|
} else if (audioText && chunkCount > 0 && audioText.textContent === 'WAITING FOR STREAM...') {
|
||||||
audioText.textContent = 'BUFFERING...';
|
audioText.textContent = 'BUFFERING...';
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue