Requirements
- BrightSDK for webOS requires webOS 5.0 or newer (how to find out which version your TV is).
- Bright SDK for webOS (latest).
- webOS CLI (latest).
- webOS Emulator/Simulator (Recommended).
Create App ID on Dashboard
If you haven’t done this yet, log in to your dashboard and create your app ID first.
Important: IDs must comply with LG naming guidelines
- Avoid numbers in the bundle ID
- Incorrect:
com.game6.nice - Correct:
com.gamesix.nice
Extract SDK Framework
Download the latest Bright SDK from the Bright SDK Dashboard, unzip it.
- SDK Structure:
- SDK Overview:
- sample_app - A standard webOS app architecture example. Can also be used as a reference for Hosted Web Apps.
- iframe_sample_app - Example for apps where the UI is rendered inside an iFrame.
-
SDK Integration Components:
- service directory - The main engine containing all logic required to run the SDK. Must be copied next to your other services.
- brd_api.js - Frontend interface implementing the consent screen. Must be integrated with your application’s frontend.
Integrate Bright SDK in Your Code
You must update IDs in the SDK config files to match your application.
-
Configure app/service identifiers:
-
Update package.json
- Set a correct name attribute.
- Keep the
.brd_sdkpostfix. - Leave the rest untouched.
-
Update services.json
- Set
id,services[0].id, andservices[0].name. - Keep the
.brd_sdkpostfix - Leave the rest untouched
- Set
-
Example Configuration
Given appID from dashboard: webos_com.example.app.
- appinfo.json ID should be: com.example.app.
- package.json + services.json ID must be: com.example.app.brd_sdk
The SDK will add thewebos_prefixautomatically.
-
Update package.json
-
Embed SDK Dialog in Your Code:
You can use
sample_appas a reference.- Import brd_api.js:
- Copy
brd_api.jsandwebOSTV.jsinto your app directory. - Import it from the main file responsible for app initialization.
- After
brd_api.jsexecution, thebrd_apiglobal object will be available.
- Copy
-
SDK embedding in case of iFrame:
If your app is rendered in an iFrame:
-
brd_api.jsmust be included in the HTML page that is located on your server. -
Add
brd_iframe.json the*.ipksideiframe_sample_app/lib/brd_iframe.js). -
Set
iframe: truein api_settings. The location of SDK components is presented in the table below.TV (*.ipk) Server (iframe src) webOSTV.js brd_api.js brd_iframe.js service (folder)
-
- Import brd_api.js:
-
Add SDK Initialization:
Call
brd_api.init()after page load to access all SDK methods. Example:
- On first call
brd_api.init()will show a consent screen. - The user must agree or disagree.
- Get the result by setting the
on_status_changecallback. - The consent screen handles TV remote control input.
- You must disable your remote input processing when the consent screen is shown.
on_status_changewill be called after the consent screen is closed.
Build Your App
Build your app using the ares-package** CLI command (part of the webOS CLI).**
Build Command: Use theImportant: Clean BuildRemove all dynamic files from the app and service folders before building. Examples: logs,
Build Command: Use the
-n flag to disable source code minification, example:service/data/*.*