mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
nativeshell API added to apphost
This commit is contained in:
parent
8315f4a2d4
commit
c4ada25fe7
1 changed files with 50 additions and 21 deletions
|
@ -39,20 +39,26 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
return getDeviceProfileForWindowsUwp(item);
|
return getDeviceProfileForWindowsUwp(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve) {
|
||||||
require(["browserdeviceprofile"], function (profileBuilder) {
|
require(["browserdeviceprofile"], function (profileBuilder) {
|
||||||
var profile = profileBuilder(getBaseProfileOptions(item));
|
var profile;
|
||||||
|
|
||||||
if (item && !options.isRetry && "allcomplexformats" !== appSettings.get("subtitleburnin")) {
|
if (window.NativeShell) {
|
||||||
if (!browser.orsay && !browser.tizen) {
|
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
||||||
profile.SubtitleProfiles.push({
|
} else {
|
||||||
Format: "ass",
|
profile = profileBuilder(getBaseProfileOptions(item));
|
||||||
Method: "External"
|
|
||||||
});
|
if (item && !options.isRetry && "allcomplexformats" !== appSettings.get("subtitleburnin")) {
|
||||||
profile.SubtitleProfiles.push({
|
if (!browser.orsay && !browser.tizen) {
|
||||||
Format: "ssa",
|
profile.SubtitleProfiles.push({
|
||||||
Method: "External"
|
Format: "ass",
|
||||||
});
|
Method: "External"
|
||||||
|
});
|
||||||
|
profile.SubtitleProfiles.push({
|
||||||
|
Format: "ssa",
|
||||||
|
Method: "External"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,10 +139,17 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSyncProfile() {
|
function getSyncProfile() {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve) {
|
||||||
require(["browserdeviceprofile", "appSettings"], function (profileBuilder, appSettings) {
|
require(["browserdeviceprofile", "appSettings"], function (profileBuilder, appSettings) {
|
||||||
var profile = profileBuilder();
|
var profile;
|
||||||
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
|
||||||
|
if (window.NativeShell) {
|
||||||
|
profile = window.NativeShell.AppHost.getSyncProfile(profileBuilder, appSettings);
|
||||||
|
} else {
|
||||||
|
profile = profileBuilder();
|
||||||
|
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
||||||
|
}
|
||||||
|
|
||||||
resolve(profile);
|
resolve(profile);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -308,7 +321,9 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
alert("setWindowState is not supported and should not be called");
|
alert("setWindowState is not supported and should not be called");
|
||||||
},
|
},
|
||||||
exit: function () {
|
exit: function () {
|
||||||
if (browser.tizen) {
|
if (window.NativeShell) {
|
||||||
|
window.NativeShell.AppHost.exit();
|
||||||
|
} else if (browser.tizen) {
|
||||||
try {
|
try {
|
||||||
tizen.application.getCurrentApplication().exit();
|
tizen.application.getCurrentApplication().exit();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -319,30 +334,44 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
supports: function (command) {
|
supports: function (command) {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.supports(command);
|
||||||
|
}
|
||||||
|
|
||||||
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
|
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
|
||||||
},
|
},
|
||||||
preferVisualCards: browser.android || browser.chrome,
|
preferVisualCards: browser.android || browser.chrome,
|
||||||
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
|
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
|
||||||
getSyncProfile: getSyncProfile,
|
getSyncProfile: getSyncProfile,
|
||||||
getDefaultLayout: getDefaultLayout,
|
getDefaultLayout: function () {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.getDefaultLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDefaultLayout()
|
||||||
|
},
|
||||||
getDeviceProfile: getDeviceProfile,
|
getDeviceProfile: getDeviceProfile,
|
||||||
init: function () {
|
init: function () {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.init();
|
||||||
|
}
|
||||||
|
|
||||||
deviceName = getDeviceName();
|
deviceName = getDeviceName();
|
||||||
return getDeviceId().then(function (resolvedDeviceId) {
|
return getDeviceId().then(function (resolvedDeviceId) {
|
||||||
deviceId = resolvedDeviceId;
|
deviceId = resolvedDeviceId;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deviceName: function () {
|
deviceName: function () {
|
||||||
return deviceName;
|
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : deviceName;
|
||||||
},
|
},
|
||||||
deviceId: function () {
|
deviceId: function () {
|
||||||
return deviceId;
|
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : deviceId;
|
||||||
},
|
},
|
||||||
appName: function () {
|
appName: function () {
|
||||||
return "Jellyfin Web";
|
return window.NativeShell ? window.NativeShell.AppHost.appName() : "Jellyfin Web";
|
||||||
},
|
},
|
||||||
appVersion: function () {
|
appVersion: function () {
|
||||||
return appVersion;
|
return window.NativeShell ? window.NativeShell.AppHost.appVersion() : appVersion;
|
||||||
},
|
},
|
||||||
getPushTokenInfo: function () {
|
getPushTokenInfo: function () {
|
||||||
return {};
|
return {};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue