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

Roku:VAST tag implement

I am working on roku app using scene graph component, i want to implement VAST tag for ad in roku app using scene graph. How to implement VAST tag?
Balbant Singh
  • 187
  • 1
  • 10
0
votes
3 answers

Roku: get rid of component poster image flicker

I have simple a brightscript roku app. I just want to play a full screen image after the splash screen and I get a strange full screen black then gray background that shows before my full screen image. I can display a full screen image using…
rynop
  • 50,086
  • 26
  • 101
  • 112
0
votes
1 answer

Trouble playing vid pre-roll ad in Roku

I'm trying to add VAST video pre-roll ads to the SThree sample Roku SDK project (the "Simple Grid with Video and Details page (.zip)" version). I can get it to work on app start by putting the following code into main.brs: library…
rynop
  • 50,086
  • 26
  • 101
  • 112
0
votes
1 answer

Can we add pause button when roku ads playing?

Can we add pause functionality to pause the ads after specific time? Actually I'm using Roku advertising with scene graph and want to pause ads after specific time. Is this possible?
Martin C
  • 395
  • 1
  • 7
  • 21
0
votes
1 answer

Pause action not working properly in roku

I am developing a roku channel by using scene graph. I am using video node to play video and also disabled default UI of video like progress bar, buffering bar etc... I want to develope custom progress bar using video node. My issue is... To pause…
Martin C
  • 395
  • 1
  • 7
  • 21
0
votes
1 answer

How to disable options button functionality when video playing in bright script

I am working on roku using Scene Graph. I want disable options(asterisk) button functionality when video playing. Thank you.
Vijay Kumar
  • 141
  • 1
  • 13
0
votes
1 answer

Roku: How to hide Overhang using XML

I am using the Roku Scene Graph XML to create my screen. I currently have an overhang on the top of my screen that I would like to slide out after 5 seconds of not being focused on it. The Roku Docs make it seem like this is possible, but don't give…
Milap
  • 147
  • 1
  • 6
  • 15
0
votes
1 answer

Roku Scene Graph - create new scene

I'm trying to run a sample app from Roku with their new SceneGraph API but i get stuck at the beginning, when i'm trying to create a new scene. I didn't modified anything. The error that i received is: BRIGHTSCRIPT: ERROR: roSGScreen.CreateScene:…
0
votes
1 answer

How to add skip button when roku ad is playing?

I am working on roku app using scene graph component. I am using RAF to show ads before video playing and this is working properly for me. My code is... timestamp = CreateObject("roDateTime") adUrl =…
Vijay Kumar
  • 141
  • 1
  • 13
0
votes
2 answers

How to implement advertise in roku using Scene Graph

I am working bright script using scene graph. I want to play ads before video play. How to implement in bright script using scene graph.
Vijay Kumar
  • 141
  • 1
  • 13
0
votes
2 answers

How to display user Variables using a custom parsing plugin in bright-script?

I want to use user variables in a custom plugin written in Bright-Script. Those variables are defined in Bright-Author during the process of creating a presentation. I tried bringing those in the script by using the user-Variables associative array…
0
votes
0 answers

Roku: Playback is not smooth on Roku-4 device for 1080p@60fps HEVC content

I am running "customvideoplayer" sample application present inside roku SDK on a Roku-4 device. I got the roku SDK from this link: http://wwwimg.roku.com/static/sdk/RokuSDK.zip I am testing a 1080p@60fps HEVC stream. The Roku-4 is connected to a…
MayurK
  • 1,925
  • 14
  • 27
0
votes
1 answer

Roku - How to play music in background of Slideshow?

I am new to Roku & Brightscript programming. I want to play music in the background while showing photos from my album in the thumb drive. I found this awesome project on Github which plays Slideshows. Trying to figure out a way to play music in…
Bhuvan
  • 1,523
  • 4
  • 23
  • 49
0
votes
1 answer

Is this possible to fix these issues in roku?

Im working on a roku app using scene graph component. I am facing many issues like... During video buffering i want to pause video. Im using this code but not working video.control = "pause" During video buffering a blank screen is displaying. I…
Katty
  • 489
  • 6
  • 28
0
votes
3 answers

Field 'isTextEllipsized' from Label component not working - Roku Scenegraph

As I said on the title the field isTextEllipsized is not working for me, is always returning false. Example: label = m.top.createChild("Label") label.color = "#ffffff" label.font = font label.vertAlign = "bottom" label.wrap = true label.lineSpacing…
Alejandro Cotilla
  • 2,501
  • 1
  • 20
  • 35