1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

adjust startup sequences

This commit is contained in:
Luke Pulverenti 2015-05-02 12:34:27 -04:00
parent 0a225d099d
commit e2ebee7c31
7 changed files with 193 additions and 142 deletions

View file

@ -141,7 +141,7 @@ input[type="range"]::-ms-fill-upper {
margin-bottom: 0; margin-bottom: 0;
} }
.nowPlayingBar .mediaButton:not(.playButton):not(.pauseButton):not(.remoteControlButton) { .nowPlayingBar .mediaButton:not(.unpauseButton):not(.pauseButton):not(.remoteControlButton) {
display: none; display: none;
} }
@ -149,7 +149,7 @@ input[type="range"]::-ms-fill-upper {
float: right; float: right;
} }
.nowPlayingBar .playButton, .nowPlayingBar .pauseButton { .nowPlayingBar .unpauseButton, .nowPlayingBar .pauseButton {
float: right; float: right;
} }

View file

@ -591,7 +591,7 @@
var clientLowered = connection.Client.toLowerCase(); var clientLowered = connection.Client.toLowerCase();
if (clientLowered == "dashboard" || clientLowered == "emby web client") { if (clientLowered == "dashboard" || clientLowered == "emby web client" || clientLowered == "emby mobile") {
var device = connection.DeviceName.toLowerCase(); var device = connection.DeviceName.toLowerCase();

View file

@ -4,7 +4,7 @@
var html = '<div class="viewMenuBar ui-bar-b">'; var html = '<div class="viewMenuBar ui-bar-b">';
if ($.browser.safari && $.browser.mobile && window.navigator.standalone) { if (($.browser.safari && $.browser.mobile && window.navigator.standalone) || Dashboard.isRunningInCordova()) {
html += '<a data-rel="back" data-role="none" href="#" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-circle-o-left"></div></a>'; html += '<a data-rel="back" data-role="none" href="#" class="headerButton headerButtonLeft headerBackButton"><div class="fa fa-arrow-circle-o-left"></div></a>';
} }
@ -253,38 +253,47 @@
html += '<div class="sidebarLinks librarySidebarLinks">'; html += '<div class="sidebarLinks librarySidebarLinks">';
//var userHref = user.localUser && user.localUser.Policy.EnableUserPreferenceAccess ? var showUserAtTop = $.browser.mobile;
// 'mypreferencesdisplay.html?userId=' + user.localUser.Id :
// (user.localUser ? 'index.html' : '#');
//var paddingLeft = user.imageUrl ? 'padding-left:.7em;' : ''; if (showUserAtTop) {
//html += '<a style="margin-top:0;' + paddingLeft + 'display:block;color:#fff;text-decoration:none;font-size:16px;font-weight:400!important;background: #000;" href="' + userHref + '">';
//var imgWidth = 44; var userHref = user.localUser && user.localUser.Policy.EnableUserPreferenceAccess ?
'mypreferencesdisplay.html?userId=' + user.localUser.Id :
(user.localUser ? 'index.html' : '#');
//if (user.imageUrl) { var paddingLeft = user.imageUrl ? 'padding-left:.7em;' : '';
// var url = user.imageUrl; html += '<a style="margin-top:0;' + paddingLeft + 'display:block;color:#fff;text-decoration:none;font-size:16px;font-weight:400!important;background: #000;" href="' + userHref + '">';
// if (user.supportsImageParams) { var imgWidth = 44;
// url += "&width=" + (imgWidth * Math.max(devicePixelRatio || 1, 2));
// }
// html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.8em;border-radius: 50px;" src="' + url + '" />'; if (user.imageUrl) {
//} else { var url = user.imageUrl;
// html += '<span class="fa fa-user sidebarLinkIcon"></span>';
//}
//html += user.name; if (user.supportsImageParams) {
//html += '</a>'; url += "&width=" + (imgWidth * Math.max(devicePixelRatio || 1, 2));
}
html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.8em;border-radius: 50px;" src="' + url + '" />';
} else {
html += '<span class="fa fa-user sidebarLinkIcon"></span>';
}
html += user.name;
html += '</a>';
}
var homeHref = ConnectionManager.currentApiClient() ? 'index.html' : 'selectserver.html'; var homeHref = ConnectionManager.currentApiClient() ? 'index.html' : 'selectserver.html';
html += '<a class="lnkMediaFolder sidebarLink" style="margin-top:.5em;padding-left:1em;display:block;color:#fff;text-decoration:none;" href="' + homeHref + '">'; if (showUserAtTop) {
html += '<a class="lnkMediaFolder sidebarLink" href="' + homeHref + '"><span class="fa fa-home sidebarLinkIcon"></span><span>' + Globalize.translate('ButtonHome') + '</span></a>';
} else {
html += '<a class="lnkMediaFolder sidebarLink" style="margin-top:.5em;padding-left:1em;display:block;color:#fff;text-decoration:none;" href="' + homeHref + '">';
html += '<img style="max-width:36px;vertical-align:middle;margin-right:1em;" src="css/images/mblogoicon.png" />'; html += '<img style="max-width:36px;vertical-align:middle;margin-right:1em;" src="css/images/mblogoicon.png" />';
html += Globalize.translate('ButtonHome'); html += Globalize.translate('ButtonHome');
html += '</a>'; html += '</a>';
}
html += '<div class="libraryMenuDivider" style="margin-top:0;"></div>'; html += '<div class="libraryMenuDivider" style="margin-top:0;"></div>';

View file

@ -910,6 +910,10 @@
self.canAutoPlayVideo = function () { self.canAutoPlayVideo = function () {
if (Dashboard.isRunningInCordova()) {
return true;
}
if ($.browser.msie || $.browser.mobile) { if ($.browser.msie || $.browser.mobile) {
return false; return false;
} }
@ -917,6 +921,11 @@
return true; return true;
}; };
self.enableCustomVideoControls = function () {
return self.canAutoPlayVideo() && !$.browser.mobile;
};
// Replace audio version // Replace audio version
self.cleanup = function (playerElement) { self.cleanup = function (playerElement) {
@ -996,7 +1005,7 @@
// Create video player // Create video player
var html = ''; var html = '';
var requiresNativeControls = !self.canAutoPlayVideo(); var requiresNativeControls = !self.enableCustomVideoControls();
// Can't autoplay in these browsers so we need to use the full controls // Can't autoplay in these browsers so we need to use the full controls
if (requiresNativeControls) { if (requiresNativeControls) {
@ -1202,7 +1211,7 @@
self.updatePlaylistUi = function () { self.updatePlaylistUi = function () {
var index = self.currentPlaylistIndex(null), var index = self.currentPlaylistIndex(null),
length = self.playlist.length, length = self.playlist.length,
requiresNativeControls = !self.canAutoPlayVideo(), requiresNativeControls = !self.enableCustomVideoControls(),
controls = $(requiresNativeControls ? '.videoAdvancedControls' : '.videoControls'); controls = $(requiresNativeControls ? '.videoAdvancedControls' : '.videoControls');
if (length < 2) { if (length < 2) {

View file

@ -126,7 +126,7 @@
profile.DirectPlayProfiles = []; profile.DirectPlayProfiles = [];
profile.DirectPlayProfiles.push({ profile.DirectPlayProfiles.push({
Container: 'mp4', Container: 'mp4,m4v',
Type: 'Video', Type: 'Video',
VideoCodec: 'h264', VideoCodec: 'h264',
AudioCodec: 'aac,mp3' AudioCodec: 'aac,mp3'
@ -134,7 +134,7 @@
if ($.browser.chrome) { if ($.browser.chrome) {
profile.DirectPlayProfiles.push({ profile.DirectPlayProfiles.push({
Container: 'mkv,m4v', Container: 'mkv',
Type: 'Video', Type: 'Video',
VideoCodec: 'h264', VideoCodec: 'h264',
AudioCodec: 'aac,mp3' AudioCodec: 'aac,mp3'
@ -311,6 +311,14 @@
}); });
} }
profile.ResponseProfiles = [];
profile.ResponseProfiles.push({
Type: 'Video',
Container: 'm4v',
MimeType: 'video/mp4'
});
return profile; return profile;
}; };
@ -1589,6 +1597,10 @@
self.canAutoPlayAudio = function () { self.canAutoPlayAudio = function () {
if (Dashboard.isRunningInCordova()) {
return true;
}
if ($.browser.android || ($.browser.webkit && !$.browser.chrome)) { if ($.browser.android || ($.browser.webkit && !$.browser.chrome)) {
return false; return false;
} }

View file

@ -43,8 +43,8 @@ var Dashboard = {
}, },
isRunningInCordova: function () { isRunningInCordova: function () {
var isCordovaApp = !!window.cordova;
return isCordovaApp; return window.appMode == 'cordova';
}, },
onRequestFail: function (e, data) { onRequestFail: function (e, data) {
@ -187,6 +187,10 @@ var Dashboard = {
isConnectMode: function () { isConnectMode: function () {
if (Dashboard.isRunningInCordova()) {
return true;
}
var url = getWindowUrl().toLowerCase(); var url = getWindowUrl().toLowerCase();
return url.indexOf('mediabrowser.tv') != -1 || return url.indexOf('mediabrowser.tv') != -1 ||
@ -472,7 +476,8 @@ var Dashboard = {
return; return;
} }
if (Dashboard.isRunningInCordova()) { // Cordova
if (navigator.notification && navigator.notification.alert && options.message.indexOf('<') == -1) {
navigator.notification.alert(options.message, options.callback || function () { }, options.title || Globalize.translate('HeaderAlert')); navigator.notification.alert(options.message, options.callback || function () { }, options.title || Globalize.translate('HeaderAlert'));
@ -483,17 +488,16 @@ var Dashboard = {
confirm: function (message, title, callback) { confirm: function (message, title, callback) {
if (Dashboard.isRunningInCordova()) { // Cordova
if (navigator.notification && navigator.notification.alert && message.indexOf('<') == -1) {
navigator.notification.alert(options.message, options.callback || function () { }, options.title || Globalize.translate('HeaderAlert'));
var buttonLabels = [Globalize.translate('ButtonOk'), Globalize.translate('ButtonCancel')]; var buttonLabels = [Globalize.translate('ButtonOk'), Globalize.translate('ButtonCancel')];
navigator.notification.confirm(options.message, function (index) { navigator.notification.confirm(message, function (index) {
options.callback(index == 1); callback(index == 1);
}, options.title || Globalize.translate('HeaderAlert'), buttonLabels.join(',')); }, title || Globalize.translate('HeaderAlert'), buttonLabels.join(','));
} else { } else {
Dashboard.confirmInternal(message, title, true, callback); Dashboard.confirmInternal(message, title, true, callback);
@ -1311,47 +1315,95 @@ var Dashboard = {
PlayableMediaTypes: "Audio,Video", PlayableMediaTypes: "Audio,Video",
SupportedCommands: Dashboard.getSupportedRemoteCommands().join(','), SupportedCommands: Dashboard.getSupportedRemoteCommands().join(','),
SupportsPersistentIdentifier: false, SupportsPersistentIdentifier: Dashboard.isRunningInCordova(),
SupportsMediaControl: true, SupportsMediaControl: true,
SupportedLiveMediaTypes: ['Audio', 'Video'] SupportedLiveMediaTypes: ['Audio', 'Video']
}; };
},
getDefaultImageQuality: function (imageType) {
var quality = 90;
var isBackdrop = imageType.toLowerCase() == 'backdrop';
if (isBackdrop) {
quality -= 10;
}
if ($.browser.safari && $.browser.mobile) {
quality -= 10;
if (isBackdrop) {
quality -= 10;
}
}
return quality;
},
getAppInfo: function () {
function generateDeviceName() {
var name = "Web Browser";
if ($.browser.chrome) {
name = "Chrome";
} else if ($.browser.safari) {
name = "Safari";
} else if ($.browser.webkit) {
name = "WebKit";
} else if ($.browser.msie) {
name = "Internet Explorer";
} else if ($.browser.opera) {
name = "Opera";
} else if ($.browser.firefox || $.browser.mozilla) {
name = "Firefox";
}
if ($.browser.version) {
name += " " + $.browser.version;
}
if ($.browser.ipad) {
name += " Ipad";
} else if ($.browser.iphone) {
name += " Iphone";
} else if ($.browser.android) {
name += " Android";
}
return name;
}
var appVersion = window.dashboardVersion;
var appName = "Emby Mobile";
var deviceName;
var deviceId;
// Cordova
if (window.device) {
deviceName = device.model;
deviceId = device.uuid;
} else {
deviceName = generateDeviceName();
deviceId = MediaBrowser.generateDeviceId();
}
return {
appName: appName,
appVersion: appVersion,
deviceName: deviceName,
deviceId: deviceId
};
} }
}; };
(function () { (function () {
function generateDeviceName() {
var name = "Web Browser";
if ($.browser.chrome) {
name = "Chrome";
} else if ($.browser.safari) {
name = "Safari";
} else if ($.browser.webkit) {
name = "WebKit";
} else if ($.browser.msie) {
name = "Internet Explorer";
} else if ($.browser.opera) {
name = "Opera";
} else if ($.browser.firefox || $.browser.mozilla) {
name = "Firefox";
}
if ($.browser.version) {
name += " " + $.browser.version;
}
if ($.browser.ipad) {
name += " Ipad";
} else if ($.browser.iphone) {
name += " Iphone";
} else if ($.browser.android) {
name += " Android";
}
return name;
}
if (!window.WebSocket) { if (!window.WebSocket) {
alert(Globalize.translate('MessageBrowserDoesNotSupportWebSockets')); alert(Globalize.translate('MessageBrowserDoesNotSupportWebSockets'));
@ -1365,95 +1417,59 @@ var Dashboard = {
.on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged); .on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged);
} }
var appVersion = window.dashboardVersion; function createConnectionManager() {
var appName;
var deviceName;
var deviceId;
if (Dashboard.isRunningInCordova()) { var appInfo = Dashboard.getAppInfo();
appName = "Emby Mobile"; var credentialProvider = new MediaBrowser.CredentialProvider();
deviceName = device.model;
deviceId = device.uuid;
} else { var capabilities = Dashboard.capabilities();
appName = "Emby Web Client"; window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
deviceName = generateDeviceName();
deviceId = MediaBrowser.generateDeviceId();
}
var credentialProvider = new MediaBrowser.CredentialProvider(); if (Dashboard.isConnectMode()) {
var capabilities = Dashboard.capabilities(); $(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appName, appVersion, deviceName, deviceId, capabilities); initializeApiClient(apiClient);
});
if (Dashboard.isConnectMode()) { if (!Dashboard.isServerlessPage()) {
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) { if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken()) {
initializeApiClient(apiClient); window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
});
if (!Dashboard.isServerlessPage()) { ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken()) { initializeApiClient(ApiClient);
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appName, appVersion, deviceName, deviceId); ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
} else {
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken()); Dashboard.logout();
return;
initializeApiClient(ApiClient);
ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
} else {
Dashboard.logout();
return;
}
}
} else {
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appName, appVersion, deviceName, deviceId);
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
initializeApiClient(ApiClient);
ConnectionManager.addApiClient(ApiClient);
}
if (window.ApiClient) {
Dashboard.importCss(ApiClient.getUrl('Branding/Css'));
ApiClient.getDefaultImageQuality = function (imageType) {
var quality = 90;
var isBackdrop = imageType.toLowerCase() == 'backdrop';
if (isBackdrop) {
quality -= 10;
}
if ($.browser.safari && $.browser.mobile) {
quality -= 10;
if (isBackdrop) {
quality -= 10;
} }
} }
return quality; } else {
};
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
initializeApiClient(ApiClient);
ConnectionManager.addApiClient(ApiClient);
}
if (window.ApiClient) {
Dashboard.importCss(ApiClient.getUrl('Branding/Css'));
ApiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;
}
} }
})();
(function () {
function onReady() { function onReady() {
var videoPlayerHtml = '<div id="mediaPlayer" data-theme="b" class="ui-bar-b" style="display: none;">'; var videoPlayerHtml = '<div id="mediaPlayer" data-theme="b" class="ui-bar-b" style="display: none;">';
@ -1572,6 +1588,8 @@ var Dashboard = {
if (Dashboard.isRunningInCordova()) { if (Dashboard.isRunningInCordova()) {
createConnectionManager();
document.addEventListener("deviceready", function () { document.addEventListener("deviceready", function () {
$(onReady); $(onReady);
@ -1579,6 +1597,9 @@ var Dashboard = {
}, false); }, false);
} else { } else {
createConnectionManager();
$(onReady); $(onReady);
} }
})(); })();

View file

@ -62,7 +62,7 @@
$.fn.lazyChildren = function () { $.fn.lazyChildren = function () {
$(".lazy", this).unveil(200); $(".lazy", this).unveil(300);
return this; return this;
}; };