Definition
StopVideo(string videoName)
Description
This function stops video videoName.
Parameters
videoName
Specifies the name of the video object. You can also use the name “this” for this parameter. In this case, “this” refers to the video object that this script is attached to.
Example 1
--Name of script is StopVideo1.lua --You can attach this script to a video object timer = 0.0 stop = false function Init() PlayVideo("this") end function Update() timer = timer + GetElapsedTime() if timer >= (GetVideoDuration("this") / 5.0) and not stop then StopVideo("this") stop = true end end
In this case, “this” string in the StopVideo points to the video that StopVideo1.lua script is attached to. For example, if StopVideo1.lua script is attached to a video object named “video1”, “this” will be equivalent to the name “video1”.
First we play the current video object. Then in the Update() event, we stop the current video after 20% of the current video’s total duration.
Example 2
--You can attach this script to a video object named "video1" timer = 0.0 stop = false function Init() PlayVideo("video1") end function Update() timer = timer + GetElapsedTime() if timer >= (GetVideoDuration("video1") / 5.0) and not stop then StopVideo("video1") stop = true end end
Assume that the above script is attached to a video object named “video1”. First we play the video “video1”. Then in the Update() event, we stop the video “video1” after 20% of the total duration of the video “video1”.
StopVideo