Definition
double GetVideoVolume(string videoName)
Description
This function returns the audio volume of video videoName.
Parameters
videoName
Specifies the video name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the video to which this script is attached.
Return Value
Audio volume of video videoName .
Example 1
volume = 0.0 function Init() volume = GetVideoVolume("video1") message = string.format("\nVideo volume is > %.2f", volume) PrintConsole(message) end function Update() end
First, we get the volume of video “video1”. Then we display it in the console using the PrintConsole function.
Example 2
--Name of script is GetVideoVolume2.lua volume = 0.0 function Init() volume = GetVideoVolume("this") message = string.format("\nVideo volume is > %.2f", volume) PrintConsole(message) end function Update() end
Assume that the above script named GetVideoVolume2.lua is attached to a video object named “video1”. In this case, string “this” in the GetVideoVolume function will be equal to “video1”. In our example, the function GetVideoVolume returns the volume of current video, which is “video1”.
GetVideoVolume