Skip to content

Commit 6d32542

Browse files
Merge pull request #373 from rdkcentral/release/5.3.0
Release - v5.3.0
2 parents 2b0d10e + 246e700 commit 6d32542

File tree

22 files changed

+677
-58
lines changed

22 files changed

+677
-58
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v5.3.0
4+
*16 feb 2023*
5+
6+
- Added Subtitles plugin
7+
- Added support for overriding the key mappping at runtime (i.e. after the App is launched) (#276)
8+
- Added support for an optional path at the end of router paths (#362)
9+
- Added support for plugins to load local JSON files (#360)
10+
- Fixed a bug related to the Router plugin which results in not setting previous state when "on" data provider is used (#365)
11+
- Fixed incorrect positioning of the version label (#359)
12+
- Updated `@metrological/sdk` and `localCookie` NPM package paths
13+
- Fixed the Router plugin documentation regarding `backtrack` feature (#375)
14+
315
## v5.2.0
416

517
*20 oct 2022*

docs/_sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Plugins
44
- [Accessibility](/plugins/accessibility.md)
5+
- [App](/plugins/app.md)
56
- [Utils](/plugins/utils.md)
67
- [Storage](/plugins/storage.md)
78
- [Settings](/plugins/settings.md)

docs/changelog.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v5.3.0
4+
*16 feb 2023*
5+
6+
- Added Subtitles plugin
7+
- Added support for overriding the key mappping at runtime (i.e. after the App is launched) (#276)
8+
- Added support for an optional path at the end of router paths (#362)
9+
- Added support for plugins to load local JSON files (#360)
10+
- Fixed a bug related to the Router plugin which results in not setting previous state when "on" data provider is used (#365)
11+
- Fixed incorrect positioning of the version label (#359)
12+
- Updated `@metrological/sdk` and `localCookie` NPM package paths
13+
- Fixed the Router plugin documentation regarding `backtrack` feature (#375)
14+
315
## v5.2.0
416

517
*20 oct 2022*

docs/plugins/app.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# App
2+
3+
SDK provides various methods that can be used within the application.
4+
5+
## Available Methods
6+
7+
### overrideKeyMap
8+
9+
This method can be used to merge and override the existing keymap (coming from `settings.json`) by using a custom keymap in runtime. The method will merge all key mappings by overriding the existing key mappings with the new ones when a key is defined in both keymaps.
10+
11+
`keepDuplicates` flag is set to `false` by default, which means duplicated values (like two different keys trigger the `Back` action) will be removed from the final keymap. If `keepDuplicates` is set to `true`, duplicated **values** will be kept in the final keymap.
12+
13+
#### Usage
14+
15+
```js
16+
const customKeyMap = {
17+
13: "Enter",
18+
83: "Search"
19+
}
20+
21+
this.application.overrideKeyMap(customKeyMap) // keepDuplicates = false
22+
```
23+
24+
or
25+
26+
```js
27+
this.application.overrideKeyMap(customKeyMap, true) // keepDuplicates = true
28+
```
29+
30+
#### Parameters
31+
32+
- `customKeyMap` : keymap object
33+
- `keepDuplicates`: flag to keep duplicated values in the final keymap or not. The default value is `false`.

docs/plugins/router/deeplinking.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Deeplinking is an important feature, because:
99
* Regular data providing for a specific route is still executed.
1010
* The configuration object's [boot](configuration.md#boot) key handles any general operations to be executed for a proper functioning of your App.
1111

12-
## Backtracking
12+
## Backtrack
1313

1414
When a user enters your App via a deeplink, there is technically *no* history available. By default, this would mean that a **Back** key press leads to exiting the App.
1515

16-
On some platforms, this is not the desired behavior. For that reason, the Router plugin supports the *[backtracking](settings.md#backtracking)* functionality.
16+
On some platforms, this is not the desired behavior. For that reason, the Router plugin supports the *[backtrack](settings.md#backtrack)* functionality.
1717

18-
When this feature is enabled (via the Platform Setting `Router.backtracking`) and the **Back** key is pressed, the Router will *recursively* remove the last part of the hash, until it finds a valid path to navigate to.
18+
When this feature is enabled (via the Platform Setting `Router.backtrack`) and the **Back** key is pressed, the Router will *recursively* remove the last part of the hash, until it finds a valid path to navigate to.
1919

2020
#### NEXT:
2121
[History](history.md)

docs/plugins/router/navigation.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,46 @@ Router.navigate({
9696

9797
This results in: `#player/12/44`
9898

99+
## Optional router path
100+
101+
There might be some cases in which you need a route path with an optional parameter at the end. Normally, you would have to define two different routes to the same component, one with the optional parameter and one without. Starting with Lightning-SDK `v5.3.0`, you can specify an optional router path parameter by adding a `?` suffix to the last parameter name.
102+
103+
Please note that only the last parameter of any path is allowed to be an optional parameter. For example, if you have a route path with three parameters, you can make only the last parameter optional, but not the second parameter.
104+
105+
When we define an optional parameter like this:
106+
```js
107+
{
108+
path: 'player/:assetId/:playlistId?',
109+
component: Player
110+
name: 'player'
111+
}
112+
```
113+
114+
This will generate two paths internally as below:
115+
116+
```js
117+
{
118+
path: 'player/:assetId/:playlistId'
119+
component: Player
120+
name: 'player'
121+
}
122+
{
123+
path: 'player/:assetId',
124+
component: Player,
125+
name: 'player'
126+
}
127+
```
128+
129+
The following example would *not* work because only the last parameter of the path can be optional:
130+
131+
```js
132+
{
133+
path: 'player/:assetId?/:playlistId',
134+
component: Player
135+
name: 'player'
136+
}
137+
```
138+
99139

100140
## isNavigating Method
101141

docs/plugins/router/settings.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For example:
1818
"lazyCreate": true,
1919
"lazyDestroy": true,
2020
"gcOnUnload": true,
21-
"backtracking": true,
21+
"backtrack": true,
2222
"reuseInstance": false,
2323
"destroyOnHistoryBack": false
2424
}
@@ -44,9 +44,9 @@ By default, Lazy Destroy is *disabled*. This results in faster navigating back t
4444

4545
If you want to free up texture memory *directly* after a previous page has been destroyed and you do not want to wait for Lightning's (texture) garbage collection, you can set `gcOnUnload` to `true`. This forces a texture garbage collect directly after destroying the page.
4646

47-
### backtracking
47+
### backtrack
4848

49-
If you want to enable *backtracking* in your app, you set `backtracking` to `true`.
49+
If you want to enable *backtracking* in your app, you set `backtrack` to `true`.
5050

5151
### destroyOnHistoryBack
5252

docs/plugins/subtitles.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Subtitles
2+
3+
You can use the *Subtitles* plugin to easily display Subtitles (or Closed Captions) in your App.
4+
5+
The plugin comes with some basic styling of Subtitles and offers the option to customize them, such as font size, colors, and positioning.
6+
7+
> The Subtitles plugins in the Lightning-SDK only offers an API for displaying Subtitles.
8+
9+
> Retrieving subtitles from a video stream or a remote API is not part of the Plugin's functionality as it's very App and / or Platform specific.
10+
11+
## Usage
12+
13+
If you want to display Subtitles in your App, first import the Subtitles plugin from the Lightning SDK:
14+
15+
```js
16+
import { Subtitles } from '@lightningjs/sdk'
17+
```
18+
19+
## Available Methods
20+
21+
### show
22+
23+
Sets the visibility of Subtitles to `true`, to display Subtitles.
24+
25+
```js
26+
Subtitles.show()
27+
```
28+
29+
### hide
30+
31+
Sets the visibility of Subtitles to `false`, to hide Subtitles.
32+
33+
```js
34+
Subtitles.hide()
35+
```
36+
37+
### text
38+
39+
Sets the text of the Subtitles text.
40+
41+
```js
42+
Subtitles.text('Subtitle Text')
43+
```
44+
45+
### clear
46+
47+
Clears the text of the Subtitles text.
48+
49+
```js
50+
Subtitles.clear()
51+
```
52+
53+
### styles
54+
55+
Sets the styles of the Subtitles text. This is a short hand method for setting the following styles: `fontFamily`, `fontSize`, `fontColor`, `backgroundColor`, `textAlign`. If any of these styles are not set, the default values will be used.
56+
57+
```js
58+
Subtitles.styles({
59+
fontFamily: 'sans-serif',
60+
fontSize: 45,
61+
fontColor: 0xffffffff,
62+
backgroundColor: 0x90000000,
63+
textAlign: 'center',
64+
})
65+
```
66+
### fontFamily
67+
68+
Sets the `fontFamily` style of the Subtitles text.
69+
70+
```js
71+
Subtitles.fontFamily('sans-serif')
72+
```
73+
74+
### fontSize
75+
76+
Sets the `fontSize` style of the Subtitles text.
77+
78+
```js
79+
Subtitles.fontSize(50)
80+
```
81+
82+
### fontColor
83+
84+
Sets the `fontColor` style of the Subtitles text
85+
86+
```js
87+
Subtitles.fontColor(0xffffffff)
88+
```
89+
90+
### backgroundColor
91+
92+
Sets the `backgroundColor` style of the Subtitles text
93+
94+
```js
95+
Subtitles.backgroundColor(0x90000000)
96+
```
97+
98+
### textAlign
99+
100+
Sets the `textAlign` style of the Subtitles text
101+
102+
```js
103+
Subtitles.textAlign('center')
104+
```
105+
106+
### position
107+
108+
Sets the x and y positions of the Subtitles text.
109+
110+
`x` value must be either a number or one of the following options: `'left'`, `'center'`, `'right'`. The default value for `x` is `'center'`.
111+
112+
`y` value must be either a number or one of the following options: `'top'`, `'center'`, `'bottom'`. The default value for `y` is 'bottom'.
113+
114+
```js
115+
Subtitles.position('center', 'top')
116+
Subtitles.position(100, 100)
117+
```
118+
119+
### viewport
120+
121+
Sets the width and height for the viewport of the Subtitles text. The viewport is the area in which the Subtitles text will be displayed. By default, Subtitles assumes the viewport is the same size as the App. If your video player is smaller, you can set the viewport to match the size of the video player to correctly position the Subtitles text.
122+
123+
The first argument is the width of the viewport, the second argument is the height of the viewport.
124+
125+
126+
```js
127+
Subtitles.viewport(854, 480)
128+
```
129+
130+
### maxWidth
131+
132+
Sets the maximum width of the Subtitles text.
133+
134+
```js
135+
Subtitles.maxWidth(1200)
136+
```
137+
138+
### maxLines
139+
140+
Sets the maximum number of lines for the Subtitles text.
141+
142+
```js
143+
Subtitles.maxLines(2)
144+
```

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ export { default as TV } from './src/TV'
4343
export { default as Utils } from './src/Utils'
4444
export { default as VideoPlayer } from './src/VideoPlayer'
4545
export { default as Metadata } from './src/Metadata'
46+
export { default as Subtitles } from './src/Subtitles'

0 commit comments

Comments
 (0)