Video players

VideoPlayer is the video player of the player's game: it opens an address (a video file, a stream, or the page of a video site, which the game turns into its video), draws the picture into a material of your world and plays the sound through your Audio Sources. Each player's game plays the video for itself; your script keeps them together. The server has no video player: mark these scripts [ClientOnly].

csharp
using NodeWorld.Flux;

namespace MyWorld
{
    [ClientOnly]
    public class Screen : FluxScript
    {
        public Material screen;          // the material of the screen
        public AudioSource speaker;
        public string address = "https://example.com/film.mp4";
        private VideoPlayer _player;

        protected override void Start()
        {
            _player = VideoPlayer.Create();
            _player.SetMaterialTarget(screen, "_BaseMap");
            _player.SetAudioOutputs(new[] { speaker });
            _player.Load(address);
        }

        protected override void OnDestroy() => _player.Release();
    }
}

The player

VideoPlayer.Create()A new player. On a game without video (the video player ships for Windows x64, Linux x64 and Android), its error is Unavailable and the log says so.
Load(url, startTime, play)Opens the address from startTime seconds; plays it as soon as it is loaded if play (the default).
Play(), Pause(), Stop()Stop unloads the video.
stateVideoState.Idle, Loading, Ready, Playing, Paused, Ended, Error; isPlaying.
errorWhy it failed: VideoError.InvalidUrl (not a video), PlayerError (network, format), AccessDenied (private, region, login), RateLimited (the site refuses for now), Unavailable (no video player), Refused (the player denied the site, or the address is on their local network).
time, duration, ratePosition in seconds (setting it seeks), length (0 while unknown and for a live stream), speed (1 normal).
isLive, width, heightA live stream (no length, no seeking), and the picture's size.
SetMaterialTarget(material, textureProperty, show)The material shows the picture in that texture property (_BaseMap for URP's Lit); several materials may. show false takes it off.
SetAudioOutputs(sources, gainsDb)These Audio Sources play the sound, each with a gain in dB (−60 to 24) before its own volume; their volume, mute and 3D settings apply. None: silent.
Release()Frees the player. It is freed with the world too.

Addresses

Every network address of the video player works (http, https, rtmp, rtsp, udp, srt…); a file, a screen or a capture device does not. On each player's game, the address goes through the network gate first: the first video of a site asks the player, except on the big video sites (sites a world contacts). Meanwhile the state is Loading; a denied site gives VideoError.Refused.

Everyone at the same moment

Each game plays its own copy of the video. Share what plays with the synced state: the address, playing or paused, and where the video stood at a moment of the server's clock. Each game computes where it stands now, loads it there, and seeks back when it drifts. The Television script of the example world does it for a screen everyone controls, players who arrive later included: start from it.

A Video Player component of Unity in your scene plays only a clip included in the world (what a world may hold).