betterxSound
Overview
A maintained, drop-in replacement for xSound with the YouTube memory leak fixed and trigger events secured.
betterxSound is a maintained, drop-in replacement for Xogy/xsound.
It keeps the original API — same exports, events, and resource name xsound — so you replace the
folder and change nothing else.
Preview
What is fixed
- YouTube memory — mitigated, not magic. The leak is inherent to YouTube's embedded player and
how CEF retains it; it cannot be made fully leak-free while embedding YouTube. This fork reduces it:
the duration probe no longer spawns a second hidden player, players are pooled and reused across
songs via
loadVideoById(capped byyoutubePoolMax), and an idle browser recycle reclaims memory when nothing is playing. Continuous / jukebox playback stays flat. A long-lived sound (a looped siren, a global stream, anything not destroyed) keeps a player alive, so memory still grows there — genuinely leak-free YouTube audio needs a server-side direct-stream extraction instead of an embed. - Anti-abuse. The interact-sound emulator and crewphone trigger events are rate-limited, volume-clamped, and file/URL validated on the server, with an optional permission gate for server-wide broadcasts. Players can no longer spam sounds at everyone.
- Self-contained. howler (2.2.4), jQuery and DOMPurify are bundled locally — no CDN dependency.
Requirements
- A FiveM server (the resource ships everything else).
The resource folder must stay named xsound. Exports (exports.xsound:*), events
(xsound:stateSound), and the NUI origin (cfx-nui-xsound) all depend on that name.
Credits
Original xSound by Xogy — https://github.com/Xogy/xsound. Licensed under MIT; this fork keeps the original license and adds its modifications under the same terms.
