Skip to content

Music

Music

Spatial music player using olisound. Uses youtube-sr for search and olisound for direct YouTube playback as 3D positional audio that nearby players can hear.

Database Tables

None (music state is held in-memory only).

Server Callbacks

CallbackPurpose
gcphone:music:searchCatalogSearches YouTube for videos matching a query
gcphone:music:searchITunesAlias for searchCatalog
gcphone:music:canSearchCatalogChecks if a YouTube API key is configured

Net Events (Server)

EventPurpose
gcphone:music:playResolves and plays a YouTube video or direct URL as spatial audio
gcphone:music:pausePauses the current track
gcphone:music:resumeResumes the current track
gcphone:music:stopStops and destroys the current sound
gcphone:music:setVolumeUpdates volume and distance for the current track

Client Events

EventPurpose
gcphone:music:playFromNUINUI bridge to trigger server play
gcphone:music:pauseFromNUINUI bridge to trigger server pause
gcphone:music:resumeFromNUINUI bridge to trigger server resume
gcphone:music:setStateServer -> Client state sync (playing, paused, title, etc.)

Config Options

lua
Config.Features.Music = true

Config.Music = {
    Enabled                = true,
    DefaultVolume          = 0.15,
    DefaultDistance         = 15.0,
    MaxDistance             = 30.0,
    MaxResults             = 12,
    UpdatePositionInterval = 300,  -- ms between position updates
}

Dependencies

  • olisound -- required for spatial audio playback
  • youtube-sr -- YouTube search (included in server/js/node_modules, no install needed)

Exports

None.

Released under GPL-3.0 License