Repro code:
import { Player, system, world } from '@minecraft/server';
system.afterEvents.scriptEventReceive.subscribe(({ id, sourceEntity }) => {
if (id !== 'sandbox:seekloop') return;
const player = sourceEntity instanceof Player
? sourceEntity
: world.getPlayers()[0];
if (!player) return;
const instances = [];
for (let i = 0; i < 16; i++) {
instances.push(player.dimension.playSound('record.cat', player.location));
}
system.run(() => {
for (let i = 0; i < 16; i++) {
instances[i].seekTo(30);
}
});
});SoundInstance.seekTo() blocks the Minecraft client main thread on streamed sounds and drops frames. A single SoundInstance.seekTo() call on record.cat produces a visible hitch. Sixteen concurrent SoundInstance.seekTo() calls freeze the client briefly and causes audio desync.
Observed behavior
The tests below isolate SoundInstance.seekTo() from the other sound controls.
Dimension.playSound(),SoundInstance.pause(), andSoundInstance.resume()run across 16 concurrent instances ofrecord.catwithout a client stall.A single
SoundInstance.seekTo(30)call onrecord.catstalls the client main thread.Sixteen
SoundInstance.seekTo(30)calls multiply the stall.A
system.runJob()loop or a one-call-per-tick schedule does not remove the hitch, because each individual seek blocks the client.
Expected behavior
SoundInstance.seekTo() seeks streamed audio off the client main thread so playback position updates do not drop frames or stall gameplay.
Comments 0
No comments.