Difference between revisions of "OnClientSoundFinishedDownload"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with '__NOTOC__ {{Client event}} This event is triggered when a sound has just finished downloading. This means the complete sound file is now loaded in the player's RAM, and can be pl…')
 
m
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
  
 
==Example==  
 
==Example==  
 
+
This example would output to the chatbox after the sound is finish that the sound has finished downloading in ... milliseconds.
<syntaxhighlight lang="lua">
+
<syntaxhighlight lang="lua">addEventHandler("onClientSoundFinishedDownload",root,function(length)
--TODO
+
local meta = getSoundMetaTags(source)
 +
outputChatBox("The sound: "..(meta.title).." has finished in :"..length.."ms.")
 +
end)
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 24: Line 26:
 
===Client event functions===
 
===Client event functions===
 
{{Client_event_functions}}
 
{{Client_event_functions}}
 
[[Category:Needs_Example]]
 

Latest revision as of 06:56, 28 June 2012

This event is triggered when a sound has just finished downloading. This means the complete sound file is now loaded in the player's RAM, and can be played completely from start to end. Unlike onClientSoundStream, this event only triggers for file streams, not for live ones since live streams never actually end.

Parameters

int length
  • length: The length of the stream in milliseconds

Source

The source of this event is the sound which just finished downloading.

Example

This example would output to the chatbox after the sound is finish that the sound has finished downloading in ... milliseconds.

addEventHandler("onClientSoundFinishedDownload",root,function(length)
	local meta = getSoundMetaTags(source)
	outputChatBox("The sound: "..(meta.title).." has finished in :"..length.."ms.")
end)

See Also

Client player events


Client event functions