Skip to content

Commit 89e135c

Browse files
Merge pull request #287 from rdkcentral/fix/render-720p
Fixed auto 720p detection
2 parents 805784b + b841f9e commit 89e135c

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/Application/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,26 @@ const fontLoader = (fonts, store) =>
8181
})
8282

8383
export default function(App, appData, platformSettings) {
84-
defaultOptions.stage['w'] = platformSettings.width ? platformSettings.width : 1920
85-
defaultOptions.stage['h'] = platformSettings.height ? platformSettings.height : 1080
86-
defaultOptions.stage['precision'] =
87-
(platformSettings.width ? platformSettings.width : 1920) / 1920
84+
const { width, height } = platformSettings
85+
86+
if (width && height) {
87+
defaultOptions.stage['w'] = width
88+
defaultOptions.stage['h'] = height
89+
defaultOptions.stage['precision'] = width / 1920
90+
}
91+
92+
// support for 720p browser
93+
if (!width && !height && window.innerHeight === 720) {
94+
defaultOptions.stage['w'] = 1280
95+
defaultOptions.stage['h'] = 720
96+
defaultOptions.stage['precision'] = 1280 / 1920
97+
}
8898

8999
return class Application extends Lightning.Application {
90100
constructor(options) {
91101
const config = Deepmerge(defaultOptions, options)
92102
// Deepmerge breaks HTMLCanvasElement, so restore the passed in canvas.
93-
if(options.stage.canvas) {
103+
if (options.stage.canvas) {
94104
config.stage.canvas = options.stage.canvas
95105
}
96106
super(config)

0 commit comments

Comments
 (0)