This topic lists code changes and other considerations for extending a legacy You.i C++ app to Roku.
In a traditional You.i C++ app, initialization and starting (that is, loading screens) can occur in either CYIApp::UserInit()
or CYApp::UserStart()
.
However, for Roku apps you need to apply those functions in a particular way:
CYIApp::UserInit()
only contains initialization that is not time- or user- dependent because the app remains in this state until the Roku client connects.CYIApp::UserStart()
is only called when the Roku client is launched and ready.
Invoke user authentication and data model fetches at this point to avoid stale data.
Stage the initial screen once the app is started.Refactor the legacy app’s code to support this initialization and start sequence.
Because the Roku client package includes a splash screen scene, it may be redundant to have the host app logic stage and send a splash screen from the cloud server. However, this depends on how the Roku app supports the error-case of the content back-end being unavailable. See Customizing the Splash Screen.
The host app logic screen can be skipped for Roku by adding the HINT::EXCLUDE_NODE
tag to the root of the splash screen scene.
For details, see Extending the App Code with Tags and YiExportHints.h.
The Roku app manifest contains the expected extents of the SceneGraph coordinate space. Change the app resolution to match the Roku app manifest; for example:
#define APP_WIDTH (1280)
#define APP_HEIGHT (720)
Staging a screen’s scene automatically triggers an export of the scene. The resulting new component library is then automatically transferred to the Roku client. For details, see Export Process and Extending the App Code with Tags.
Staging a modal overlay also triggers a component library export.
To avoid this behavior, use CYICloud::ICloudInterface::AddModalScene()
to register the modal, allowing it to be exported with existing screens.
For details, see CYICloudInterface Class Reference.
Consider the following when using the CYIImageView class:
CYIImageView::SetImage(const CYIUrl &url)
function, the image URL is automatically set in the Roku image node.
Otherwise, call CYIImageView::SetImageURL()
.For a list of lists, all of the component lists need to be fully loaded (that is, data fetches done for the visible part) before the screen is exported.
In addition to the changes described in Minimum Required Code Changes, you may need to extend coding for the Player Screen and the Search Screen depending on their usage.
Roku apps use Roku native player controls.
You can exclude any app-specific controls from the Player screen by adding the HINT::EXCLUDE_NODE
tag on the controls view.
For details, see Extending the App Code with Tags and YiExportHints.h.