Fix remote voice negotiation and teleport cue timing

This commit is contained in:
Jage9
2026-02-25 02:01:37 -05:00
parent fad78e12af
commit 561801e97c
3 changed files with 6 additions and 4 deletions

View File

@@ -160,9 +160,8 @@ export function createOnMessageHandler(deps: MessageHandlerDeps): (message: Inco
deps.peerManager.setPeerPosition(message.id, message.x, message.y);
if (peer) {
const movementDelta = Math.hypot(message.x - prevX, message.y - prevY);
const soundUrl = movementDelta > 1.5 ? deps.TELEPORT_START_SOUND_URL : deps.randomFootstepUrl();
if (deps.getAudioLayers().world) {
deps.playRemoteSpatialStepOrTeleport(soundUrl, peer.x, peer.y);
if (movementDelta <= 1.5 && deps.getAudioLayers().world) {
deps.playRemoteSpatialStepOrTeleport(deps.randomFootstepUrl(), peer.x, peer.y);
}
}
break;

View File

@@ -50,6 +50,9 @@ export class PeerManager {
const stream = this.getLocalStream();
if (stream) {
stream.getTracks().forEach((track) => pc.addTrack(track, stream));
} else {
// Ensure initial offers still negotiate audio receive even before mic setup finishes.
pc.addTransceiver('audio', { direction: 'sendrecv' });
}
pc.onicecandidate = (event) => {