Class VideoAsset
java.lang.Object
net.risingworld.api.assets.Asset
net.risingworld.api.assets.VideoAsset
Represents a video which can be played on a
Supported formats depend on the client platform (the game relies on the video decoders of the operating system):
Streaming notes: Videos are never loaded completely into memory, the client streams and decodes them on the fly, so the file length does not matter (only the resolution affects memory usage). Keep in mind:
UIVideo element. Videos are always
streamed by the client directly from an URL (progressive download over http/https), they are never transferred
through the server. This means the URL must be reachable by every client.Supported formats depend on the client platform (the game relies on the video decoders of the operating system):
- Windows: H.264 (MP4/MOV), VP8/VP9 (WebM). HEVC requires the HEVC extension from the Microsoft Store.
- macOS: H.264/HEVC (MP4/MOV). WebM is not supported.
- Linux: VP8/VP9 (WebM) only. H.264 is not supported.
Streaming notes: Videos are never loaded completely into memory, the client streams and decodes them on the fly, so the file length does not matter (only the resolution affects memory usage). Keep in mind:
- The web server should support HTTP range requests, otherwise seeking (
UIVideo.seek(float)) forces the client to reload the file from the beginning! - MP4 files should have their metadata at the beginning of the file, otherwise the client has to read the end of the file before the first frame is shown.
- The client does not cache videos on disk: Every time playback starts after a stop (or the element is created again), the video is streamed again from the URL.
- The URL must be accessible without a browser: Hosts with bot protection, login walls or redirects to HTML pages reject the video decoder, resulting in an access denied error on all clients.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Asset
Asset.Source, Asset.Type -
Field Summary
Fields inherited from class Asset
DEFAULT_EXTENSION -
Method Summary
Modifier and TypeMethodDescriptionstatic VideoAssetloadFromURL(String url) Creates a video asset which references a video file located at an URL.Methods inherited from class Asset
dispose, equals, getChecksum, getDependency, getExtension, getHandle, getPath, getSource, getType, hashCode, isDisposed
-
Method Details
-
loadFromURL
Creates a video asset which references a video file located at an URL. The client streams the video directly from this URL, so it must be reachable by all clients.- Parameters:
url- the URL of the video file (http or https), or a route on the webserver of the game server (starting with "/").- Returns:
- a new VideoAsset, or an existing one if this URL was already loaded before.
-