ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client events
  3. onClientSoundStream

Event

onClientSoundStream

ClientSound (client)Identical to MTA:SA

The result of connecting a sound to an http(s):// address (playSound/playSound3D). true after the first decoded samples; false after an error and one silent reconnect attempt.

Handler

addEventHandler("onClientSoundStream", root, function(success, length, streamName, error) ... end)

Parameters

successbool
Whether the stream plays.
lengthfloat
Length in seconds, 0 for radio or unknown.
streamNamestring
The station name (ICY) or an empty string.
errorstring
The error reason or an empty string.

Source

source is the sound.

Example

local radio = playSound3D("https://s2.radioparty.pl/energy2000stream", x, y, z)
addEventHandler("onClientSoundStream", radio, function(success, length, streamName, err)
    outputChatBox(success and ("Radio: " .. streamName) or ("Błąd radia: " .. err))
end)

See also