Skip to content

StreamLayer/roku-sdk-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamLayer Roku Consumer Demo App

Demo Roku channel used for testing the StreamLayer SDK (SLSDK) integration.
This application demonstrates:

  • dynamic SDK package loading
  • SDK initialization
  • player binding
  • event/session handling
  • rendering StreamLayer interactive overlays inside a Roku SceneGraph UI

The SLSDK integration module is fully self-contained and can be copied into any Roku channel.


Installation & Setup

Requirements

  • Roku device (Roku Ultra recommended)
  • Roku OS 11.5+
  • Developer Mode enabled
  • Ability to sideload apps (http://<ROKU_IP>)
  • Basic understanding of BrightScript and SceneGraph

📁 Project Structure

components/
└── SLSDK/
    ├── SLView/
    │   ├── SLView.xml
    │   └── SLView.brs
    └── SLManager/
        ├── SLManager.xml
        └── SLManager.brs

shared/
└── StreamLayerSDK.pkg   (local SDK package)
  • SLView → Public component that your app interacts with
  • SLManager → Internal logic controller (not called directly)
  • StreamLayerSDK.pkg → The StreamLayer UI bundle loaded at runtime

Configuration

Edit config.json:

{
  "settings": {
    "language": "EN",
    "platform": "roku",
    "apiKey": "REPLACE_WITH_YOUR_API_KEY",
    "sdkUri": "pkg:/shared/StreamLayerSDK.pkg",
    "streamUrl": "REPLACE_WITH_YOUR_STREAM_URL",
    "isLoggingEnabled": true,
    "isAnalyticsEnabled": false,
    "isVastModeEnabled": false
  }
}

Field Descriptions

Field Description
language UI language code (e.g., EN)
platform Always "roku"
apiKey Your StreamLayer API Key (required)
sdkUri Path to the StreamLayer SDK package
streamUrl Video stream URL for the demo player
isLoggingEnabled Enables StreamLayer logging
isAnalyticsEnabled Enables StreamLayer-side analytics
isVastModeEnabled Mark this as experimental in the docs

Integration Architecture Overview

1. SLView – Public API Layer

The only component your app interacts with.
Provides:

  • SDK initialization
  • Player attachment
  • Event switching
  • Focus handling
  • Promo visibility events

2. SLManager – Internal Logic Layer

Handles:

  • SDK package loading
  • Creating StreamLayer root nodes
  • Observing events (promoVisible, logs)
  • Passing data to the SDK
  • Cleanup of SDK node

Developers do NOT interact with SLManager directly.


StreamLayer Roku Public API

This is the API surface exposed by SLView to the host application.


initialize(params)

Initializes the StreamLayer SDK.

Parameters:

Key Required Description
apiKey StreamLayer API key
sdkUri Path to SDK package
playerRef SceneGraph video node
isLoggingEnabled Enables debug logs
isAnalyticsEnabled Enables analytics
isVastModeEnabled Experimental

Example:

slView.initialize({
    apiKey: m.config.apiKey,
    playerRef: m.videoPlayer,
    sdkUri: m.config.sdkUri,
    isLoggingEnabled: true,
    isAnalyticsEnabled: false,
    isVastModeEnabled: false
})

attachPlayer(playerRef)

Attaches/re-attaches your video player to StreamLayer.

slView.attachPlayer(m.videoPlayer)

setEvent(eventId)

Tells StreamLayer to load data for a specific event/session.

slView.setEvent("event123")

disposeSdk()

Destroys all StreamLayer UI and removes the container.

slView.disposeSdk()

getVersion()

Returns the current version of the StreamLayer SDK.

version = slView.getVersion()
? "[App] SDK version: " + version

Public Fields

promoVisible (boolean)

Read-only.
Indicates when a promo/ad overlay is visible.

Example:

m.slView.observeField("promoVisible", "onPromoVisibleChanged")

focus (boolean)

Used by the host to transfer focus to StreamLayer UI.

slView.focus = true

Usage Example (Demo App)

XML

<SLView id="SLView" visible="true" />

BRS

m.slView = m.top.findNode("SLView")

m.slView.callFunc("initialize", {
    apiKey: m.config.apiKey,
    playerRef: m.videoPlayer,
    sdkUri: m.config.sdkUri
})

m.slView.setEvent("event123")

version = m.slView.getVersion()
? "SDK version: " + version

Test Streams for SDK Overlay Preview

The sample application includes several ready-to-use video streams so you can immediately preview StreamLayer’s interactive overlays inside the Roku player. These streams are provided only for testing and demonstration purposes.

Available Sample Streams

https://storage.googleapis.com/shaka-demo-assets/bbb-dark-truths-hls/hls.m3u8
https://stream.mux.com/wx8bp9XKXuYjKu3ZqKpE5ga1QVQcF02x.m3u8
https://content.jwplatform.com/manifests/vM7nH0Kl.m3u8
https://demo.unified-streaming.com/k8s/features/stable/video/tears-of-steel/tears-of-steel.ism/.m3u8

Using Your Own Stream

To test StreamLayer with your own content:

Open config.json.

Locate the streamUrl field.

Replace it with your own valid HLS (.m3u8) URL. You can also use one of the sample test streams above if needed.


Developer Notes

View Logs (recommended)

telnet <ROKU-IP> 8085

Logs are tagged:

  • [SLView]
  • [SLManager]
  • [StreamLayerSDK]

👥 Maintainers

StreamLayer Engineering Team
© 2025 StreamLayer. All rights reserved.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published