Questions tagged [brightscript]

Brightscript is a BASIC-like language developed for the Roku and Brightsign hardware platforms.

Brightscript is a BASIC-like language developed for the Roku and Brightsign hardware platforms.

Brightscript is single threaded, procedural language with some object oriented features. It lacks support for Classes and Inheritance. Brightscript allows only one global variable, "m". However m can contain a complex global data structure. Arrays are one-dimensional; however, you can create arrays of arrays.

There are two primary types of array variables: roArray and roAssociativeArray.

Arrays can be defined with a CreateObject statement or using shorthand

varname=createobject(roArray,5,true) 

creates an expandable array containing 5 elements. Alternatively:

varname=[]

creates an empty, but expandable Array.

roAssociativeArrays can also be described as a data dictionary. They can be created as follows:

varname=createobject(roAssociativeArray)

or

varname={}

using curly brackets.

To assign values to an Array:

varname=[100,200,"ABCD","ZYXW"]

or

varname[0]=100
varname[1]=200
varname[2]="ABCD"
varname[3]="ZYXW"

to assign values to an AssociativeArray or "AA":

varname={name:"John Smith",address:"1023 West Alameda",telephone:"415-555-1212"}

or

varname={}
varname["name"]="John Smith"
varname["address"]="1023 West Alameda"
varname["telephone"]="415-555-1212"

a mode which allows almost any ASCII character to be used as a key, or, using dot notation:

varname={}
varname.name="John Smith"
varname.address="1023 West Alameda"
varname.telephone="415-637-1283"

Aside from the usual text and numeric manipulation functions, Brightscript also has specialized objects that can be created, such as "roAudioPlayer", "roVideoPlayer" and many different display screen types, the most commonly used are "roPosterScreen" and "roGridScreen". These objects are created and assigned a reference variable in the following manner:

screen=CreateObject("roPosterScreen")

It could then be populated:

item1={ShortDescriptionLine1:"item 1"}
item2={ShortDescriptionLine1:"item 2"}
item3={ShortDescriptionLine1:"item 3"}

content=[item1,item2,item3]   

screen.setcontentlist(content)

Note that item 1 2 and three are roAssociativeArrays and that content is an roArray containing three roAssociativeArrays.

To display the screen:

screen.show()

Instead of a REM statement, Brightscript uses the single quote:

'this is a comment

Program Execution statements include:

  • For / End For / Exit for
  • While / End While / Exit While
  • If / Then / Else / Else If / End If

Brightscript is not Case Sensitive for the most part; however, string comparisons and AssociativeArray keys can be case sensitive.

For more information on Brightscript, please see the following links:

Roku Developer Guide

BrightScript Language Reference

Roku Developer Program signup link

And the frequently helpful Roku Developers Forum

415 questions
0
votes
1 answer

No response from Vimeo API on GET request

For a Roku app I'm building, I need to get the list of channels for a Vimeo user. It's public data, so I can grab it with their Simple API, which looks like this example: https://vimeo.com/api/v2/user17146517/albums.json That request works great…
0
votes
2 answers

How to check if image failed to load?

I wanted to know if there was anyway, we can know the image was not loaded in the screen (roPosterScreen, roSpringBoard, or any screen). What I mean is, I set an image url in any of the screen and the image was deleted from the server, then can we…
0
votes
1 answer

Watch local variables

I am using sublime editor for brightscripting and was wondering if there is any way that I could add watches and type in local expression in debug console. So that every time, I dont dump my code lods and lods of print statements.
Sheetal
  • 91
  • 1
  • 7
0
votes
1 answer

How to mix grid/screen types in brightscript?

How can I use multiple screen types on the same screen? For example, how can I show the posterscreen on top and then the gridscreen at the bottom
user3500462
  • 125
  • 7
0
votes
1 answer

Brightsign, how to write a custom parser

I am trying to write a custom parser for the XD1030 Brightsign player. This is the the only sample code that I got. I think it works, but as it doesn't output anything anywhere I can't really tell. Sub rss(xmlFileName$ as String, itemsByIndex as…
Finitely Failed
  • 119
  • 3
  • 14
0
votes
1 answer

BrightScript - Can an Associative Array hold another Array as a Value?

I'm new to BrightScript and am trying to figure out how to work with their associative arrays. My questions is, can an associative array in BrightScript hold another array as a value? I'm trying to parse an associative array that looks like…
0
votes
1 answer

Text overlowing in roParagraphScreen

I have a text section on roku that is being cut off due to its length. There are two possible solutions. What would seem to be easist is make the text smaller on this one page. Make the text section scrollable My page is roParagraphScreen in…
dan_vitch
  • 4,477
  • 12
  • 46
  • 69
0
votes
2 answers

Capture Current Frame in Video Player

I want to retrieve the current Video Frame and process it as an image when a video is paused. Is this possible in Roku Brightscript? For Eg. I want to save the Paused Frame as Image and use it later as a Poster Image.
0
votes
2 answers

Text overlay on fullscreen video Roku

I'm starting developing brightscript with simpleVideoPlayer for Roku, how can I add a text overlay or an image canvas when the video is on fullscreen? Thanks a lot.
0
votes
1 answer

Which Roku device should I develop for?

Coming from a strong front end dev background to connected devices I learnt that I should always develop for the lowest common denominator when it came to unified clients. For standard CE-HTML style dev I found it's mainly low end 2011 blu rays that…
Ahmed Nuaman
  • 12,662
  • 15
  • 55
  • 87
-1
votes
1 answer

How to make custom button in Roku?

I want to make this type of button in Roku, If you have any information let me know. Thanks in advance!
-1
votes
2 answers

How could I use roSGScreen for open a new view? - Roku

Hi community I'm making an Roku app and I need to create window instance for can surf between it. The develop is inside the main fuction because is the only way that it works. Also I need to create some moduls that it not depend of the main, I have…
-1
votes
1 answer

IS It Possible to Manage (Full Screen) Video Screen in Roku?

I successfully playing some channel in Roku. and I tried to all channel full screen in Roku I set height width of video player. But Now still not working. Anyone know these issue How to set The Video playing a Full Screen. Anyone know this issue.…
-1
votes
2 answers

How to close screens by scripts in brightscript

I created a roSGScreen instance (screen1) and pushed the screen from the main class into the screen stack. Then I pushed another screen (screen2) into the stack. Now I want to remove the screen (pop from the screen stack) programmatically. The…
ganka
  • 191
  • 1
  • 11
-1
votes
1 answer

Omniture integration for Roku

Can anyone help me to integrate Omniture for Roku Channel? I couldn't find any document for that
Jeswin Rebil
  • 460
  • 1
  • 7
  • 19
1 2 3
27
28