Your Digital Media Has Never Looked So Good

 
RokuLyndon

Script Examples - incl Simple Showcontrol Script

Mon Feb 22, 2010 10:49 am

This list isn't in any particular order, or are the scripts organized. I'm going to start adding simple script examples I've been asked about to this thread. There are several script examples in the object reference guide.

In some cases, what I post here will be just sample code, not a fully functional script.

To run any script posted, it needs to be named autorun.brs (for the compact models) or autorun.bas (for the HD600 and HD2000s) and should be in the root of the flash card.

Scripts

  • Video Control Script: UDP & Serial Readme 9/13/11

    This is a control script for playing back videos. It accepts commands over serial or UDP to play, stop, and loop a video. It also supports search and volume controls. The readme contains the list of commands. The unit automatically responds when a command is received, a different response for each command, and it also sends a response when a file has finished playing or each time it finishes playing a video if it's looping. If you're using an AMX, Crestron, or similar show controller and just want to be able to send a command and file name to the brightsign, this is one solution.

  • Play All Videos, NTSC output3/31/11

    This simple script will play all videos found on the flash card. It also sets the video mode to "ntsc-m". If you're using an HD810 or HD1010, you can connect the center component connect to an older display using composite cables.

  • Cleans out Recovery script - Deletes the Network Registry
    If you connect your Brightsign to Brightsign Network Manager, there's a recovery script stored in the registry. Once this recovery script is enabled, you can't startup a unit with a blank flash card or no flash card and see the firmware version on the screen. Also, with the recovery mode enabled, you can't use the autorun that's built into memory. This script deletes the networking registry and displays text onscreen when complete.

  • 3 Zones to 1 and back
    This is a simple demonstration script. It plays one video and two images together in a three zone layout. After 18 seconds, the image zones stop, and the video expands to full screen, and then back to three zones after another 6 seconds.

  • Loop any 1 .mpg video Script
    Loop any 1 .ts video Script

    Two scripts that loop one video indefinitely. One looks for any file on the flash card with a .mpg extension.
    The other looks for any file on the flash card with a .ts extension. All you need on the flash card is this script and your video. In each case, it loops the video indefinitely. The videomode setting is at the top.

  • Plays one out of 20 videos named video1.ts thru video20.ts
    This script accepts gpio input on button zero. If button zero is pressed, it picks a video randomly. When the video is finished, the script returns to a blank screen, and waits for the button press again.

  • Randomly play any mp3 on the flash card when a button 0 is pressed
    This script accepts gpio input on button zero. If button zero is pressed, it randomly chooses an mp3 to play. No input is accepted during playback. Once playback is finished, the unit waits for the next input.

  • Synchronize 1 Video over GPIO
    This script plays one video in a loop, and synchronizes playback with one or more units connected to the gpio 0 output of the master. It assumes the video is named "video.ts" and that the slave is also listening on input zero.

  • Select an Audio file, blink led during playback
    This script plays one of two mp3s when either button 0 or 1 is pressed. During playback, the script flashes an led connected to gpio 4 for audio 1 and for gpio 5 for audio 2. The led flashes on and off every 1/2 second.

  • Installs custom script into memory
    This script will place a script named boot.brs into memory, replacing the default autorun.brs. You can put your own script into memory to execute on startup, or put a modified version of the existing autorun back into memory, with any changes you've made to it.

  • Set Date & Time on HD810/HD1010
    This is actually a playlist using the older playlist format. Just edit the autoplay.bsp with any text editor and change the timezone and time to match the time you want to manually set. If your HD1010 is on the network, it will use the brightsign timeserver on the internet to set its date and time.


Code Examples

  • Script runs, deletes and replaces itself with a different autorun.brs from a temp folder
    This script accepts just prints output to the serial port. It's just a simple test. It will run and delete itself. It will copy an autorun.brs from the /temp folder to the root, and then restart. For example, you could publish a project to your flash card and copy that autorun to the temp folder. Then, you can add a custom script that would run once, and then copy the correct autorun back into the root.
 
darksigns
Posts: 20
Joined: Mon Mar 01, 2010 3:32 am

Re: Script Examples

Fri May 21, 2010 3:11 am

Hi Lyndon,

Your Help was great at the scripting with leds thank you. Now I learned some from scripting :)
I have a question:
is there a way to control player trough the serial I mean if I connect with terminal and start a script for example play a video can I stop the playing and get back roku shell?
Do I have to use roSerialPort object?
thx
 
RokuLyndon

Re: Script Examples

Fri May 21, 2010 10:50 am

IF you want to use the shell, then you have to stay in the shell. So, you could send to the shell something like:

videoplay video.mpg

And, it will play that video.


A script gives you more options. You can use the control script I posted to take serial or udp commands for file playback.
 
pshea
Posts: 1
Joined: Thu May 27, 2010 2:58 pm

Re: Script Examples

Thu May 27, 2010 3:07 pm

I'm brand new to BrightSign products (warning!)...I'm using a HD810 and am hoping to accomplish the following:

- User pushes a touchscreen button on the home state media item
- The 810 plays a video selected at random from a list of 10 options
- Each of these videos has touchscreen buttons that take the user to another media state or back to the home state

I have all of this flow currently laid out in BrightAuthor, but am stumped as to how to enable the randomization element upon the initial interaction. I see there are a couple of script samples that you have provided, but I'm unclear as to how or where to integrate them into the existing interactive playlist flow. Please advise!

Thanks.
 
base2
Posts: 1
Joined: Fri Nov 05, 2010 2:53 am

Re: Script Examples - incl Simple Showcontrol Script

Fri Nov 05, 2010 3:11 am

Hi, I'm using one of your products for the firs time. I've bought two hd810 and an expander. I'm trying to modify your "video control script" with:

- the option to output sound using the spdif in the expander
- preload the video to synchronize the players.

The first part is done, but I'm totally desperated with the second. I'm trying to implement this under the PLAYCL command with:

m.PreloadFile(m.file_name)
sleep(100)
m.Play()
'm.PlayFile(m.file_name)

what's wrong? I'm totally lost.

any help will be apreciated.

thank you
 
BCoudron
Posts: 4
Joined: Wed May 18, 2011 4:13 am

Re: Script Examples - incl Simple Showcontrol Script

Wed May 18, 2011 4:16 am

Dear all,

I'm using the script "Video Control Script: UDP & Serial Readme 10/26/10" to use it with a Crestron controller but even without changing any-thing, the error leds is blinking 10 times -> script error. I'm using the HD210 with firmware who is now available (not hte beta one)

Any idea?

-> When I comment out the initialize procedure, he's not giving the error (and rebooting)

Best Regards,

Bart
 
RokuLyndon

Re: Script Examples - incl Simple Showcontrol Script

Wed May 18, 2011 6:21 am

Let me do some testing. What firmware is on your hd210?
 
BCoudron
Posts: 4
Joined: Wed May 18, 2011 4:13 am

Re: Script Examples - incl Simple Showcontrol Script

Wed May 18, 2011 9:07 am

It 's the Version 3.3.78
Official Release
 
tonytee
Posts: 3
Joined: Mon May 23, 2011 12:10 pm

Re: Script Examples - incl Simple Showcontrol Script

Mon May 23, 2011 12:54 pm

Hi there,

Any light on the issue Bart described last week?
Your SC script really rocks, but half of our Brightsigns don't like it very much....

We have 36 HD1010's (3.5.68) in a current project doing great with your (slightly modified) showcontrol-script and 40 HD210's with the same firmware that instantly start blinking the red error led... Even when I go back to your unmodified v2.8v3g... I also tried it with FW 3.3.69, which was on the BS's when we got them.
Needless to say we would be very appreciative if you could point us in the right direction...

I have been putting in a reasonable amount of hours now but I can't find what's wrong with it... Being a beginner naturally ;)

Thanks alot, and greetings from the Netherlands...

Keep up the good work...
Tony
 
RokuLyndon

Re: Script Examples - incl Simple Showcontrol Script

Mon May 23, 2011 4:38 pm

I'll get this resolved shortly. There must be some a serial port related call that's used when on the 210 that's causing the crash..
 
RokuLyndon

Re: Script Examples - incl Simple Showcontrol Script

Mon May 23, 2011 5:16 pm

This has been fixed.

In the newcontrol function, before the checks are done for whether a unit has serial or has ethernet, I didn't initialize control.serialon, and control.networkon. I try to use the serialon variable even though it's not set and that's what caused the hd210 problems. I've updated the script.
 
tonytee
Posts: 3
Joined: Mon May 23, 2011 12:10 pm

Re: Script Examples - incl Simple Showcontrol Script

Tue May 24, 2011 1:15 am

Hi Lyndon,

Thanks VERY much for the overnight support.
You secured quite an important deadline for us...

All 210's are up and running

Cheers, Tony
 
BCoudron
Posts: 4
Joined: Wed May 18, 2011 4:13 am

Re: Script Examples - incl Simple Showcontrol Script

Tue May 24, 2011 3:54 am

Works perfect!

Thanks,

Bart
 
BCoudron
Posts: 4
Joined: Wed May 18, 2011 4:13 am

Re: Script Examples - incl Simple Showcontrol Script

Tue Jun 07, 2011 9:25 am

Must the dowload work from an external server? The script is responding but nothing happens only the player doesn't respond any more to commands....
What's the lay-out of the downloads.txt file? Filename + CR + LF?

Thanks a lot,

Bart
 
RokuLyndon

Re: Script Examples - incl Simple Showcontrol Script

Tue Jun 07, 2011 9:35 am

Yes, just filename plus CR.
It's been a couple months since I tested it, but I know of one customer who has also tested and used this feature. You can turn on debug mode, and capture the serial output from the unit to see what problems it's reporting.

Who is online

Users browsing this forum: No registered users and 2 guests