- Documentation
- Client events
- onClientSoundStream
Event
onClientSoundStream
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,
0for 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
playSoundPlays an MP3 or WAV file from a resource or an internet stream (http:///https://, MP3 and AAC, including radio) with no position in the world (it sounds the same everywhere). A file must be listed inmeta.xmlas a<file>. TheonClientSoundStreamevent reports the result of connecting to an address.playSound3DPlays a sound (a file or an internet stream) at a point in the world. Full volume up to 5 m, then it fades smoothly and loses high tones, silent from 20 m. Walls and buildings between the camera and the sound make it quieter and leave a muffled bass (getSoundOcclusion). It is panned left-right.getSoundMetaTagsReturns a table with tags of an internet stream:stream_title(the current song title from ICY radio or an empty string).