VideoTileProvider

Inherits TileProvider

Renders a video on the globe.

The video can either be played back based on a given simulation time (PlaybackMode MapToSimulationTime) or through the user interface (for PlaybackMode RealTimeLoop). It is also possible to control whether the video should loop or just be played once.

Note that, unless playback is mapped to simulation time, the video must be started manually via the user interface.

Members

Name

Documentation

Type

Description

Optional

Video

The video file that is played.

File

Value of type ‘File’

No

EndTime

The date and time that the video should end in the format ‘YYYY MM DD hh:mm:ss’.

Date and time

Value of type ‘Date and time’

Yes

LoopVideo

If checked, the video is continues playing from the start when it reaches the end of the video.

Boolean

Value of type ‘Boolean’

Yes

PlayAudio

Decides whether to play audio when playing back the video.

Boolean

Value of type ‘Boolean’

Yes

PlaybackMode

The mode of how the video is played back. The Default is RealTimeLoop, which means that the video is played in realtime using the Play command in the user interface.

String

In list { MapToSimulationTime, RealTimeLoop }

Yes

PlayDelay

The delay, in milliseconds, that the system will wait before issuing the play command. A higher value will increase the time it takes for the video to start but may result in a more synchronized playback start.

Integer

Value of type ‘Integer’

Yes

StartTime

The date and time that the video should start in the format ‘YYYY MM DD hh:mm:ss’.

Date and time

Value of type ‘Date and time’

Yes

Asset Examples

Basic

Adds a video as a layer on a globe, in this case Earth.

 1local earthAsset = asset.require("scene/solarsystem/planets/earth/globe")
 2
 3-- The video file is here downloaded from a URL. This code returns the path to a folder
 4-- where the file is stored after download
 5local data = asset.resource({
 6  Name = "Example Video",
 7  Type = "UrlSynchronization",
 8  Identifier = "example_video",
 9  Url = "https://liu-se.cdn.openspaceproject.com/files/examples/video/chlorophyll_model_2048.mp4"
10})
11
12-- For a local file, use "asset.resource("path/to/local/video.mp4")" here instead
13local video = data .. "chlorophyll_model_2048.mp4"
14
15local Layer = {
16  Name = "VideoLayer Example",
17  Type = "VideoTileProvider",
18  Identifier = "VideoLayer_Example",
19  Enabled = true,
20  Video = video
21}
22
23
24asset.onInitialize(function()
25  openspace.globebrowsing.addLayer(earthAsset.Earth.Identifier, "ColorLayers", Layer)
26end)
27
28asset.onDeinitialize(function()
29  openspace.globebrowsing.deleteLayer(earthAsset.Earth.Identifier, "ColorLayers", Layer)
30end)
Mapped to Time

Adds a video as a layer on a globe (Earth) where the video playback is mapped to the simulation time. In this case, the video will play from 20:00 to 21:00 on January 29, 2023 in the simulation.

 1local earthAsset = asset.require("scene/solarsystem/planets/earth/globe")
 2
 3-- The video file is here downloaded from a URL. This code returns the path to a folder
 4-- where the file is stored after download
 5local data = asset.resource({
 6  Name = "Example Video",
 7  Type = "UrlSynchronization",
 8  Identifier = "example_video",
 9  Url = "https://liu-se.cdn.openspaceproject.com/files/examples/video/chlorophyll_model_2048.mp4"
10})
11
12-- For a local file, use "asset.resource("path/to/local/video.mp4")" here instead
13local video = data .. "chlorophyll_model_2048.mp4"
14
15local Layer = {
16  Name = "VideoLayer Example Mapped to Time",
17  Type = "VideoTileProvider",
18  Identifier = "VideoLayer_Example_MappedToTime",
19  Enabled = true,
20  Video = video,
21  StartTime = "2023 01 29 20:00:00",
22  EndTime = "2023 01 29 21:00:00",
23  PlaybackMode = "MapToSimulationTime",
24  Description = [[
25    Video mapped to the simulation time in OpenSpace. The video will play from 20:00 to
26    21:00 on January 29, 2023.
27  ]]
28}
29
30
31asset.onInitialize(function()
32  openspace.globebrowsing.addLayer(earthAsset.Earth.Identifier, "ColorLayers", Layer)
33end)
34
35asset.onDeinitialize(function()
36  openspace.globebrowsing.deleteLayer(earthAsset.Earth.Identifier, "ColorLayers", Layer)
37end)