diff --git a/config.xml b/config.xml
index 663a08a..7d0a89e 100644
--- a/config.xml
+++ b/config.xml
@@ -8,6 +8,7 @@
Jellyfin
+
diff --git a/gulpfile.js b/gulpfile.js
index 88aa453..81bfebf 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -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\';';
diff --git a/tizen.js b/tizen.js
index 35768b7..6d20eff 100644
--- a/tizen.js
+++ b/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', {