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

BrightScript: How to create a grid of PosterGrid items?

I am trying to develop a Roku app. Not able to create a grid of items where each item is a poster grid in itself. Could not able to find any example for this situation? Link to any similar example will be very useful.
Himanshu Yadav
  • 13,315
  • 46
  • 162
  • 291
0
votes
1 answer

difficulties using XML in Brightscript

I am very inexperienced in both using Brightscript and working with XML content, but I am currently challenged with doing both to develop a roku app. At the moment, I need to figure out how to sort through some XML from an online document to get…
remington howell
  • 148
  • 1
  • 2
  • 13
0
votes
1 answer

Unable to parse xml string in Brightscript

I am currently trying to create an application for Roku where the user can find and watch some of the most recent recorded church services available from my church's archives. To do this, I access an API containing an XML document with data…
remington howell
  • 148
  • 1
  • 2
  • 13
0
votes
1 answer

How to lauch another channel(B) from current channel(A) in ROKU

Show all channels Clicking on channel takes the user to channel if installed If not installed, allow the user to install. if IsChannelIstalled(channelID) then ECP_Command(“launch/channelID?contentID=deep_link_param) else …
0
votes
2 answers

Why fastforward/rewind button first time working too slow

I am working on video player using video node. My issue is when i press first time fastforward/rewind button during video playing/buffering then button is not working. After pressing 4-6 times fast forward or rewind button is working after that it…
Katty
  • 489
  • 6
  • 28
0
votes
1 answer

How to use roImageCanvas in scene graph component

I am using Scene Graph Component to develop a application with MarkupList and MarkupGrid. I want a custom dialog box open when user exit from application. I am using roImageCanvas to create custom dialog box but don't know how to implement this.…
Katty
  • 489
  • 6
  • 28
0
votes
1 answer

Questions about ButtonGroup in Scene Graph with brightscript

Recently I was building a channel containing some buttons, I was trying using https://sdkdocs.roku.com/display/sdkdoc/ButtonGroup. Since I tried to divide the buttons into two lines, so I tried two buttongroup in two lines. like: button1…
0
votes
1 answer

Roku with Instant TV Channel and BrightScript Differences

I am a beginner for developing an app for Roku platform. I had few queries on instant tv channel and the BrightScript. I tried installing the BrightScript plugin in eclipse to start with the Roku app development. I have CDN which provides set of…
Bhat
  • 602
  • 9
  • 24
0
votes
1 answer

Find Information details from roku packaged file

I have a doubt. If I am giving my pkg file to any other developer/user is there any chance that he can find some information from that packaged file.Is there any risk of the leakage of my code or app information.Please guys help me as soon as…
Developer
  • 103
  • 12
0
votes
0 answers

Certain videos on Roku cut off 10 or so seconds from the beginning

I have a Roku channel in beta testing and have seen some peculiar issues with some of our videos. The problem we're seeing is certain, not all, videos have about 10 seconds cut off from the beginning. We're a Television station and all of our…
0
votes
1 answer

Create a function in BrightScript debugger?

Is it possible to create a function interactively at the debugger interface? When I enter something like BrightScript Debugger> function foo() I get an error like Syntax Error. (compile error &h02) in $LIVECOMPILE(296) I'm guessing this is…
Ocie Mitchell
  • 1,745
  • 2
  • 12
  • 20
0
votes
2 answers

How to clear the data from roRegistrysection Roku in developer mode

I am in between developing an roku app, which needs me me save and clear a key d. I am able to do it using roRegistrySection however when I delete the channel, still that key present which should not if I go through the documents which is below Roku…
Saty
  • 2,563
  • 3
  • 37
  • 88
0
votes
0 answers

Trackers on Roku

We are trying to get the trackers on the proxy(wireshark) we are getting all the trackers and their information on the brightscript debug console. But, there there is no impression of trackers such as first, midpoint, third, complete quarterlies on…
tdst
  • 1
  • 3
0
votes
1 answer

Depth first traversal

I'm trying to optimise a html parser for a Roku application I'm helping to develop. The parser currently takes too long to parse the data (8 seconds) and it does this by recursivly traversing the children of each tag encountered within a for each…
CWright
  • 2,068
  • 2
  • 16
  • 20
0
votes
1 answer

Roku https request failed

I have the below code to get data from my https website having godaddy certificate.but i unable to get the result from the url. port = CreateObject("roMessagePort") req =…
Shijin TR
  • 7,516
  • 10
  • 55
  • 122