GetVideoPlay

Definition

bool GetVideoPlay(string videoName)

Description

This function returns the video playback status as a Boolean value of true or false.

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

If the video is playing, it returns true, otherwise it returns false.

Example 1

video_play = false
message = ""

function Init()
    video_play = GetVideoPlay("video1")

    if video_play then
          message = string.format("\nVideo is playing")
    else
          message = string.format("\nVideo isn't playing")
    end

    PrintConsole(message)
end

function Update()

end
First, we specify the playback state of “video1”. Then we display its status in the console using the PrintConsole function.

Example 2

--Name of script is GetVideoPlay2.lua

video_play = false
message = ""

function Init()
    video_play = GetVideoPlay("this")

    if video_play then
          message = string.format("\nVideo is playing")
    else
          message = string.format("\nVideo isn't playing")
    end

    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetVideoPlay2.lua is attached to a video object named “video1”. In this case, string “this”  in the GetVideoPlay function will be equal to “video1”. In our example, the function GetVideoPlay returns the playback state of the video “video1”.
adminGetVideoPlay