BrightScript vs. JavaScript
When developing for BrightSign players, you must write in BrightScript at some point (unless you are using BrightAuthor:connected) though most users are not familiar with this language. Traditionally, every application, presentation, video, etc. that ran on a player was driven by BrightScript. Since most users today want to use JavaScript to develop applications and control the player, BrightSign has been working to accommodate that. Nevertheless, BrightScript remains integral because without an autorun.brs
file, written in BrightScript, your player will not behave as intended.
Why BrightScript is Required
autorun.brs
is the generic name for a file the BrightSign Operating System (BOS) searches for on the player’s configured storage device (see Image 1, below). If an autorun.brs
is found, the player will execute it. It is the entry point for any application developed on a BrightSign player, and it can handle the entirety of an application (BrightAuthor:connected), be a simple pointer to more complex programs (JavaScript applications), or any mix of the two.
The BrightSign autorun.brs
also configures the player. Many player setup/configuration options must be set up immediately (such as SSH, logging level, some network interfaces, registry settings, video decoder routing, etc.). These settings are unique to media players, and because the autorun.brs
is the first thing the player executes, it is the best (and sometimes only) place to set them.
When creating a JavaScript application or presentation, the autorun.brs
will typically configure the player, instantiate an HTML widget, and give the HTML widget the correct HTML file or URL. The HTML widget will then take over and run your JavaScript files.
When to Use BrightScript
BrightScript Required
BrightScript is required for these scenarios:
Player setup/configuration that must be done before a JavaScript application or presentation is loaded
Setting up logging level
Instantiating the HTML widget
Setting up network interfaces (on certain ports)
Certain file system operations
BrightAuthor:connected plugins
Autorun logging level and BOS logging (serial)
Any BrightScript object that doesn’t have a JavaScript alternative. A list of BrightScript objects and their JavaScript alternatives is here.
BrightScript Recommended
Though JavaScript can be used, BrightScript is recommended in these scenarios:
Player setup/configuration that is not time dependent, such as setting up SSH/Telnet or setting up network interfaces on main ports
Player sync