mirror of
https://github.com/jellyfin/jellyfin-tizen.git
synced 2024-11-26 23:50:24 +00:00
Add AppHost.screen function
This commit is contained in:
parent
0f3ca9b2ba
commit
e6e113f54a
@ -8,6 +8,7 @@
|
||||
<feature name="http://tizen.org/feature/screen.size.all"/>
|
||||
<icon src="icon.png"/>
|
||||
<name>Jellyfin</name>
|
||||
<tizen:privilege name="http://developer.samsung.com/privilege/productinfo"/>
|
||||
<tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"/>
|
||||
<tizen:profile name="tv"/>
|
||||
<tizen:setting screen-orientation="auto-rotation" context-menu="enable" background-support="disable" encryption="disable" install-location="auto" hwkey-event="enable"/>
|
||||
|
@ -91,6 +91,11 @@ function modifyIndex() {
|
||||
|
||||
const injectTarget = apploader.parentNode;
|
||||
|
||||
// inject webapis.js
|
||||
const webapis = this.createElement('script');
|
||||
webapis.setAttribute('src', '$WEBAPIS/webapis/webapis.js');
|
||||
injectTarget.insertBefore(webapis, apploader);
|
||||
|
||||
// inject appMode script
|
||||
var appMode = this.createElement('script');
|
||||
appMode.text = 'window.appMode=\'cordova\';';
|
||||
|
42
tizen.js
42
tizen.js
@ -45,6 +45,37 @@
|
||||
'subtitleburnsettings'
|
||||
];
|
||||
|
||||
var systeminfo;
|
||||
|
||||
function getSystemInfo() {
|
||||
if (systeminfo) {
|
||||
return Promise.resolve(systeminfo);
|
||||
}
|
||||
|
||||
return new Promise(function (resolve) {
|
||||
tizen.systeminfo.getPropertyValue('DISPLAY', function (result) {
|
||||
let devicePixelRatio = 1;
|
||||
|
||||
if (typeof webapis.productinfo.is8KPanelSupported === 'function' && webapis.productinfo.is8KPanelSupported()){
|
||||
console.log("8K UHD is supported");
|
||||
devicePixelRatio = 4;
|
||||
} else if (typeof webapis.productinfo.isUdPanelSupported === 'function' && webapis.productinfo.isUdPanelSupported()){
|
||||
console.log("4K UHD is supported");
|
||||
devicePixelRatio = 2;
|
||||
} else {
|
||||
console.log("UHD is not supported");
|
||||
}
|
||||
|
||||
systeminfo = Object.assign({}, result, {
|
||||
resolutionWidth: Math.floor(result.resolutionWidth * devicePixelRatio),
|
||||
resolutionHeight: Math.floor(result.resolutionHeight * devicePixelRatio)
|
||||
});
|
||||
|
||||
resolve(systeminfo)
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function postMessage() {
|
||||
console.log.apply(console, arguments);
|
||||
}
|
||||
@ -53,7 +84,9 @@
|
||||
AppHost: {
|
||||
init: function () {
|
||||
postMessage('AppHost.init', AppInfo);
|
||||
return Promise.resolve(AppInfo);
|
||||
return getSystemInfo().then(function () {
|
||||
return Promise.resolve(AppInfo);
|
||||
});
|
||||
},
|
||||
|
||||
appName: function () {
|
||||
@ -96,6 +129,13 @@
|
||||
return profileBuilder({ enableMkvProgressive: false });
|
||||
},
|
||||
|
||||
screen: function () {
|
||||
return systeminfo ? {
|
||||
width: systeminfo.resolutionWidth,
|
||||
height: systeminfo.resolutionHeight
|
||||
} : null;
|
||||
},
|
||||
|
||||
supports: function (command) {
|
||||
var isSupported = command && SupportedFeatures.indexOf(command.toLowerCase()) != -1;
|
||||
postMessage('AppHost.supports', {
|
||||
|
Loading…
Reference in New Issue
Block a user