Search code examples
videorokubrightscript

"Should" the roku video node be created in task thread always?


The video node can be created in both render thread & task node thread. Is there a mandate on video node to be created only in "task node" thread?

From the definition of render thread, it says that render thread must be used to create UI elements & any blocking operations can be moved to task node thread.

So, my question is if i'm creating a video player application, then video player controls & ui elements can be created in render thread & task node thread should have the video url loading, event listeners, button behaviors, player behaviors etc in task node thread. Am i right?


Solution

  • All the opposite, you should not create a Video node (or any renderable node) in a task thread. Even though you're able to create a Video node in a task thread, those nodes are owned by the render thread, so you will be triggering very expensive rendezvous operations.

    From the documentation:

    You should generally not create renderable node objects in a Task node thread. The rendezvous mechanism will be required to create and operate on those node objects. Every field set or get operation on such nodes will require a full rendezvous, and this could impact the performance of your application.