Skip to content

Commit 19b1588

Browse files
committed
Added support form dynamic App Size
1 parent 93c7495 commit 19b1588

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

src/Application/index.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@ const defaultOptions = {
5656
},
5757
}
5858

59-
if (window.innerHeight === 720) {
60-
defaultOptions.stage['w'] = 1280
61-
defaultOptions.stage['h'] = 720
62-
defaultOptions.stage['precision'] = 0.6666666667
63-
}
64-
6559
const customFontFaces = []
6660

6761
const fontLoader = (fonts, store) =>
@@ -87,6 +81,11 @@ const fontLoader = (fonts, store) =>
8781
})
8882

8983
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
88+
9089
return class Application extends Lightning.Application {
9190
constructor(options) {
9291
const config = Deepmerge(defaultOptions, options)

src/VideoPlayer/index.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,17 +124,23 @@ export const setupVideoTag = () => {
124124
return videoEls[0]
125125
} else {
126126
const videoEl = document.createElement('video')
127+
const platformSettingsWidth = Settings.get('platform', 'width')
128+
? Settings.get('platform', 'width')
129+
: 1920
130+
const platformSettingsHeight = Settings.get('platform', 'height')
131+
? Settings.get('platform', 'height')
132+
: 1080
127133
videoEl.setAttribute('id', 'video-player')
128-
videoEl.setAttribute('width', withPrecision(1920))
129-
videoEl.setAttribute('height', withPrecision(1080))
134+
videoEl.setAttribute('width', withPrecision(platformSettingsWidth))
135+
videoEl.setAttribute('height', withPrecision(platformSettingsHeight))
130136
videoEl.style.position = 'absolute'
131137
videoEl.style.zIndex = '1'
132138
videoEl.style.display = 'none'
133139
videoEl.style.visibility = 'hidden'
134140
videoEl.style.top = withPrecision(0)
135141
videoEl.style.left = withPrecision(0)
136-
videoEl.style.width = withPrecision(1920)
137-
videoEl.style.height = withPrecision(1080)
142+
videoEl.style.width = withPrecision(platformSettingsWidth)
143+
videoEl.style.height = withPrecision(platformSettingsHeight)
138144
document.body.appendChild(videoEl)
139145
return videoEl
140146
}

0 commit comments

Comments
 (0)