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 |
|---|---|---|---|---|
|
The video file that is played. |
|
Value of type ‘File’ |
No |
|
The date and time that the video should end in the format ‘YYYY MM DD hh:mm:ss’. |
|
Value of type ‘Date and time’ |
Yes |
|
If checked, the video is continues playing from the start when it reaches the end of the video. |
|
Value of type ‘Boolean’ |
Yes |
|
Decides whether to play audio when playing back the video. |
|
Value of type ‘Boolean’ |
Yes |
|
The mode of how the video is played back. The Default is |
|
In list { MapToSimulationTime, RealTimeLoop } |
Yes |
|
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. |
|
Value of type ‘Integer’ |
Yes |
|
The date and time that the video should start in the format ‘YYYY MM DD hh:mm:ss’. |
|
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)