ProTV by ArchiTechVR | Usage Guides and Walkthroughs

Core Architecture

The architecture of ProTV has two main concepts.

  1. Centralized management of multiple video player components.
  2. Event Listener Registry for propagating information to other udon behaviors.

Centralized Management

In order to give developers freedom over what player configuration they wish to use, ProTV implements a proxy-ish script that sits on the same game object as the desired video player component (being either Unity player or AVPro player). This script is called VPManager.

Each video manager has a handful of configuration options available to it. It also has two lists that should be populated as needed: Speakers and Screens.
These lists associate any Audio Source and Mesh Renderer game objects to the script for automatic management.

These proxies are then also associated with the main script called TVManager. The tv manager has a handful of config options as well for the overall operation of its particular instance of ProTV.

TV Options

Visit the documentation page for the latest options available:
https://protv.dev/guides/tvmanager

Event Listener Registry (aka Subscribers)

In order to better facilitate extensibility for this asset, ProTV implements a event listener structure where any Udon script can register itself to the TV and will receive specific events and data based on the TV’s activity.

These events are a bit more granular than the standard udon events for video players (though ProTV does emulate those). It is recommended to be judicious when deciding what event to listen with.

Registering

To connect your udon behavior to the TV, the minimum required is a reference to the desired TVManager script, the Start event and a reference to the current script (aka self or this). Here’s what the minimum setup looks like:

USharp:

public class MyCustomScript : UdonSharpBehaviour {
    public TVManager tv; // the public TV reference
    
    void Start() { // the Start event
        tv._RegisterListener(this);
        // 'this' refers to the current script
    } 
}

UGraph:


The variable and event names are a bit long for the input field in the node, so the full string is commented below the nodes.

Once this is done, your script will begin to receive events from the TV. You can also run this logic at any point in the runtime (not just in the Start event, though that is the most common use case) and it will register to the TV correctly.

You can view all the events of the TV on the TVPlugin Scripting API page

3 Likes