Extending a Legacy You.i Engine C++ App to Roku Cloud

This topic lists code changes and other considerations for extending a legacy You.i Engine C++ app to Roku.

Minimum Required Code Changes

App Initialization

In a traditional You.i Engine 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:

  • Ensure 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.

Splash Screen and Intro Screens

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.

AppFactory.cpp

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 Scenes

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.

Rendering Images

Consider the following when using the CYIImageView class:

  • The image URL must be set for the cloud exporter to find the images
  • If you use the CYIImageView::SetImage(const CYIUrl &url) function, the image URL is automatically set in the Roku image node. Otherwise, call CYIImageView::SetImageURL().

Rendering Lists

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.

Additional Possible Code Changes

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.

Player Screen

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.