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
    darksigns


    Hi Lyndon,

    Your Help was great at the scripting with leds thank you. Now I learned some from scripting <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->
    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
  • 0
    Avatar
    RokuLyndon


    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.
  • 0
    Avatar
    pshea


    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.
  • 0
    Avatar
    base2


    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
  • 0
    Avatar
    BCoudron


    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
  • 0
    Avatar
    RokuLyndon


    Let me do some testing. What firmware is on your hd210?
  • 0
    Avatar
    BCoudron


    It 's the Version 3.3.78
    Official Release
  • 0
    Avatar
    tonytee


    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 <!-- s;) --><img src="{SMILIES_PATH}/icon_wink.gif" alt=";)" title="Wink" /><!-- s;) -->

    Thanks alot, and greetings from the Netherlands...

    Keep up the good work...
    Tony
  • 0
    Avatar
    RokuLyndon


    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..
  • 0
    Avatar
    RokuLyndon


    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.
  • 0
    Avatar
    tonytee


    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
  • 0
    Avatar
    BCoudron


    Works perfect!

    Thanks,

    Bart
  • 0
    Avatar
    BCoudron


    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
  • 0
    Avatar
    RokuLyndon


    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.
  • 0
    Avatar
    jawbone78


    Lyndon and all Roku Community Techies,

    Thank you for posting these scripts. I am a first time Roku user learning through my reseller. While I have accomplished most of what I need, there are some key points with which you could be of great help.

    I have an HD1010w along with BA software all updated to the latest versions. I am creating a roughly 20 minute presentation and have some questions. My work is all done and the system is online, but it could be better. (A simple sketch of how I imagine the final product/presentation is included at the end of this post if you want to see how I picture it working.) This will be a long post, but you will be rewarded if you make it to the end.

    The 3 Zones To One script may be an answer to my objective. I have a non-interactive presentation in a multizone format and all is going beautifully. However, some of my video content would be much better presented in full screen.

    Question #1: Can the script be altered to play some of my video content in full screen before switching back to a multizone presentation, then switch back to play a different set of fullscreen videos, then back to the multizone presentation, etc.? I don't want to play all of the videos at once (there are 15 or more videos ranging from 10 seconds to 45 seconds each), so I am looking for ways to space (batch) them out into small groups... AND keep them full screen... AND still take advantage of the multizone format in between.

    Question #2: Assuming I got this to work as I propose, would the resulting complex coding make updating my presentation difficult? Specifically, would I be faced with creating changes in Brightauthor, copying code to my custom script and then manually updating the autorun.brs on the SD card each time I need to publish changes in the playlist content? Or could I find a way to make the user-friendly PUBLISH button do the work for me?

    This concludes the first portion of my post, the following question may or may not involve custom scripting but the query does address an expansion to the same concept. Please advise if I need to move the following question to a separate post. If what I ask is possible, I think others would want to know.

    In addition, the multizone portion of my overall presentation contains a widget in the main video zone to feed Signchannel news/weather content. However, all of the Signchannel content plays as one long "lump" before allowing BrightSign to move on to the next item in the playlist. There is so much terrific Signchannel content that I cannot use regularly because it prevents the video/image/MRSS content in that zone's playlist from playing often enough. I want to use more Signchannel content without resorting to the limited scheduling options found in the Signchannel web interface.

    I would like to break up the Signchannel content into chunks so that only some of the content plays before I move on to the the next playlist item. Minutes later, I want to show different Signchannel content in the same zone. Yes, custom content can be inserted into the Signchannel feed. However, I want to insert custom content into my presentation without using the Signchannel webinterface. (Signchannel doesn't accept video and I want to keep content editing inside of BrightAuthor as much as possible.) Chunking different batches of Signchannel content into roughly 1 minute segments would give me the flexibility to use other content in that zone while allowing for a more cohesive, integrated and engaging mix of messages and content.

    Question #3: What would happen if I purchased another Signchannel content subscription and then inserted a second Signchannel widget into the same playlist as the first? Would the system be "intelligent" enough to allow me to assign a different feed to the second widget? Having 2 or more discrete Signchannel feeds in a zone would solve my issue. I would even consider purchasing yet another subscription to use the small-format-friendly stocks/weather feeds in a different smaller side panel zone if Brightauthor allowed Signchannel widgets to be inserted in more than one zone per presentation. Having the option to batch Signchannel content would send my project soaring. I would rather get your opinion on this before spending cash on the experiment, though.

    This ends the second portion of my post.  <!-- s:? --><img src="{SMILIES_PATH}/icon_confused.gif" alt=":?" title="Confused" /><!-- s:? -->

    As promised, here is a rough linear sketch of what I am trying to accomplish on our sign. Imagine you are watching a non-interactive multizone presentation with a main large video/image/Media RSS zone with a roughly 20 minute runtime. This is what I would like to see in that main zone:
    Video 01
    Video 02
    Signchannel Content Batch 01 with weather info
    Media RSS feed with my local tides/marine conditions (created in-house)
    Live Video Feed (overlooking our harbor)
    Video 03
    Video 04
    Signchannel Content Batch 02 with news/word of the day
    Image 01
    image 02
    Video 05
    Signchannel Content Batch 01 again
    ...and so forth until I have included all my content
    Repeat.

    This concludes my post. If you read this far, I am so very appreciative and will happily reward anyone who helps with answers to my questions. I will happily pay for a professional relationship to develop my dream, as well. Contact me at jawbone78atyahoo if you are interested. Apologies if soliciting is not kosher here. In the meantime, I will leave you with one of my favorite geeky jokes: Why did the robot cross the road? ...wait for it... Because it was carbon-bonded to the chicken!
  • 0
    Avatar
    RokuLyndon


    Question #1: Can the script be altered to play some of my video content in full screen before switching back to a multizone presentation, then switch back to play a different set of fullscreen videos, then back to the multizone presentation, etc.? I don't want to play all of the videos at once (there are 15 or more videos ranging from 10 seconds to 45 seconds each), so I am looking for ways to space (batch) them out into small groups... AND keep them full screen... AND still take advantage of the multizone format in between.

    Answer: Yes, you can modify it so some files play fullscreen.


    Question #2: Assuming I got this to work as I propose, would the resulting complex coding make updating my presentation difficult? Specifically, would I be faced with creating changes in Brightauthor, copying code to my custom script and then manually updating the autorun.brs on the SD card each time I need to publish changes in the playlist content? Or could I find a way to make the user-friendly PUBLISH button do the work for me?

    Answer: The 3 zone to 1 script I posted is fully customized, so it's not someothing you can just stick in into the brightauthor script. I'm thinking this would have to be a fully customized script, so no brightauthor use.



    Signchannel does actually accept video. You might have an old signchannel script on the brightsign if it doesn't for you. But, you should be able to upload video to your signchannel account. The signchannel script is a separate beast. I'm sure it's possible to break up their stream, but I can't say at the moment how it would work, or how much effort it would take. And, adding the signchannel code to a custom script would itself be a task.


    Question #3: What would happen if I purchased another Signchannel content subscription and then inserted a second Signchannel widget into the same playlist as the first? Would the system be "intelligent" enough to allow me to assign a different feed to the second widget? Having 2 or more discrete Signchannel feeds in a zone would solve my issue. I would even consider purchasing yet another subscription to use the small-format-friendly stocks/weather feeds in a different smaller side panel zone if Brightauthor allowed Signchannel widgets to be inserted in more than one zone per presentation. Having the option to batch Signchannel content would send my project soaring. I would rather get your opinion on this before spending cash on the experiment, though.


    Answer: Signchannel doesn't allow you to add two subs to the same unit, as far as I know. If you were just using media rss feeds, you could add more than one feed to the same zone, with other content in between. BUt, that's in brightauthor. It could be done with a custom script as well.

    If you can write up as detailed a description of what you want to do, as well as how it would be updated, I can submit it internally for some feedback to see if it's something we can do, if maybe there's a better way to do it than I've considered, and how much it would cost to do. You can email us at <!-- e --><a href="mailto:support@brightsign.biz">support@brightsign.biz</a><!-- e -->.
  • 0
    Avatar
    Alfonso Descalzo


    I´m developing a Visual Studio aplication to use with the BrightSign

    I´m using the ShowControl script with an HD-1010 and the 3.8.24 firmware version.
    I´m doing it to use by UDP, although is possible to use it with RS232 too..

    It works fine for videos, audio and images. Even I can play audio and images at the same time, so it´s perfect...

    But when I use an USB memory, it works fine for videos, but gives me an error when i try it with audio files (didn´t try with images)

    Is there anyway to do it work for audio files too?

    txs
  • 0
    Avatar
    RokuLyndon


    It's possible the script isn't searching the usb stick for other file types. Send me the version of the script you're using, and I'll make the change to it. Send it to support @ brightsign. biz.
  • 0
    Avatar
    Alfonso Descalzo

    Do these scripts work on new units? (HD220, HD1020....)

  • 0
    Avatar
    Alex K.

    Which script are you referring to? Most of them need to be modified to work on the new HD units.

  • 0
    Avatar
    Alfonso Descalzo

    I need to use the Video Control Scrip : UDP& Serial for use it with Medialon.

    I don´t know if just changing the unit references ("if control.modelObject.GetModel() =") into the script, it will work..

    Txs

     

  • 0
    Avatar
    Alfonso Descalzo

    Finally i made it work as I told you, but i can´t find a way to set video mode to the new availables video modes. (i.e composite/PAL mode)..

  • 0
    Avatar
    Lyndon

    Here's an updated version of the script, that includes the newer players.

     

    There's a vvolume command for video volume. 

  • 0
    Avatar
    Jacco

    Do I understand correctly that the last posted script is working for the HD1020? And what about the new XD product line.

  • 0
    Avatar
    Jacco

    We got the showcontrol script working for the HD1010, Just wondering if it will also work on the HD220 and HD1020 since the HD1010 is not available anymore

  • 0
    Avatar
    Lyndon

    IT doesn't have the xd models in it yet, but it's a simple change to add that. There's a function that does a model check to see if the model has serial or ethernet. And, yes, it works with the 20 series. 

  • 0
    Avatar
    Roland TL

    Hello

    Is the "Loop any 1 .mpg video Script" no longer working with the new 20 series?

    The download link is 404

     

     

     

     

     

  • 0
    Avatar
    Lyndon

    Try the new link

  • 0
    Avatar
    Peter

    Is the videoloop script running files at 25 images/sec? Could you post the script for videolooping a HD file (fullHD) at 25 images/sec? (the older script from last year doesn't work with the new firmware...  Thanks!!

  • 0
    Avatar
    Alex K.

    Please send your old script that doesn't work.

Please sign in to leave a comment.