From 722ccd092d549b4d7b1780c369e87cc6f924a3ef Mon Sep 17 00:00:00 2001 From: Michiel van der Geest Date: Mon, 22 Aug 2022 10:03:55 +0200 Subject: [PATCH] Updated documentation for plugins that have moved to the metrological-sdk. --- docs/_sidebar.md | 1 - docs/plugins/metadata.md | 72 +----- docs/plugins/metrics.md | 148 +---------- docs/plugins/pin.md | 79 +----- docs/plugins/profile.md | 170 +------------ docs/plugins/purchase.md | 233 +----------------- docs/plugins/tv.md | 139 +---------- docs/plugins/videoplayer.md | 473 +----------------------------------- 8 files changed, 7 insertions(+), 1308 deletions(-) diff --git a/docs/_sidebar.md b/docs/_sidebar.md index cd68414b..d07cdcc7 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -7,7 +7,6 @@ - [Log](/plugins/log.md) - [Metadata](/plugins/metadata.md) - [Metrics](/plugins/metrics.md) - - [Metadata](/plugins/metadata.md) - [Profile](/plugins/profile.md) - [Purchase](/plugins/purchase.md) - [Language](/plugins/language.md) diff --git a/docs/plugins/metadata.md b/docs/plugins/metadata.md index 6c4e20c8..3b0a32cb 100644 --- a/docs/plugins/metadata.md +++ b/docs/plugins/metadata.md @@ -4,74 +4,4 @@ If you create an App, you store the App's *metadata* (such as its name, version The Metadata plugin enables you to use this metadata in your App. (For example, if you want to show the App's version number in an *About* window.) -> If you deploy your App to the Metrological Store, the metadata is 'injected' into the App by the Metrological Store. - -## Usage - -If you want to access metadata in your App code directly, import the *Metadata* plugin from the Lightning SDK: - -```js -import { Metadata } from '@lightningjs/sdk' -``` - -The SDK automatically creates the `appMetadata` from the Launch params. - -## Available methods - -### Get - -Returns the key value of the metadata. - -```js -Metadata.get(key, [fallback]) -``` -Key can be either `icon`, `id`, `safeId`, `version`, `name`, `description`, `type`, `url` or `artwork` . -Optionally you can specify a `fallback`-value for when the Metadata is not defined. - -### AppId - -Gets Application id from Metadata - -```js -Metadata.appId() -``` - -### SafeAppId - -Returns the *safe ID* of your App. This is actually the `AppId` without dots (and any other special characters) which are are not permitted in JS variables. - -```js -Metadata.safeAppId() -``` - -### AppName - -Returns the name of your App. - -```js -Metadata.appName() -``` - -### AppVersion - -Returns the version of your App (without the GIT commit hash). - -```js -Metadata.appVersion() -``` - -### AppIcon - -Returns the icon of your App. - -```js -Metadata.appIcon() -``` - -### AppFullVersion - -Returns the full version of your App. - -```js -Metadata.appFullVersion() -``` +> Starting v5.0.0 and up, the Metadata plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/metrics.md b/docs/plugins/metrics.md index f96d66e5..dde379e0 100644 --- a/docs/plugins/metrics.md +++ b/docs/plugins/metrics.md @@ -4,150 +4,4 @@ It is important to know how people use Apps. We can acquire this information by Because each operator might implement these tracking metrics in a different way, the Lightning SDK provides the *Metrics* plugin. This plugin is a *generic* interface for developers, independent of any operator or platform. -Some *standard* metrics are automatically implemented by the SDK, such as App Launch, App Loaded, App Close and various video-related [media](#media) events. - -You can implement additional metrics in your App. For example, when the App is 'Ready to use', or specific user interactions like 'Clicking on a button'. - -There are four event-related categories for sending metrics: - -* App -* Page -* User -* Media - -## Usage - -Import the Metrics plugin in components where you want to track and send events: - -```js -import { Metrics } from '@lightningjs/sdk' -``` - -## Available Methods - -### App.launch - -Sends a metric that the App is launched (implemented automatically by the SDK). - -```js -Metrics.App.launch() -``` - -### App.loaded - -Sends a metric that the App is loaded (implemented automatically by the SDK). - -```js -Metrics.App.loaded() -``` - -### App.ready - -Sends a metric that the App is ready to be used. - -```js -Metrics.App.ready() -``` - -### App.close - -Sends a metric that the App is closed (implemented automatically by the SDK). - -```js -Metrics.App.close() -``` - -### App.error - -Sends a metric that an error has occurred in the App. - -```js -Metrics.App.error(message, code, params) -``` - -### App.event - -Sends a custom metric that is related to an App event. - -```js -Metrics.App.event(name, params) -``` - -### Page.view - -Sends a metric that a page has been viewed. - -```js -Metrics.page.view(name, params) -``` - -### Page.leave - -Sends a metric that a page has been left. - -```js -Metrics.page.leave(name, params) -``` - -### Page.error - -Sends a metric that an error has occurred when accessing a page. - -```js -Metrics.page.error(message, code, params) -``` - -### Page.event - -Sends a custom metric that is related to a Page event. - -```js -Metrics.page.event(name, params) -``` - -### User.click - -Sends a metric that a user has clicked on an element. - -```js -Metrics.user.click(name, params) -``` - -### User.input - -Sends a metric that a user has supplied input. - -```js -Metrics.user.input(name, params) -``` - -### User.error - -Sends a metric that an error has occurred that is related to a User event. - -```js -Metrics.user.error(message, code, params) -``` - -### User.event - -Sends a custom metric that is related to a User event. - -```js -Metrics.user.event(name, params) -``` - -### Media - -The [VideoPlayer](videoplayer.md) plugin automatically tracks and sends video-related metrics. Each metric receives the URL and progress of the current video. The Media events that are sent as metrics are: - -* Media Abort -* Media CanPlay -* Media Ended -* Media Pause -* Media Play -* Media Suspend -* Media VolumeChange -* Media Waiting -* Media Seeking -* Media Seeked +> Starting v5.0.0 and up, the Metrics plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/pin.md b/docs/plugins/pin.md index 52a906f2..5113e627 100644 --- a/docs/plugins/pin.md +++ b/docs/plugins/pin.md @@ -6,81 +6,4 @@ You can use the interface to check the middleware layer for the current state of Depending on the state of the STB, you can use the Pin plugin to lock certain content or screens in your App. -## Usage - -If you want to use the Pin plugin, import it from the Lightning SDK: - -```js -import { Pin } from '@lightningjs/sdk' -``` - -## Available Methods - -### show - -Shows a standard, built-in **Pin** dialog where the user can supply a Pin code. - -```js -Pin.show() -``` - -### hide - -Hides the visible **Pin** dialog. - -```js -Pin.hide() -``` - -### submit - -Sends a Pin code to the middleware layer for verification. If the code is correct, the STB will be unlocked. - -The `submit` method accepts `pin` and `context` as it's arguments. The context argument indicates in with what purpsose the Pin dialog is being used. The accepted values van be either `parental` or `purchase`. `context` defaults to `purchase`, but it's recommended to explicitly specify the context - -The `submit` method is automatically invoked when you are using the built-in **Pin** dialog. Use this method for sending the Pin code *only* if you are making a fully custom **Pin** dialog in your App. - -```js -Pin.submit('0000', context) - .then(() => console.log('Unlocked!')) - .catch(e => console.log('Pin error', e)) -``` - -The `submit` method returns a *Promise*. If the supplied Pin code is correct (and context is valid), the Promise resolves with `true` and the STB will be unlocked. If the Pin code or context are wrong, the Promise resolves with `false`. - -If the middleware is unable to unlock the STB, the Promise is *rejected* (with an optional error message). - -During development, the default Pin code is `0000`. Optionally, you can overwrite the default Pin code during development by editing the **settings.json** file and adding the key `pin` as a Platform Setting with a different valid Pin code. - -### unlocked - -Checks if the STB is currently *unlocked*. - -```js -Pin.unlocked(context) - .then( - unlocked => unlocked === true ? - console.log('STB is unlocked') : - console.log('STB is locked')) -``` - -The `unlocked` method returns a *Promise* which resolves with `true` if the device is *unlocked*, or with `false` if the device is *locked*. - -If the middleware is unable to retrieve the current state, the Promise is *rejected*. - -### locked - -Checks if the STB is currently *locked*. - -```js -Pin.locked(context) - .then( - locked => locked === true ? - console.log('STB is locked') : - console.log('STB is unlocked')) -``` - -The `locked` method is the *exact* counterpart of the `unlocked` method. It returns a *Promise* which resolves to `true` if -the device is *locked* or to `false` if the device is *unlocked*. - -If the middleware is unable to retrieve the current state, the Promise is *rejected*. +> Starting v5.0.0 and up, the Pin plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/profile.md b/docs/plugins/profile.md index 7f354120..f9cfd605 100644 --- a/docs/plugins/profile.md +++ b/docs/plugins/profile.md @@ -6,172 +6,4 @@ Because each operator or platform might implement user profile information in a You can also use the Profile plugin to *update* profile information. -> The profile information that can actually be updated, depends on the operator or platform. - -## Usage - -If you need Profile information, import the Profile plugin from the Lightning SDK: - -```js -import { Profile } from '@lightningjs/sdk' -``` - -## Available Methods - -If you call one of the methods below *without* parameters, it returns the Profile information in the form of a *Promise*. - -If you pass parameters, the method will *attempt to update* the Profile information. The information that can actually be updated, depends on the operator / platform. - -### ageRating - -Gets the user's age rating. Returns `adult` by default during *local development*. - -```js -Profile.ageRating() -``` - -### city - -Gets the user's city. Returns `New York` by default during *local development*. - -```js -Profile.city() -``` - -### zipCode - -Gets the user's zip code. Returns `27505` by default during *local development*. - -```js -Profile.zipCode() -``` - -### countryCode - -Gets the user's country code. Returns `US` by default during *local development*. - -```js -Profile.countryCode() -``` - -### ip - -Gets the user's IP address. Returns `127.0.0.1` by default during *local development*. - -```js -Profile.ip() -``` - -### household - -Gets the user's household ID. Returns `b2244e9d4c04826ccd5a7b2c2a50e7d4` by default during *local development*. - -```js -Profile.household() -``` - -### language - -Gets the user's language, based on the currently set locale. During *local development*, it attempts to return the browser's language with `en` as default. - -```js -Profile.language() -``` - -### latLon - -Gets the user's latitude and longitude. - -During *local development*, it returns the user's actual latitude and longitude from a remote API service. If unsuccessful, it defaults to `[40.7128, 74.006]`. - -If, during *local development*, you want to force to use the browser's built-in *geolocation* for retrieving the latitude and longitude, add the key `forceBrowserGeolocation` with the value `true` as a Platform Setting in **settings.json**. - -```js -Profile.latLon() -``` - -### locale - -Gets the user's locale. During *local development*, it returns the browser's locale, with a fallback to `en-US`. - -```js -Profile.locale() -``` - -### mac - -Gets the user's Mac address. Returns `00:00:00:00:00:00` by default during *local development*. - -```js -Profile.mac() -``` - -### operator - -Gets the user's operator. Returns `metrological` by default during *local development*. - -```js -Profile.operator() -``` - -### platform - -Gets the user's platform. Returns `metrological` by default during *local development*. - -```js -Profile.platform() -``` - -### packages - -Gets the user's packages. Returns `[]` by default during *local development*. - -```js -Profile.packages() -``` - -### uid - -Gets the user ID. Returns `ee6723b8-7ab3-462c-8d93-dbf61227998e` by default during *local development*. - -```js -Profile.uid() -``` - -### stbType - -Gets the user's STB type. Returns `metrological` by default during *local development*. - -```js -Profile.stbType() -``` - -## Overwriting Default Values - -During development you might want to test your App with different profile values (for example, a different language or age rating). -When you want to overwrite the default values, you can do so by editing the **settings.json** file. -Add a `profile` key in `platformSettings` and only add the values you wish to change here. - -```json -{ - "platformSettings": { - "profile": { - "ageRating": "adult", - "city": "New York", - "zipCode": "27505", - "countryCode": "US", - "ip": "127.0.0.1", - "household": "b2244e9d4c04826ccd5a7b2c2a50e7d4", - "language": "en", - "latlon": [40.7128, 74.006], - "locale": "en-US", - "mac": "00:00:00:00:00:00", - "operator": "metrological", - "platform": "metrological", - "packages": [], - "uid": "ee6723b8-7ab3-462c-8d93-dbf61227998e", - "stbType": "metrological" - } - } -} -``` +> Starting v5.0.0 and up, the Profile plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/purchase.md b/docs/plugins/purchase.md index b3a37f9c..f7e76544 100644 --- a/docs/plugins/purchase.md +++ b/docs/plugins/purchase.md @@ -2,235 +2,4 @@ You can use the Purchase plugin to integrate *in-app purchases* in your App, in combination with the Metrological Billing Server. This way, you can let customers perform transactions in Apps, and the customers can pay for the transactions via the operator’s monthly bill. -## Usage - -If you want to integrate purchases in your App, import the Purchase plugin from the Lightning SDK: - -```js -import { Purchase } from '@lightningjs/sdk' -``` - -## Available Methods - -### buy - -The `buy` method executes all the required steps to do a full purchase of an asset. - -> If you use this method, it is required that you have *properly configured* the Purchase plugin via the `setup` method (see [below](#setup)). - -In a typical, default setup, buying an asset with the Lightning SDK and the Metrological Billing Server only requires calling `Purchase.buy()`. No other calls should be necessary. - -The `buy` method performs the following actions: - -* Retrieve a signature for a given asset -* Fire a payment request to the Metrological Billing Server -* Attempt to register a successful purchase at the CSP backend -* Confirm back to the Metrological Billing Server that the purchase has been registered by the CSP backend - -The `buy` method accepts an `assetId `(as defined by the CSP) as its first argument. For example: - -```js -const assetId = '123abc' -Purchase.buy(assetId).then(() => { - // asset succesfully bought -}).catch(err => { - // some error -}) -``` - -> If the CSP backend does *not* completely follow the expected blueprint, or can not be configured properly via the `setup` method, the steps in the `buy` method can also be implemented *manually*. In that case, you can use the Purchase plugin methods `signature`, `payment`, `subscribe` and `confirm` (see [below](#signature)). - -### setup - -You use the `setup` method to configure the Purchase plugin for matching with a specific CSP backend setup, which is used for providing available assets and storing purchased asset records. - -> The `setup` method should only be called *once*, before any other Purchase plugin method is called. - -The `setup` method accepts a *configuration object* as its only argument. The object can have *2 keys*: - -* `cspUrl`: specifies the *base URL* of the backend of the CSP (Content Service Provider). -* `endPoints`: can be used to customize those API endpoints that differ from the default specification (as outlined below). For each *endpoint* that differs from the default, you specify the *URI* (which will be appended to the `cspUrl`, unless specified as a fully qualified domain) and the REST *method* to use. - -If needed, you can also specify an object with custom `headers` that will be merged with the default headers (`{ Accept: 'application/json', 'Content-Type': 'application/json' }`). - -```js -{ - assets: { - uri: '/assets', - method: 'GET', - }, - asset: { - uri: '/assets/:id', - method: 'GET', - }, - signature: { - uri: '/assets/:id/signature', - method: 'POST', - }, - subscribe: { - uri: '/assets/:id/subscribe', - method: 'POST', - }, - unsubscribe: { - uri: '/assets/:id/unsubscribe', - method: 'POST', - }, -} -``` - -```js -Purchase.setup('http://csp-backend.com/api', { - assets: { - uri: '/products', - method: 'GET', - }, - unsubscribe: { - uri: '/subscriptions/:id', - method: 'DELETE', - }, - signature: { - uri: '/assets/:id/signature', - method: 'POST', - headers: { - 'x-auth-token': 'abcd123xyz' - 'cache-control': 'no-cache' - } - }, -}) -``` - -In some cases, the setup of the CSP backend differs too much from the default specification and it becomes too difficult to configure the enpoint URIs. In those cases, you can specify a *callback* instead, and handle the request to the CSP backend entirely yourself. - -The callback function will receive 2 arguments: `params` and `data`. It should always return a Promise which resolves with the result (or rejects with an error in case of a failure). - -> When a callback is specified, all other keys in the endpoint configuration are ignored. - -```js -Purchase.setup('http://csp-backend.com/api', { - asset: { - callback(params, data) { - return Promise((resolve, reject) => { - Api.getAssetDetails(params.id) - .then(resolve) - .catch(reject) - } - } - }, - signature: { - callback(params, data) { - return fetch('http://csp-backend.com/api/' + data.household + '?productId=' + params.id, { - headers: { - 'Accept': 'application/json', - 'Content-Type': 'application/json' - }), - method: 'POST', - }) - } - }, -}) -``` - -### assets - -The `assets` method returns a *Promise* with the result of the request that is made to the CSP to retrieve available assets for purchase. Typically, it returns an Array of objects containing information about the assets (such as *title*, *description* and *price*). - -The `household` is automatically sent as a `query param` in the request. This allows to return information on whether the assets were purchased by the current household or not. - -The `assets` method is an *optional* convenience method provided by the Purchase plugin. Depending on the CSP's API integration, the functionality to retrieve assets can be fully custom-implemented in your App. - -```js -Purchase.assets().then(assets => { - // do something with assets -}) -``` - -### asset - -The `asset` method returns a Promise with the result of the request to the CSP to retrieve details for a specific asset. - -The `household` is automatically sent as a `query param` in the request. This allows to return information on whether the asset was purchased by the current household or not. - -The `asset` method is an *optional* convenience method provided by the Purchase plugin. Depending on the CSP's API integration, the functionality to retrieve an asset can be fully custom-implemented in your App. - -```js -const assetId = '123abc' -Purchase.asset(assetId).then(assets => { - // do something with assets -}) -``` - -### signature - -To make a payment request to the Metrological Billing Server, the CSP must provide a *signed signature*. - -The `signature` method returns a *Promise* with the result of the request made to the CSP to retrieve that signature. It accepts the `id` of the asset to purchase as its argument. - -The `household` value is automatically added as a `query param` in the request. - -The `signature` method is an *optional* convenience method provided by the Purchase plugin. Depending on the CSP's API integration, the functionality to generate a purchase signature can be fully custom-implemented in your App. - -```js -const assetId = '123abc' -Purchase.signature(assetId).then(signature => { - // call Purchase.payment() with signature -}) -``` - -### payment - -The `payment` method calls the Metrological Billing Server to execute a purchase. It accepts a *valid signature* (as retrieved from the CSP) as its argument. - -The method returns a *Promise*. If successful, the Promise resolves to a transaction object (that can be stored on the CSP side). If not, it rejects with an error code in case of a failure. - -```js -const signature = {} // received from Payment.signature() -Purchase.payment(signature).then(() => { - // call Payment.subscribe() -}) -``` - -### subscribe - -After a successful transaction, the CSP stores the purchase on their system. Especially in the case of recurring subscriptions, where storing the purchase is essential. - -The `subscribe` method returns a *Promise* with the result of the request made to the CSP to register the purchase. It accepts the `id` of the purchased asset as its first argument, and the `transaction` object as received from the Metrological Billing Server (via `Purchase.payment()`) as its second argument. - -The `subscribe` method is an *optional* convenience method provided by the Purchase plugin. Depending on the CSP's API integration, the functionality to register a purchase can be fully custom-implemented in your App. - -```js -const assetId = '123abc' -const transaction = {} // received from Purchase.payment() -Purchase.subscribe(assetId, transaction).then(() => { - // call Purchase.confirm() -}) -``` - -### confirm - -The `confirm` method calls the Metrological Billing Server to confirm a purchase. It accepts a `transactionId` (which is available inside the transaction object that is returned by a successful `payment` request) as its argument. - -Calling the method notifies the Metrological Billing Server that the CSP has received *and* stored the purchase on the CSP's backend. - -The method returns a *Promise* which resolves in case of a successful confirmation. If the `transactionId` is not valid, the Promise is rejected. - -```js -const transaction = {} // received from Purchase.payment() -Purchase.subscribe(transaction.transactionId).then(() => { - // full purchase flow done -}) -``` - -### unsubscribe - -Since the CSP is responsible for renewing subscriptions in the context of the Metrological Billing Server, the CSP must be able to handle *cancellations of recurring purchases*. - -The `unsubscribe` method returns a *Promise* with the result of the request made to the CSP to unsubscribe from a recurring purchase. It accepts the `id` of the purchased asset as its first argument. - -The `unsubscribe` method is an *optional* convenience method provided by the Purchase plugin. Depending on the CSP's API integration, the functionality to cancel recurring purchases can be fully custom-implemented in your App. - -```js -const assetId = '123abc' -Purchase.unsubscribe(assetId).then(() => { - // unsubscribed -}) -``` +> Starting v5.0.0 and up, the Purchase plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/tv.md b/docs/plugins/tv.md index 76f84c92..cdb16fb4 100644 --- a/docs/plugins/tv.md +++ b/docs/plugins/tv.md @@ -5,141 +5,4 @@ and program information, and allows you to change the TV channel from *inside* a One of the things you can do with the TV plugin, is adapting your App contextually to what the user is currently watching on TV. -## Usage - -If you want to use the TV plugin, import it from the Lightning SDK: - -```js -import { TV } from '@lightningjs/sdk' -``` - -## Available methods - -### channel - -Either *[retrieves](#retrieve-current-channel)* information about the TV channel that is currently being watched, or *[changes](#change-current-channel)* the current TV channel. - -#### Retrieve Current Channel - -```js -TV.channel().then(channel => console.log(channel)) -``` - -The `channel` method returns a *Promise* that returns the channel information as an object. The Promise is *rejected* if an error occurred or if the App is not allowed to retrieve the information. - -During *development*, the `channel` method returns a *random mocked channel*. Optionally, you can [overwrite](#overwriting-default-values) the default values by editing the **settings.json** file. For example: - -```json -{ - number: 1, - name: 'Metro News 1', - description: 'New York Cable News Channel', - entitled: true, -} -``` - -#### Change Current Channel - -```js -const channelNumber = 2 -TV.channel(channelNumber).then(channel => console.log(channel)) -``` - -If a `channelNumber` is passed as an argument, the `channel` method attempts to change the TV channel. -It returns a *Promise* that returns the channel information as an object. The Promise is *rejected* if an error occurred or if the App is not allowed to set the channel. - -During *development*, you can pass either 1, 2 or 3 as the `channelNumber`, so that one of the default mocked channels can be selected. - -> In a *production* setting, most Apps are *not* able to change the currently live TV channel. The functionality is only -made available to certain *whitelisted* Apps. - -### program - -Retrieves information about the TV program that is currently being watched. - -```js -TV.program().then(program => console.log(program)) -``` - -The `program` method returns a *Promise* that returns the program information as an object. - -During *development*, the `program` method returns a mocked program that is linked to a random mocked channel. Optionally, you can [overwrite](#overwriting-default-values) the default values by editing the **settings.json** file. For example: - -```json -{ - title: 'The Tonight Show Starring Jimmy Fallon', - description: 'Late-night talk show hosted by Jimmy Fallon on NBC', - startTime: 'Wed, 12 Aug 2020 23:00:00 GMT', // UTC date string - duration: 3600, // in seconds - ageRating: 10, -} -``` - -### entitled - -Indicates whether the user is entitled to watch the current TV channel or not. - -```js -TV.entitled().then(entitled => console.log(entitled)) -``` - -The `entitled` method returns a *Promise* that returns `true` if the user is entitled and `false` if not. - -During *development*, the `entitled` method returns the entitlement value of the random mocked channel. Optionally, you can [overwrite](#overwriting-default-values) the default values by editing the **settings.json** file. - -### addEventListener - -Allows you to listen for TV events and executes a callback if these events occur. - -```js -const event = 'channelChange' -const callback = (channel) => { console.log(channel) } - -TV.addEventListener(event, callback) -``` - -Currently, *only one* event is supported: `channelChange`. This passes an object with the new `channel` information as an argument to the callback function. - -You can register *multiple* callbacks for the same event. - -### removeEventListener - -Allows you to remove previously registered callbacks (via the `addEventListener` method) for TV events. - -```js -const event = 'channelChange' -const callback = (channel) => { console.log(channel) } - -TV.removeEventListener(event, callback) -``` - -If the `callback` argument is omitted, *all* previously registered callbacks for that event are removed. - -## Overwriting Default Values - -During development, you might want to test your App with different TV channels and / or programs. -You can *overwrite* the default values by editing the **settings.json** file. -Just add a `tv` key in `platformSettings` and supply it with an `Array` of channels in the following format: - -```json -{ - "platformSettings": { - "tv": [ - { - "number": 1, - "name": "Metro News 1", - "description": "New York Cable News Channel", - "entitled": true, - "program": { - "title": "The Morning Show", - "description": "New York's best morning show", - "startTime": "Wed, 12 Aug 2020 23:00:00 GMT", - "duration": 180, - "ageRating": 0 - } - }, - ... - ] - } -} -``` +> Starting v5.0.0 and up, the TV plugin is part of the metrological-sdk.

For backwards compatibility reasons, the Lightning-SDK exports this plugin provided by the metrological-sdk. The code however is maintained here. More information on how to use this plugin can be found here. diff --git a/docs/plugins/videoplayer.md b/docs/plugins/videoplayer.md index faafc479..d92c9805 100644 --- a/docs/plugins/videoplayer.md +++ b/docs/plugins/videoplayer.md @@ -9,475 +9,4 @@ The VideoPlayer plugin has a built-in integration with the [Metrics](metrics.md) > Although it is possible to implement a fully custom video playback solution, the use of the VideoPlayer plugin from the SDK is highly recommended. -## Usage - -In the Lightning components that require video playback capabilities (i.e., a Player component), you can import the -VideoPlayer plugin from the Lightning SDK: - -```js -import { VideoPlayer } from '@lightningjs/sdk' -``` - -The first time that you interact with the VideoPlayer plugin, a `