PlayVideo

Definition

PlayVideo(string videoName)

Description

This function plays video videoName. If the loop state of video is true, it will be played continuously, otherwise it will be played only once.

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 PlayVideo1.lua

function Init()
    PlayVideo("this")
end

function Update()

end
In this case, “this” string in the PlayVideo function points to the video that PlayVideo1.lua script is attached to. For example, if PlayVideo1.lua script is attached to a video object named “video1”, “this” will be equivalent to the name “video1”. In our example, PlayVideo function plays the current video object, which is “video1”.

Example 2

function OnTriggerEnter(otherActorName)
    PlayVideo("video1")
end

function OnTriggerStay(otherActorName)

end

function OnTriggerExit(otherActorName)

end
Assume that the above script is attached to a trigger named trigger1. Whenever the main character or a prefab instance that has dynamic physics enters “trigger1”, video “video1” will be played.
adminPlayVideo