0

Script Examples - incl Simple Showcontrol Script



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 4/01/15 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.

 

  • 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. It also clears network settings and any touchscreen calibration information in the registry. 

 

  • 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 video Script Loops any number of videos on the card indefinitely. The videomode setting is at the top.

 

 

 

  • 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 Use to set date and time manually on any player with a real time clock. 

 

  • Factory Reset & Copy This script resets the unit to factory defaults, deletes itself, then renames a file "autorun-next" to "autorun.brs", and then reboots.

 

  • Format SD & Copy  This script formats the sd card, then copies contents of the setup folder to the sd card. You can run it from a usb stick. You can change the formatdrive command from SD to "sd2" (internal microsd) or "ssd" or ssd drive in 4k units.

 

60 comments

  • 0
    Avatar
    Peter

    This autorun only seems to run with mpg (Mpeg2) files. It doesn't play a MP4 file (compressed as H264), changing the extension to .mov doesn't help... Any ideas? 

  • 0
    Avatar
    Alex

    That could be because your mp4 video is out of supported specs.

  • 0
    Avatar
    tingo

    Hi there,

    We have a project with 8x HD1010. Always two players form a group that should synchronize in it.
    Every group has four movies that sould be started over network (mediacontroller) with the showcontrol script over UDP.
    With an BrightAuthor Project it works, but we like to have a simple script like the simple master/slave Script  we found on the Roku forum (a simple Script, because we have to replace the movies often and that should be made easy). The Issue we have, is that we have more than one track to play in a group. All 8 players are connected to the same network, fixed IP adresses, no DHCP.

    Is there any script we didn't found yet that's able to work as a "control script slave" ?

    thanks for your answer!

  • 0
    Avatar
    Alex

    The easy way to replace the content in brightauthor presentation: open an existing presentation, go to File - Replace Media Files, browse to a folder with new content, replace files, click OK, and publish a presentation.

  • 0
    Avatar
    tingo

    Thanks for your answer. We don't like to use BA.
    In this 2 years old installation we have still more single players, totally 16 pcs of HD-810. All are equipped with the showcontrol script and controlled over RS-232 and a Moxa Serial Server on the same network. So we like to add the new 8 players with the same logic (naturally without the Moxa) and the same way to manage the content and control the players. It's used in an museum, not in a signage application. So we use the network only to control the units. Thats the reason why we look for a simple script in slave modus.

  • 0
    Avatar
    Jeff Marshall

    I had attempted to combine two of the examples above  Video Control Script: UDP & Serial and 3 Zones to 1 and back  in order to switch zones using UDP datagrams. I would also like to take advantage of the other functionality in the video control script since there are lots of handy things in there. 

    The layout I have attempted has the video object and an html element. Switching is working fine, except when a signal is sent in to play a new video, the video plays fine however the html objects disappear and don't come back until the zone is switched again.

    Here is a sample of the code where the layout is switched. It is from the block of else if conditions that evaluate the udp datagram after it has come in:

    else if command = "LAYOUT0" then
    fullscreen=false
    m.SendResponse("LO0")
    r = CreateObject("roRectangle",0,0,550,1080)
    m.h0 = CreateObject("roHtmlWidget",r)
    m.h0.EnableSecurity(true)
    m.h0.EnableMouseEvents(false)
    m.h0.SetURL("http://192.168.20.2/application/client/Events.php")
    m.h0.show()
    r = CreateObject("roRectangle",550,0,1370,770)
    r = CreateObject("roRectangle",1464,770,456,240)
    m.h1 = CreateObject("roHtmlWidget",r)
    m.h1.EnableSecurity(true)
    m.h1.EnableMouseEvents(false)
    m.h1.SetURL("http://192.168.20.2/application/client/weather.php?city=Chicago%20city&forecast=2")
    m.h1.show()

    If you can shed any light onto this problem it would be appreciated.

     

    Thanks,

    Jeff

  • 0
    Avatar
    Alex

    Jeff,

    Why did you decide to write a script instead of creating such a project in BrightAuthor?

    These 2 videos show how to send udp commands to and from the brightsign unit:

    https://www.brightsignnetwork.com/download/Videos/Amx-Crestron-Control-1.m4v

    https://www.brightsignnetwork.com/download/Videos/ba2.2_advanced_serial-1.mp4

    This faq explains how to switch between the different projects using interactive event:

    http://support.brightsign.biz/entries/21121606-How-do-I-switch-presentations-or-change-layouts-in-BrightAuthor-

  • 0
    Avatar
    Jeff Marshall

    When we spoke to the sales person we were told that we could display content dynamically from an external file system. That is, can someone place files on a local server and have bright sign play the image or video by using a udp datagram sent from an app also on the network? Can this be done from Bright Author? 

    From my investigations it can not be done within Bright author. I would be glad to be corrected by you on this. I can appreciate that you want people to use the tool you have created. But so far the tool does not do what we want.

    If this cannot be solved in bright author then I am forced to solve it with script. Which brings me to my original question.

    Why is it that any interaction with the video in script hides the html elements? Does creating a video place it over top the html elements? if so how is layering handled?

  • 0
    Avatar
    Lyndon

    When you say external file system, do you mean on a file/web server on the local network?  It's not clear to me what you're trying to do. No, a video zone isn't automatically over an html zone. I know this because we did a project at infocomm with an airport way find done all in html except for the video that played in the background was in a standard video zone. 

  • 0
    Avatar
    Lyndon

    In the script you are using is zones supported enabled. There should be a command like: EnableZoneSupport(true). 

     

  • 0
    Avatar
    Jeff Marshall

    Ok... Let me put it to you this way. A person has an iPad. The person can select from predefined layouts to be displayed on the Bright Sign. The person can then use the app to play what they would like to see in any of those zones. in each zone there may be hundreds of videos and hundreds of images to choose from, plus a weatherbug, events from the web, calendar etc. All of this content is too much for a project in bright author. besides it would be arduous putting conditions on all of those files individually. So we have a server located on the local network serving media.

    I have EnableZoneSupport(true) placed in the beginning. I don't believe you have to call it more than one am I right?

    As of this moment I am using your the ideas in the  zone switchiing script put into the UDP video control script. Where the command is being evaluated I am also evaluating the datagram to check which layout should be presented. Then using the video control scripts to play the selected video from a file. The filename and location to be passed in through a datagram using the play <filename> function. 

    Do you have a way to handle this in Bright Author? If not how would you suggest we proceed.

     

  • 0
    Avatar
    Jeff Marshall

    I found it. In the play function it was m.image.StopDisplay() that cleared out the html elements.

  • 0
    Avatar
    Alex Muñoz Basols

    Hello we want to rotate a full presentation is it possible using .brs files?

    Can we rotate an interactive mrss feed?

    Best Regards

  • 0
    Avatar
    Alex

    If you use XD player, you can build a project in html. BrightAuthor 3.8 will rotate html sites automatically in a portrait mode project.

  • 0
    Avatar
    Jon

    The video control script needs updating for the HD1020 unit as follows:

     

    Line 500:

    if control.modelObject.GetModel() = "HD410" or control.modelObject.GetModel() = "HD810" or control.modelObject.GetModel() = "HD1010" or ucase(control.modelObject.GetModel()) = "HD1010W" or ucase(control.modelObject.GetModel()) = "HD1020" then

     

    Line 507:

    if ucase(control.modelObject.GetModel()) = "HD1010W" or ucase(control.modelObject.GetModel()) = "HD210W" or control.modelObject.GetModel() = "HD210" or control.modelObject.GetModel() = "HD1010" or control.modelObject.GetModel() = "HD1020" then

     

    After making those changes then the unit is assigned an IP address correctly and it works.

     

  • 0
    Avatar
    Alfonso Descalzo

    Does it work with the last Firmware versions?

    i´m having some problems making it work.

     

  • 0
    Avatar
    TBsstr

    Hi. I tried to download the scripts on this page but with each I got an 404 error; the page could not be found on dropbox. Are they on an other download-location? Thanks!

  • 0
    Avatar
    Lyndon

    I've updated the urls for the different scripts. Some of the items here are old, and much of the functionality you use to have to do with scripting is now handled in brightauthor. 

  • 0
    Avatar
    TBsstr

    Thanks; however.. I was particularly interested in the last script which still points to an invalid link:

    http://dl.dropbox.com/u/3480052/Scripts/run-delete-copy-reboot.brs

    Could you fix that link as well? Thanks in advance!

  • 0
    Avatar
    TBsstr

    Is there any update for the 'run-delete-copy-reboot.brs' ?

  • 0
    Avatar
    Lyndon

    I'm adding two scripts since I can't find this rundelete copy one. Both run something, delete themselves, and copy something. One copies and renames an autorun file, one copies an entire folder and all subdirectories. 

     

  • 0
    Avatar
    Roland TL

    I tried to add GPIO support to the Video Control Script: UDP & Serial. 

    Line540:

    control.gpio=CreateObject("roGpioControlPort")
    control.gpio.SetPort(control.msgport)
    control.gpio.EnableInput(0)

    Line 142:

    else if type(msg) = "roGpioButton" and msg.GetInt() = 0 then
    m.SendResponse("PLAY")
    m.loop_video=false
    m.loop_audio=false
    m.loop_seamless=false
    m.lframe = true
    m.file_name="Video.mp4"
    m.PlayFile(m.file_name)
    m.status ="Playing: "+m.file_name

    Unfortunately it doesn't work. What did I do wrong? I would like to start a specific video if one of the GPIO inputs is triggered. The UDP features should stay the same.

  • 0
    Avatar
    Lyndon

    I sent you a modified autorun where it prints the event type received. It appears some event is being received.

  • 0
    Avatar
    euhn lee

    Hi, I'm using the UDP script with great success, thank you very much for providing it.  Two issues:

    1.  I know it's not documented in the README, but is there a way to make the PlayURL() function work in order to stream video?

    2.  Using either the "Download" or "Download path" command successfully downloads the file, but after completion the file is not renamed, it retains the name "mydownloadtxt".  Also (I wonder if this is related) uploading files through the local webserver does not work, it gives the following error: "Failed to rename received file."

    Can you give any help with these issues?

    Thanks

  • 0
    Avatar
    Alfonso Descalzo

    I used control script several times with success, but now I´m having problems with some HD1022 v6.0.25

    I can´t make it work. Is any update for the HD2 models?

     

    Thank you

  • 0
    Avatar
    Lyndon

    You must have an older version of the script if it doesn't work with the HD1022. 

    https://www.brightsignnetwork.com/download/Scripts/Control_script_latest.zip

     

  • 0
    Avatar
    Alfonso Descalzo

    With that firmware the behaviour of the unit is the same. I updated the unit to the last firmware and now it seems to respond to the commands, except for the LIST one wich make the unit to blink red led 10 times and reboot.

    I deleted this line of code and now is working fine:

    tmplist = sortlist(tmplist)

     

    Regards

  • 0
    Avatar
    Mark Thur

    Hi, I sure hope RokuLyndon is still on the other side of this thread ;-)

    i have a bunch of HD600 and I love them for their multiple audio outputs. Basic 48khz mp3's and wav's play really wel and extremely reliable and the .bsp and autoplay functionality work great. But I can't get any custom script .bas running, or not even a simple .csv format. Even simple interactive buttons from the GPIO only work in the demo scripts. All the demo's work properly, i've tried replacing one .mpg file in the demo by one of my own files and the best i've got was a short still of the first shot in the movie file and then the hd600 crashes and reboots. My mpeg's are MPEG PS bitrate 800 with 48khz audio. My wav's and mp3's are 48khz. 

    I would be fine if i just got some basic audio interactivity with buttons. I'm only trying mpg's in order to get some audio going.

    I would love to see the "Random MP3's" script from above to be functioning. I'm running firmware version 1.1.28 and with autoplay I use autorun.bas 1.1.7b. My .csv's are comma separated. I've tried resseting with above script. (did not work)  I've tried about 5 different hd600's.

    How should I adjust the autorun.bas script from the"Randomly play any mp3 on the flash card when a button 0 is pressed" in order for it to work?

    Thanks,

    Mark

  • 0
    Avatar
    Yanik Crépeau

    The "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." example returns a 404 error (file not found).

    I want to use scripts to control GPIO.Where can I find an example?

  • 0
    Avatar
    Yatin Baluja

    Our idea is to just do a simple looped playlist but also cache one separate piece media and trigger that file to play from our server (not on the LAN).  I can see how this might be accomplished by using the Media Properties > Advanced > Other commands > Show/Hide zone, but is there a tried and true way of doing this? also what is the method to send these commands?... custom plugin? UDP?  We are just getting familiar with brightauthor but I would have to believe that the engineers at BS would have built a method for this already.

Please sign in to leave a comment.