GithubHelp home page GithubHelp logo

roku-instantresume's Introduction

Instant Resume

Instant Resume enables Roku Scenegraph channel to save its current state upon exit and then continue playback upon next launch. This improves the user experience by letting users quickly get back to the content they were watching before. This example code demonstrates how to implement Instant Resume in a roku channel. It takes the completed SceneGraph master sample channel, and does the following:

  1. Updates the channel manifest with required attributes.

  2. Implements the required suspend and resume handlers.

  3. Adds signal beacons to measure channel suspend and resume times.

Channel manifest

Channel manifest declare the sdk_instant_resume=1 and run_as_process=1 attributes.

  • sdk_instant_resume=1. Acknowledges that the channel has implemented all the requirements and protocols for the Instant Resume integration.

  • run_as_process=1. Enables the Roku OS to preserve the channel state in the device RAM when the channel is suspended.

Suspend and resume handlers

The videoPlayerLogic.brs file includes onMainSceneSuspend and onMainSceneResume callback functions for when the channel is suspended and resumed from a channel exit, respectively. These callback functions are defined in the MainScene.XML component.

  • onMainSceneSuspend. When the channel is suspended after being exited, this callback function checks whether the channel was exited because the Home button was pressed on the Roku remote control. If the Home button was pressed and the viewer was watching content, they are returned to the Details sceen upon the relaunching the channel. The user can the resume playback or start watching from the beginning.

  • onMainSceneResume. When the channel is resumed, this callback function checks whether it recevied any launch parameters. If so, the channel deeplinks into the content specified by the contentId using the launch behavior required by the specified mediaType.

Signal beacons

The onMainSceneResume callback function in the videoPlayerLogic.brs file fires the AppResumeComplete beacon. This beacon must be fired when the suspended scene is fully rendered during the resume process and when video playback starts after handling a deep link, once the channel can respond to commands sent via the Roku remote control.

roku-instantresume's People

Contributors

ersps25 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.