asrikanth1990
8 years agoVisitor
Create Custom Library with no UI Components
HI
I am newbie to brightscript and ROKU. We have a situation here where in we need to develop a library for video measurement.
This do not require any UI elements. All we need to do is take some input perform some logic behind scene.
For this , i need to create something similar to class in OO programming. The closest i have come across is using associative arrays- through which i can assign key-value pairs for variables and methods that i require. I created a brightscript file measure.brs and added all my methods.
During initialization of lib, we start a timer and call some particular methods every 500ms based on position we get from video play-head. We also have other methods that are called on user actions.
The problem here : Control never comes out of Timer, So no other methods are being executed since main thread is occupied by timer.
I have read some forms and found out about task node, which is capable of executing something asynchronously. So i have created a timer task and tried to pass the associativeArray as object reference to task. Inside the task i am able to access member variables but all firsthand functions are treated as invalid. so i can run timer task but cannot call methods that i intend to.
please note the methods cannot be separated from measure.brs file..
Do i have any solution for this.
any help is appreciated
I am newbie to brightscript and ROKU. We have a situation here where in we need to develop a library for video measurement.
This do not require any UI elements. All we need to do is take some input perform some logic behind scene.
For this , i need to create something similar to class in OO programming. The closest i have come across is using associative arrays- through which i can assign key-value pairs for variables and methods that i require. I created a brightscript file measure.brs and added all my methods.
During initialization of lib, we start a timer and call some particular methods every 500ms based on position we get from video play-head. We also have other methods that are called on user actions.
The problem here : Control never comes out of Timer, So no other methods are being executed since main thread is occupied by timer.
I have read some forms and found out about task node, which is capable of executing something asynchronously. So i have created a timer task and tried to pass the associativeArray as object reference to task. Inside the task i am able to access member variables but all firsthand functions are treated as invalid. so i can run timer task but cannot call methods that i intend to.
please note the methods cannot be separated from measure.brs file..
Do i have any solution for this.
any help is appreciated