HTML Development
Debugging HTML/Node Apps
12 min
chromium or node inspectors can be used to debug html and node applications that run on brightsign players see the sections below for more information about how to use each of these tools chromium inspector this example uses visual studio code you can store your application on the live server module if you use vs code, or on a local server this only should be used during development, and is not recommended for applications deployed to a player in the field unless you can restart the player or control the runtime prerequisites connect to your player through a serial connection (see brightsign shell docid\ fxxyu9jmocutc6xe2p7l2 or serial port configuration docid\ zen3qywtjohoeotkbrx2a for more information) use the bsc ( brightsign cli ) to push files using over the local or remote dws, or the dws ui if you have a local http server on your computer, put your application on the server and point the brightsign player to it otherwise, you'll have to copy the application code onto the player download or install this rest client for vs code, which lets you use keyboard shortcuts to quickly upload files to the player open your chrome browser and go to this url chrome //inspect/#devices enabling the debugger open your autorun in a code editor enable debug in the registry by adding the following lines to your autorun debugrs = createobject("roregistrysection", "brightscript") debug = debugrs read("debug") if debug <> "1" then 	debugrs write("debug","1") 	debugrs flush() 	'stop 	rebootsystem() 'reboots player first time it's changed end if 3\ to test the debugger, type ctrl c at the brightscript> prompt in the serial control window the prompt will change to brightscript debugger> type exit to leave the debugger 4\ enter the code below in your autorun the inspect brk flag will let you quickly see what variables are in scope, their values, and the call stack at specific places in the script m node js = createobject("ronodejs", "sd /main js", {message port m msgport, node arguments \[" inspect brk=0 0 0 0 2999"]}) running the debugger type script autorun brs at the prompt to restart the autorun (you don't need to reboot the player when you make changes if you use this method) once the autorun has restarted, go to the chromium inspector select configure to access the node and html instances of the player you will need the ip address of the player to inspect the node process because we added the ronodejs inspect brk parameter in the autorun, the execution of the script is paused at the first line select inspect to launch the debugger (see image 1) press the resume script button in the debugger to run your javascript code and play the video on your screen enter the debugger keyword on a separate line in your javascript code to set a breakpoint you will need to close the app and restart it before the breakpoint will be activated brightsign debugger (node inspector) the brightsign debugger is useful if you want to upload the application to the player for debugging rather than an http web server once it has been uploaded to the player, the application can be restarted (if you do this, there is no need to restart the player) to do this select ctrl c to drop to the brightscript debugger prompt type exit to get to the brightsign prompt type script autorun brs to restart the app features in recent os versions type node with no parameters to get an interactive node shell, and then enter javascript, which is evaluated immediately brightsign> node \> process release { name 'node', lts 'dubnium', sourceurl 'https //nodejs org/download/release/v10 15 3/node v10 15 3 tar gz', headersurl 'https //nodejs org/download/release/v10 15 3/node v10 15 3 headers tar gz' } \>type ctrl d to exit node and return to the brightsign prompt, or you can give it the name of a script to run brightsign> node sd /hello js hello world brightsign> if you want to attach a remote debugger to your node process, you can pass inspect as normal it will show you the url for the debugger brightsign> node inspect=0 0 0 0 1234 sd /hello js debugger listening on ws\ //0 0 0 0 1234/c67ca30e 388b 49b2 baf4 9924d94f0ac6 for help, see https //nodejs org/en/docs/inspector hello world features requiring os 8 3 1 or later if you want to debug interactively at the console, use node inspect (without dashes) it will start the inspector and then connect to it locally brightsign> node inspect sd /hello js < debugger listening on ws\ //127 0 0 1 9229/2c63116d d1d4 4248 81b4 718217bef35e < for help, see https //nodejs org/en/docs/inspector < debugger attached break on start in file ///storage/sd/hello js 1 \> 1 (function (exports, require, module, filename, dirname) { console log("hello world"); 2 3 debug> if you have a single file or webpacked program that's located on a remote host, you can pass an http or https url to node brightsign will fetch the file and run it (this doesn't work if the program needs other resources that it expects to find in the cwd) brightsign> node http //192 168 82 66/test js hello brightsign> if you want to run your program inside chronode (the node js that is embedded in chromium) rather than in the standalone node, use htmlplay chronode this is similar to htmlplay , except that it expects to be given the url to a js file rather than an html site note that in this case, the output goes to the system log and not to the shell console brightsign> htmlplay chronode http //192 168 82 66/test js if you want to attach the debugger to a program or a website that you've launched with htmlplay , set this option before loading the page brightsign> htmlplay params inspector port 1234 brightsign> htmlplay http //www brightsign biz/