mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
update script loading
This commit is contained in:
parent
463ad6cfb1
commit
bbdbdf346e
@ -4,7 +4,7 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="channelItemsPage" data-role="page" class="page libraryPage channelsPage" data-contextname="${HeaderChannels}">
|
||||
<div id="channelItemsPage" data-role="page" class="page libraryPage channelsPage" data-contextname="${HeaderChannels}" data-require="scripts/channelitems">
|
||||
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="channelslatest.html" class="latestChannelItemsTab">${TabLatest}</a>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="channelsLatestPage" data-role="page" class="page libraryPage channelsPage" data-contextname="${HeaderChannels}">
|
||||
<div id="channelsLatestPage" data-role="page" class="page libraryPage channelsPage" data-contextname="${HeaderChannels}" data-require="scripts/channelslatest">
|
||||
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="#" class="ui-btn-active latestChannelItemsTab">${TabLatest}</a>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>${TitleSignIn}</title>
|
||||
</head>
|
||||
<body class="serverlessPage">
|
||||
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage" data-theme="b">
|
||||
<div id="connectLoginPage" data-role="page" class="page standalonePage connectLoginPage" data-theme="b" data-require="scripts/connectlogin">
|
||||
|
||||
<div data-role="content">
|
||||
|
||||
@ -97,11 +97,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('.connectLoginForm').off('submit', ConnectLoginPage.onSubmit).on('submit', ConnectLoginPage.onSubmit);
|
||||
$('.manualServerForm').off('submit', ConnectLoginPage.onManualServerSubmit).on('submit', ConnectLoginPage.onManualServerSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,51 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
|
||||
<meta http-equiv="X-UA-Compatibility" content="IE=Edge">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="msapplication-tap-highlight" content="no">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="application-name" content="Emby">
|
||||
<meta name="robots" content="noindex, nofollow, noarchive" />
|
||||
<link rel="apple-touch-icon" href="css/images/touchicon.png" />
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="css/images/touchicon72.png" />
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="css/images/touchicon114.png" />
|
||||
<link rel="apple-touch-startup-image" href="css/images/iossplash.png" />
|
||||
<link rel="shortcut icon" href="css/images/favicon.ico" />
|
||||
<script src="cordova.js"></script>
|
||||
<title>Emby</title>
|
||||
<style>
|
||||
body, html {
|
||||
background: #222;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
document.addEventListener("deviceready", function () {
|
||||
|
||||
function setDeviceId(deviceId) {
|
||||
|
||||
localStorage.setItem('cordovaDeviceName', device.model);
|
||||
localStorage.setItem('cordovaDeviceId', deviceId);
|
||||
|
||||
window.location.replace('index.html');
|
||||
}
|
||||
|
||||
window.plugins.uniqueDeviceID.get(function (uuid) {
|
||||
|
||||
setDeviceId(uuid);
|
||||
|
||||
}, function () {
|
||||
|
||||
// Failure. Use cordova uuid
|
||||
setDeviceId(device.uuid);
|
||||
});
|
||||
|
||||
}, false);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1465,10 +1465,6 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.homeLatestTabDisabled .homeLatestTab {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.movieTrailersTabDisabled .movieTrailersTab {
|
||||
display: none !important;
|
||||
}
|
||||
|
@ -4,13 +4,13 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="favoritesPage" data-role="page" class="page type-home libraryPage allLibraryPage backdropPage" data-backdroptype="movie,series,game,book">
|
||||
<div id="favoritesPage" data-role="page" class="page type-home libraryPage allLibraryPage backdropPage" data-backdroptype="movie,series,game,book" data-require="scripts/favorites">
|
||||
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="index.html">${TabHome}</a>
|
||||
<a href="homelatest.html" class="homeLatestTab">${TabLatest}</a>
|
||||
<a href="homelatest.html">${TabLatest}</a>
|
||||
<a href="tvrecommended.html">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="ui-btn-active homeFavoritesTab">${TabFavorites}</a>
|
||||
<a href="favorites.html" class="ui-btn-active">${TabFavorites}</a>
|
||||
<a href="tvupcoming.html">${TabUpcoming}</a>
|
||||
</div>
|
||||
|
||||
|
@ -4,13 +4,13 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="homeLatestPage" data-role="page" class="page type-home libraryPage allLibraryPage backdropPage" data-backdroptype="movie,series,game,book">
|
||||
<div id="homeLatestPage" data-role="page" class="page type-home libraryPage allLibraryPage backdropPage" data-backdroptype="movie,series,game,book" data-require="scripts/homelatest">
|
||||
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="index.html">${TabHome}</a>
|
||||
<a href="#" class="ui-btn-active">${TabLatest}</a>
|
||||
<a href="tvrecommended.html">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="homeFavoritesTab">${TabFavorites}</a>
|
||||
<a href="favorites.html">${TabFavorites}</a>
|
||||
<a href="tvupcoming.html">${TabUpcoming}</a>
|
||||
</div>
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="#" class="ui-btn-active">${TabHome}</a>
|
||||
<a href="homelatest.html" class="homeLatestTab">${TabLatest}</a>
|
||||
<a href="homelatest.html">${TabLatest}</a>
|
||||
<a href="tvrecommended.html">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="homeFavoritesTab">${TabFavorites}</a>
|
||||
<a href="favorites.html">${TabFavorites}</a>
|
||||
<a href="tvupcoming.html">${TabUpcoming}</a>
|
||||
</div>
|
||||
|
||||
@ -28,23 +28,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div data-role="popup" class="popupConfigureViews" data-overlay-theme="b" data-theme="a" data-dismissible="false" data-positionto="window">
|
||||
<div class="ui-bar-a" style="text-align: center; padding: 0 20px; position: relative;">
|
||||
|
||||
<h3 class="identificationHeader">${HeaderMyPreferences}</h3>
|
||||
</div>
|
||||
|
||||
<div data-role="content" style="max-width:600px;">
|
||||
|
||||
<h1>${HeaderWelcomeExclamation}</h1>
|
||||
<p>${MyPreferencesWelcomeMessage1}</p>
|
||||
<p style="margin:1.5em 0 2em;">${MyPreferencesWelcomeMessage2}</p>
|
||||
<a href="#" data-role="button" data-icon="action" data-theme="b" data-mini="true" class="btnMyPreferences">${ButtonMyPreferencesWelcomeYes}</a>
|
||||
<a href="#" data-rel="back" data-role="button" data-icon="delete" data-mini="true">${ButtonMyPreferencesWelcomeNo}</a>
|
||||
<div class="fieldDescription" style="margin-top:1em;">${ToAccessPreferencesHelp}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -9,8 +9,8 @@
|
||||
<div class="itemTabs homeTabs" style="display: none;">
|
||||
<div class="libraryViewNav scopedLibraryViewNav">
|
||||
<a href="index.html" class="lnkHomeHome">${TabHome}</a>
|
||||
<a href="homelatest.html" class="lnkHomeLatest homeLatestTab">${TabLatest}</a>
|
||||
<a href="tvrecommended.html" class="lnkHomeNextUp homeFavoritesTab">${TabNextUp}</a>
|
||||
<a href="homelatest.html" class="lnkHomeLatest">${TabLatest}</a>
|
||||
<a href="tvrecommended.html" class="lnkHomeNextUp">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="lnkHomeFavorites">${TabFavorites}</a>
|
||||
<a href="tvupcoming.html" class="lnkHomeUpcoming">${TabUpcoming}</a>
|
||||
</div>
|
||||
|
@ -4,11 +4,11 @@
|
||||
<title>${TitleSignIn}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="loginPage" data-role="page" class="page standalonePage" data-theme="b">
|
||||
<div id="loginPage" data-role="page" class="page standalonePage" data-theme="b" data-require="scripts/loginpage">
|
||||
|
||||
<div data-role="content">
|
||||
|
||||
<form class="manualLoginForm" id="manualLoginForm" style="display: none; text-align: center; margin: 0 auto;">
|
||||
<form class="manualLoginForm" style="display: none; text-align: center; margin: 0 auto;">
|
||||
|
||||
<h1 style="text-align: left;">${HeaderPleaseSignIn}</h1>
|
||||
|
||||
@ -61,10 +61,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#manualLoginForm').on('submit', LoginPage.onManualSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>${TitleMetadata}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="advancedMetadataConfigurationPage" data-role="page" class="page type-interior metadataConfigurationPage">
|
||||
<div id="advancedMetadataConfigurationPage" data-role="page" class="page type-interior metadataConfigurationPage" data-require="scripts/metadataadvanced">
|
||||
|
||||
<div data-role="content">
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
<a href="#" data-role="button" class="ui-btn-active">${TabAdvanced}</a>
|
||||
</div>
|
||||
|
||||
<form id="advancedMetadataConfigurationForm">
|
||||
<form class="advancedMetadataConfigurationForm">
|
||||
|
||||
<ul data-role="listview" class="ulForm">
|
||||
<li>
|
||||
@ -183,10 +183,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#advancedMetadataConfigurationForm').on('submit', AdvancedMetadataConfigurationPage.onSubmit);
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="libraryReportManagerPage" data-role="page" class="page libraryPage noSecondaryNavPage reportsPage" data-contextname="${HeaderReports}">
|
||||
<div id="libraryReportManagerPage" data-role="page" class="page libraryPage noSecondaryNavPage reportsPage" data-contextname="${HeaderReports}" data-require="scripts/reports">
|
||||
<div data-role="content">
|
||||
<div style="text-align: center;">
|
||||
<div class="viewControls">
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#aboutPage", function () {
|
||||
$(document).on('pageshowready', "#aboutPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -169,7 +169,7 @@
|
||||
Dashboard.hideLoadingMsg();
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#addPluginPage", function () {
|
||||
$(document).on('pageshowready', "#addPluginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#advancedConfigurationPage", function () {
|
||||
$(document).on('pageshowready', "#advancedConfigurationPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
return html;
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -195,7 +195,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', ".page", function () {
|
||||
$(document).on('pagebeforeshowready', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -203,7 +203,7 @@
|
||||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelItemsPage", function () {
|
||||
$(document).on('pageinitdepends', "#channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -256,10 +256,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#channelItemsPage", function () {
|
||||
|
||||
|
||||
}).on('pageshow', "#channelItemsPage", function () {
|
||||
}).on('pageshowready', "#channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
var limit = LibraryBrowser.getDefaultPageSize();
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#channelsPage", function () {
|
||||
$(document).on('pageshowready', "#channelsPage", function () {
|
||||
|
||||
LibraryBrowser.loadSavedQueryValues('channels', query);
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Sections.loadLatestChannelItems($(".items", page), Dashboard.getCurrentUserId());
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#channelsLatestPage", function () {
|
||||
$(document).on('pageshowready', "#channelsLatestPage", function () {
|
||||
|
||||
reloadItems(this);
|
||||
|
||||
|
@ -123,7 +123,23 @@
|
||||
Dashboard.navigate('selectserver.html');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#connectLoginPage", function () {
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submit(page);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onManualServerSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submitManualServer(page);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#connectLoginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -131,7 +147,10 @@
|
||||
skip();
|
||||
});
|
||||
|
||||
}).on('pageshow', "#connectLoginPage", function () {
|
||||
$('.connectLoginForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
$('.manualServerForm').off('submit', onManualServerSubmit).on('submit', onManualServerSubmit);
|
||||
|
||||
}).on('pageshowready', "#connectLoginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -179,25 +198,4 @@
|
||||
login(page, user, password);
|
||||
}
|
||||
|
||||
window.ConnectLoginPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submit(page);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
onManualServerSubmit: function () {
|
||||
var page = $(this).parents('.page');
|
||||
|
||||
submitManualServer(page);
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
@ -40,7 +40,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#dashboardHostingPage", function () {
|
||||
$(document).on('pageshowready', "#dashboardHostingPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -6,6 +6,12 @@
|
||||
|
||||
var page = this;
|
||||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Dashboard.lastSystemInfo) {
|
||||
Dashboard.setPageTitle(Dashboard.lastSystemInfo.ServerName);
|
||||
}
|
||||
@ -14,9 +20,9 @@
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
DashboardPage.pollForInfo(page);
|
||||
DashboardPage.startInterval();
|
||||
DashboardPage.startInterval(apiClient);
|
||||
|
||||
$(ApiClient).on("websocketmessage", DashboardPage.onWebSocketMessage)
|
||||
$(apiClient).on("websocketmessage", DashboardPage.onWebSocketMessage)
|
||||
.on("websocketopen", DashboardPage.onWebSocketOpen);
|
||||
|
||||
DashboardPage.lastAppUpdateCheck = null;
|
||||
@ -33,7 +39,7 @@
|
||||
|
||||
$('.activityItems', page).activityLogList();
|
||||
|
||||
$('.swaggerLink', page).attr('href', ApiClient.getUrl('swagger-ui/index.html'));
|
||||
$('.swaggerLink', page).attr('href', apiClient.getUrl('swagger-ui/index.html'));
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
@ -42,8 +48,10 @@
|
||||
|
||||
$('.activityItems', page).activityLogList('destroy');
|
||||
|
||||
$(ApiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval();
|
||||
var apiClient = ApiClient;
|
||||
|
||||
$(apiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||
DashboardPage.stopInterval(apiClient);
|
||||
|
||||
if (DashboardPage.sessionUpdateTimer) {
|
||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||
@ -152,19 +160,19 @@
|
||||
|
||||
},
|
||||
|
||||
startInterval: function () {
|
||||
startInterval: function (apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("SessionsStart", "0,1500");
|
||||
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "0,1000");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("SessionsStart", "0,1500");
|
||||
apiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "0,1000");
|
||||
}
|
||||
},
|
||||
|
||||
stopInterval: function () {
|
||||
stopInterval: function (apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("SessionsStop");
|
||||
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("SessionsStop");
|
||||
apiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
|
||||
}
|
||||
},
|
||||
|
||||
@ -199,16 +207,24 @@
|
||||
|
||||
onWebSocketOpen: function () {
|
||||
|
||||
DashboardPage.startInterval();
|
||||
var apiClient = this;
|
||||
|
||||
DashboardPage.startInterval(apiClient);
|
||||
},
|
||||
|
||||
pollForInfo: function (page, forceUpdate) {
|
||||
|
||||
ApiClient.getSessions().done(function (sessions) {
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
apiClient.getSessions().done(function (sessions) {
|
||||
|
||||
DashboardPage.renderInfo(page, sessions, forceUpdate);
|
||||
});
|
||||
ApiClient.getScheduledTasks().done(function (tasks) {
|
||||
apiClient.getScheduledTasks().done(function (tasks) {
|
||||
|
||||
DashboardPage.renderRunningTasks(page, tasks);
|
||||
});
|
||||
@ -991,7 +1007,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
$(document).on('pagebeforeshowready', "#dashboardPage", DashboardPage.onPageShow)
|
||||
.on('pagehide', "#dashboardPage", DashboardPage.onPageHide);
|
||||
|
||||
(function ($, document, window) {
|
||||
@ -1204,7 +1220,13 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
reloadData(this);
|
||||
});
|
||||
|
||||
$(ApiClient).on('websocketmessage.activityloglistener', function (e, data) {
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(apiClient).on('websocketmessage.activityloglistener', function (e, data) {
|
||||
|
||||
var msg = data;
|
||||
|
||||
@ -1217,31 +1239,35 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
|
||||
}).on('websocketopen.activityloglistener', function (e, data) {
|
||||
|
||||
startListening();
|
||||
startListening(apiClient);
|
||||
});
|
||||
}
|
||||
|
||||
function startListening() {
|
||||
function startListening(apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("ActivityLogEntryStart", "0,1500");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("ActivityLogEntryStart", "0,1500");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function stopListening() {
|
||||
function stopListening(apiClient) {
|
||||
|
||||
if (ApiClient.isWebSocketOpen()) {
|
||||
ApiClient.sendWebSocketMessage("ActivityLogEntryStop", "0,1500");
|
||||
if (apiClient.isWebSocketOpen()) {
|
||||
apiClient.sendWebSocketMessage("ActivityLogEntryStop", "0,1500");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function destroyList(elem) {
|
||||
|
||||
$(ApiClient).off('websocketopen.activityloglistener').off('websocketmessage.activityloglistener');
|
||||
var apiClient = ApiClient;
|
||||
|
||||
stopListening();
|
||||
if (apiClient) {
|
||||
$(apiClient).off('websocketopen.activityloglistener').off('websocketmessage.activityloglistener');
|
||||
|
||||
stopListening(apiClient);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -1254,7 +1280,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
createList(this);
|
||||
}
|
||||
|
||||
startListening();
|
||||
startListening(ApiClient);
|
||||
|
||||
return this;
|
||||
};
|
||||
@ -1277,11 +1303,11 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
});
|
||||
}
|
||||
|
||||
function showWelcomeIfNeeded(page) {
|
||||
function showWelcomeIfNeeded(page, apiClient) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
apiClient.getDisplayPreferences('dashboard', userId, 'dashboard').done(function (result) {
|
||||
|
||||
if (result.CustomPrefs[welcomeTourKey] == welcomeDismissValue) {
|
||||
$('.welcomeMessage', page).hide();
|
||||
@ -1330,21 +1356,23 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#dashboardPage", function () {
|
||||
$(document).on('pageinitdepends', "#dashboardPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
$('.btnTakeTour', page).on('click', function () {
|
||||
takeTour(page, userId);
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow.checktour', "#dashboardPage", function () {
|
||||
}).on('pagebeforeshowready.checktour', "#dashboardPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
showWelcomeIfNeeded(page);
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
showWelcomeIfNeeded(page, apiClient);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@ -1352,7 +1380,7 @@ $(document).on('pagebeforeshow', "#dashboardPage", DashboardPage.onPageShow)
|
||||
|
||||
(function () {
|
||||
|
||||
$(document).on('pagebeforeshow', ".type-interior", function () {
|
||||
$(document).on('pagebeforeshowready', ".type-interior", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
$('.deviceForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#devicePage", function () {
|
||||
}).on('pageshowready', "#devicePage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -89,7 +89,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#devicesPage", function () {
|
||||
$(document).on('pageshowready', "#devicesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -569,7 +569,7 @@
|
||||
$('.uploadItemImageForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
|
||||
}).on('pageshown', "#editItemImagesPage", function () {
|
||||
}).on('pageshowready', "#editItemImagesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -321,7 +321,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#episodesPage", function () {
|
||||
}).on('pageshowready', "#episodesPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
@ -105,7 +105,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#favoritesPage", function () {
|
||||
$(document).on('pageshowready', "#favoritesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gameGenresPage", function () {
|
||||
}).on('pageshowready', "#gameGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -239,7 +239,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gamesPage", function () {
|
||||
}).on('pageshowready', "#gamesPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#gamesRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#gamesRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
@ -98,7 +98,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#gameStudiosPage", function () {
|
||||
}).on('pageshowready', "#gameStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
// Reset form values using the last used query
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#gamesystemsPage", function () {
|
||||
$(document).on('pageshowready', "#gamesystemsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
Sections.loadLatestChannelItems($(".section2", page), userId);
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#homeLatestPage", function () {
|
||||
$(document).on('pageshowready', "#homeLatestPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -607,57 +607,38 @@
|
||||
afterClose: function () {
|
||||
dismissWelcome(page, userId);
|
||||
$('.welcomeMessage', page).hide();
|
||||
|
||||
loadConfigureViewsWelcomeMessage(page, userId);
|
||||
},
|
||||
hideBarsDelay: 30000
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadConfigureViewsWelcomeMessage(page, userId) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (user.Policy.EnableUserPreferenceAccess) {
|
||||
$('.btnMyPreferences', page).attr('href', 'mypreferencesdisplay.html?userId=' + userId);
|
||||
|
||||
// Need the timeout because previous methods in the chain have popups that will be in the act of closing
|
||||
setTimeout(function () {
|
||||
|
||||
$('.popupConfigureViews', page).popup('open');
|
||||
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#indexPage", function () {
|
||||
$(document).on('pageinitdepends', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
$('.btnTakeTour', page).on('click', function () {
|
||||
takeTour(page, userId);
|
||||
takeTour(page, Dashboard.getCurrentUserId());
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#indexPage", function () {
|
||||
}).on('pagebeforeshowready', "#indexPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
if (window.ApiClient) {
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
getDisplayPreferences('home', userId).done(function (result) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
loadSections(page, user, result).done(function () {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
});
|
||||
|
||||
loadSections(page, user, result).done(function () {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -244,7 +244,7 @@
|
||||
|
||||
$(page).on('click', '.mediaItem', onListItemClick);
|
||||
|
||||
}).on('pageshown', "#itemListPage", function () {
|
||||
}).on('pageshowready', "#itemListPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -1082,7 +1082,7 @@
|
||||
$('cardImage', page).remove();
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".libraryPage", function () {
|
||||
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -1127,7 +1127,7 @@
|
||||
|
||||
$('.itemsContainer', page).createCardMenus();
|
||||
|
||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -1212,9 +1212,15 @@
|
||||
$(apiClient).off('websocketmessage.librarylist', onWebSocketMessage).on('websocketmessage.librarylist', onWebSocketMessage);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, document, window);
|
@ -502,7 +502,7 @@
|
||||
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', ".page:not(.standalonePage)", function () {
|
||||
}).on('pagebeforeshowready', ".page:not(.standalonePage)", function () {
|
||||
|
||||
var page = this;
|
||||
var viewMenuBar = $('.viewMenuBar');
|
||||
@ -535,7 +535,7 @@
|
||||
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -587,22 +587,23 @@
|
||||
|
||||
function initializeApiClient(apiClient) {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
$(apiClient).off('websocketmessage.librarymenu', onWebSocketMessage).on('websocketmessage.librarymenu', onWebSocketMessage);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
}).on('localusersignedin', function () {
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
|
||||
requiresLibraryMenuRefresh = true;
|
||||
|
||||
}).on('localusersignedout', function () {
|
||||
|
||||
$('.viewMenuBar').remove();
|
||||
requiresLibraryMenuRefresh = true;
|
||||
}).on('localusersignedin localusersignedout', function () {
|
||||
$('.viewMenuBar').remove();
|
||||
requiresLibraryMenuRefresh = true;
|
||||
});
|
||||
});
|
||||
|
||||
$(function () {
|
||||
|
@ -109,7 +109,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#liveTvChannelsPage", function () {
|
||||
}).on('pageshowready', "#liveTvChannelsPage", function () {
|
||||
|
||||
// Can't use pagebeforeshow here or the loading popup won't center correctly
|
||||
var page = this;
|
||||
|
@ -137,7 +137,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#liveTvItemsPage", function () {
|
||||
}).on('pageshowready', "#liveTvItemsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -102,7 +102,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvRecordingsPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvRecordingsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -116,7 +116,7 @@
|
||||
}).checkboxradio('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvSeriesTimersPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvSeriesTimersPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvSuggestedPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvSuggestedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -107,7 +107,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#liveTvTimersPage", function () {
|
||||
$(document).on('pageshowready', "#liveTvTimersPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
showManualForm: function (page, showCancel, focusPassword) {
|
||||
$('.visualLoginForm', page).hide();
|
||||
$('#manualLoginForm', page).show();
|
||||
$('.manualLoginForm', page).show();
|
||||
|
||||
if (focusPassword) {
|
||||
$('#txtManualPassword', page).focus();
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
showVisualForm: function (page) {
|
||||
$('.visualLoginForm', page).show();
|
||||
$('#manualLoginForm', page).hide();
|
||||
$('.manualLoginForm', page).hide();
|
||||
},
|
||||
|
||||
getLastSeenText: function (lastActivityDate) {
|
||||
@ -215,4 +215,10 @@
|
||||
}
|
||||
};
|
||||
|
||||
$(document).on('pageshow', "#loginPage", LoginPage.onPageShow);
|
||||
$(document).on('pageinitdepends', "#loginPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.manualLoginForm', page).off('submit', LoginPage.onManualSubmit).on('submit', LoginPage.onManualSubmit);
|
||||
|
||||
}).on('pageshowready', "#loginPage", LoginPage.onPageShow);
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function () {
|
||||
|
||||
$(document).on('pageshown', "#logPage", function () {
|
||||
$(document).on('pageshowready', "#logPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -169,6 +169,13 @@
|
||||
|
||||
};
|
||||
|
||||
self.removeActiveTarget = function (id) {
|
||||
|
||||
if (self.getPlayerInfo().id == id) {
|
||||
self.setDefaultPlayerActive();
|
||||
}
|
||||
};
|
||||
|
||||
self.getPlayers = function() {
|
||||
return players;
|
||||
};
|
||||
@ -450,6 +457,20 @@
|
||||
|
||||
return bottomText ? topText + '<br/>' + bottomText : topText;
|
||||
};
|
||||
|
||||
self.showPlaybackInfoErrorMessage = function(errorCode) {
|
||||
|
||||
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
|
||||
// If we're coming from the popup play menu, this will be a problem
|
||||
|
||||
setTimeout(function() {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessagePlaybackError' + errorCode),
|
||||
title: Globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
}, 300);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
window.MediaController = new mediaController();
|
||||
@ -512,15 +533,19 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).on("websocketmessage", onWebSocketMessageReceived);
|
||||
$(apiClient).off("websocketmessage", onWebSocketMessageReceived).on("websocketmessage", onWebSocketMessageReceived);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
function getTargetsHtml(targets) {
|
||||
@ -705,9 +730,8 @@
|
||||
|
||||
showPlayerSelection($.mobile.activePage);
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('pagebeforeshow', ".page", function () {
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -215,20 +215,16 @@
|
||||
profile.ContainerProfiles = [];
|
||||
|
||||
var audioConditions = [];
|
||||
var videoAudioMp3Conditions = [];
|
||||
|
||||
var maxAudioChannels = $.browser.msie || $.browser.safari ?
|
||||
'2' :
|
||||
'6';
|
||||
|
||||
var channelCondition = {
|
||||
audioConditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
};
|
||||
|
||||
audioConditions.push(channelCondition);
|
||||
videoAudioMp3Conditions.push(channelCondition);
|
||||
});
|
||||
|
||||
profile.CodecProfiles = [];
|
||||
profile.CodecProfiles.push({
|
||||
@ -236,20 +232,21 @@
|
||||
Conditions: audioConditions
|
||||
});
|
||||
|
||||
if (videoAudioMp3Conditions.length) {
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'mp3',
|
||||
Conditions: videoAudioMp3Conditions
|
||||
});
|
||||
}
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'mp3',
|
||||
Conditions: [{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
}]
|
||||
});
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'aac',
|
||||
Container: 'mkv,mov',
|
||||
Conditions: [
|
||||
channelCondition,
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'AudioProfile',
|
||||
@ -266,9 +263,12 @@
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'aac',
|
||||
Container: 'mp4,m4v',
|
||||
Conditions: [
|
||||
channelCondition
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: maxAudioChannels
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
@ -868,7 +868,7 @@
|
||||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
MediaController.showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -901,7 +901,7 @@
|
||||
}
|
||||
} else {
|
||||
Dashboard.hideModalLoadingMsg();
|
||||
showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
}
|
||||
}
|
||||
|
||||
@ -934,27 +934,13 @@
|
||||
|
||||
if (result.ErrorCode) {
|
||||
|
||||
showPlaybackInfoErrorMessage(result.ErrorCode);
|
||||
MediaController.showPlaybackInfoErrorMessage(result.ErrorCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function showPlaybackInfoErrorMessage(errorCode) {
|
||||
|
||||
// This timeout is messy, but if jqm is in the act of hiding a popup, it will not show a new one
|
||||
// If we're coming from the popup play menu, this will be a problem
|
||||
|
||||
setTimeout(function () {
|
||||
Dashboard.alert({
|
||||
message: Globalize.translate('MessagePlaybackError' + errorCode),
|
||||
title: Globalize.translate('HeaderPlaybackError')
|
||||
});
|
||||
}, 300);
|
||||
|
||||
}
|
||||
|
||||
self.getPosterUrl = function (item) {
|
||||
|
||||
var screenWidth = Math.max(screen.height, screen.width);
|
||||
@ -1748,8 +1734,10 @@
|
||||
|
||||
window.MediaPlayer = new mediaPlayer();
|
||||
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
Dashboard.ready(function() {
|
||||
window.MediaController.registerPlayer(window.MediaPlayer);
|
||||
window.MediaController.setActivePlayer(window.MediaPlayer, window.MediaPlayer.getTargets()[0]);
|
||||
});
|
||||
|
||||
|
||||
})(document, setTimeout, clearTimeout, screen, window.store, $, setInterval, window);
|
@ -150,7 +150,23 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#advancedMetadataConfigurationPage", function () {
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
saveAdvancedConfig(form);
|
||||
saveChapters(form);
|
||||
saveMetadata(form);
|
||||
saveTmdb(form);
|
||||
saveTvdb(form);
|
||||
saveFanart(form);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('pageinitdepends', "#advancedMetadataConfigurationPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -174,7 +190,10 @@
|
||||
});
|
||||
});
|
||||
|
||||
}).on('pageshow', "#advancedMetadataConfigurationPage", function () {
|
||||
$('.advancedMetadataConfigurationForm').on('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
|
||||
}).on('pageshowready', "#advancedMetadataConfigurationPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -270,7 +289,7 @@
|
||||
}
|
||||
|
||||
function saveMetadata(form) {
|
||||
|
||||
|
||||
ApiClient.getNamedConfiguration("metadata").done(function (config) {
|
||||
|
||||
config.UseFileCreationTimeForDateAdded = $('#selectDateAdded', form).val() == '1';
|
||||
@ -307,24 +326,5 @@
|
||||
});
|
||||
}
|
||||
|
||||
window.AdvancedMetadataConfigurationPage = {
|
||||
|
||||
onSubmit: function () {
|
||||
var form = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
saveAdvancedConfig(form);
|
||||
saveChapters(form);
|
||||
saveMetadata(form);
|
||||
saveTmdb(form);
|
||||
saveTvdb(form);
|
||||
saveFanart(form);
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
})(window, jQuery);
|
||||
|
||||
|
@ -173,7 +173,7 @@
|
||||
$('#selectPageSize', page).val(query.Limit).selectmenu('refresh');
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#boxsetsPage", function () {
|
||||
$(document).on('pageinitdepends', "#boxsetsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -257,7 +257,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#boxsetsPage", function () {
|
||||
}).on('pagebeforeshowready', "#boxsetsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -296,7 +296,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
}).on('pageshow', "#boxsetsPage", function () {
|
||||
}).on('pageshowready', "#boxsetsPage", function () {
|
||||
|
||||
updateFilterControls(this);
|
||||
|
||||
@ -417,7 +417,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', ".collectionEditorPage", function () {
|
||||
$(document).on('pageinitdepends', ".collectionEditorPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -154,7 +154,7 @@
|
||||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#movieGenresPage", function () {
|
||||
}).on('pageshowready', "#movieGenresPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
@ -140,7 +140,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#moviePeoplePage", function () {
|
||||
}).on('pageshowready', "#moviePeoplePage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -399,7 +399,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#moviesPage", function () {
|
||||
}).on('pageshowready', "#moviesPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -234,7 +234,7 @@
|
||||
|
||||
$('.recommendations', page).createCardMenus();
|
||||
|
||||
}).on('pageshown', "#moviesRecommendedPage", function () {
|
||||
}).on('pageshowready', "#moviesRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#movieStudiosPage", function () {
|
||||
}).on('pageshowready', "#movieStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -215,7 +215,7 @@
|
||||
|
||||
$('.popupTrailerReelForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#movieTrailersPage", function () {
|
||||
}).on('pageshowready', "#movieTrailersPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -190,7 +190,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicAlbumArtistsPage", function () {
|
||||
}).on('pageshowready', "#musicAlbumArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
@ -242,7 +242,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicAlbumsPage", function () {
|
||||
}).on('pageshowready', "#musicAlbumsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -191,7 +191,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicArtistsPage", function () {
|
||||
}).on('pageshowready', "#musicArtistsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -115,7 +115,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicGenresPage", function () {
|
||||
}).on('pageshowready', "#musicGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -165,7 +165,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#musicRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#musicRecommendedPage", function () {
|
||||
|
||||
var parentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -183,7 +183,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#musicVideosPage", function () {
|
||||
}).on('pageshowready', "#musicVideosPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -226,23 +226,28 @@
|
||||
}
|
||||
});
|
||||
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).on("websocketmessage", function (e, msg) {
|
||||
function onWebSocketMessage(e, msg) {
|
||||
if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") {
|
||||
|
||||
Notifications.getNotificationsSummaryPromise = null;
|
||||
|
||||
if (msg.MessageType === "NotificationUpdated" || msg.MessageType === "NotificationAdded" || msg.MessageType === "NotificationsMarkedRead") {
|
||||
|
||||
Notifications.getNotificationsSummaryPromise = null;
|
||||
|
||||
Notifications.updateNotificationCount();
|
||||
}
|
||||
|
||||
});
|
||||
Notifications.updateNotificationCount();
|
||||
}
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
function initializeApiClient(apiClient) {
|
||||
$(apiClient).off("websocketmessage", onWebSocketMessage).on("websocketmessage", onWebSocketMessage);
|
||||
}
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
Dashboard.ready(function () {
|
||||
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(jQuery, document, Dashboard, LibraryBrowser);
|
@ -442,7 +442,7 @@
|
||||
.on('positionchange.nowplayingbar', onStateChanged);
|
||||
}
|
||||
|
||||
$(function () {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
$(MediaController).on('playerchange', function () {
|
||||
|
||||
|
@ -277,7 +277,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#photosPage", function () {
|
||||
}).on('pageshowready', "#photosPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -355,9 +355,15 @@
|
||||
$(apiClient).on("websocketmessage", onWebSocketMessageReceived).on("websocketopen", onWebSocketConnectionChange);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
initializeApiClient(apiClient);
|
||||
if (window.ApiClient) {
|
||||
initializeApiClient(window.ApiClient);
|
||||
}
|
||||
|
||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||
initializeApiClient(apiClient);
|
||||
});
|
||||
});
|
||||
|
||||
})(window, document, jQuery);
|
@ -478,7 +478,7 @@
|
||||
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#libraryReportManagerPage", function () {
|
||||
$(document).on('pageinitdepends', "#libraryReportManagerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -781,7 +781,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
})
|
||||
.on('pagebeforeshow', "#libraryReportManagerPage", function () {
|
||||
.on('pageshowready', "#libraryReportManagerPage", function () {
|
||||
|
||||
query.UserId = Dashboard.getCurrentUserId();
|
||||
var page = this;
|
||||
@ -791,11 +791,6 @@
|
||||
QueryReportColumns.onPageShow(page, query);
|
||||
$('#selectView', page).val(query.IncludeItemTypes).selectmenu('refresh').trigger('change');
|
||||
|
||||
})
|
||||
.on('pageshow', "#libraryReportManagerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
updateFilterControls(page);
|
||||
|
||||
filtersLoaded = false;
|
||||
|
@ -62,7 +62,7 @@
|
||||
|
||||
html += '<div class="cardPadder"></div>';
|
||||
|
||||
var href = "#";
|
||||
var href = server.href || "#";
|
||||
html += '<a class="cardContent lnkServer" data-serverid="' + server.Id + '" href="' + href + '">';
|
||||
|
||||
var imgUrl = server.Id == 'connect' ? 'css/images/logo536.png' : '';
|
||||
@ -84,20 +84,22 @@
|
||||
// cardScalable
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardFooter">';
|
||||
html += '<div class="cardFooter outerCardFooter">';
|
||||
|
||||
if (server.showOptions !== false) {
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
|
||||
html += '<button class="btnServerMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
||||
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions btnServerMenu" type="button" data-role="none" style="margin: 4px 0 0;"><i class="fa fa-ellipsis-v"></i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
||||
html += '<div class="cardText">';
|
||||
html += server.Name;
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText">';
|
||||
html += ' ';
|
||||
html += "</div>";
|
||||
|
||||
// cardFooter
|
||||
html += "</div>";
|
||||
|
||||
@ -128,21 +130,15 @@
|
||||
|
||||
var id = this.getAttribute('data-serverid');
|
||||
|
||||
if (id == 'new') {
|
||||
Dashboard.navigate('connectlogin.html?mode=manualserver');
|
||||
return;
|
||||
if (id != 'new' && id != 'connect') {
|
||||
|
||||
var server = servers.filter(function (s) {
|
||||
return s.Id == id;
|
||||
})[0];
|
||||
|
||||
connectToServer(page, server);
|
||||
}
|
||||
|
||||
if (id == 'connect') {
|
||||
Dashboard.navigate('connectlogin.html?mode=connect');
|
||||
return;
|
||||
}
|
||||
|
||||
var server = servers.filter(function (s) {
|
||||
return s.Id == id;
|
||||
})[0];
|
||||
|
||||
connectToServer(page, server);
|
||||
});
|
||||
|
||||
$('.btnServerMenu', elem).on('click', function () {
|
||||
@ -312,17 +308,20 @@
|
||||
// cardScalable
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardFooter">';
|
||||
html += '<div class="cardFooter outerCardFooter">';
|
||||
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
|
||||
html += '<button class="btnInviteMenu" type="button" data-inline="true" data-iconpos="notext" data-icon="ellipsis-v" style="margin: 2px 0 0;"></button>';
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions btnInviteMenu" type="button" data-role="none" style="margin: 4px 0 0;"><i class="fa fa-ellipsis-v"></i></button>';
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText" style="margin-right: 30px; padding: 11px 0 10px;">';
|
||||
html += '<div class="cardText">';
|
||||
html += invite.Name;
|
||||
html += "</div>";
|
||||
|
||||
html += '<div class="cardText">';
|
||||
html += ' ';
|
||||
html += "</div>";
|
||||
|
||||
// cardFooter
|
||||
html += "</div>";
|
||||
|
||||
@ -383,15 +382,8 @@
|
||||
servers.push({
|
||||
Name: Globalize.translate('ButtonNewServer'),
|
||||
Id: 'new',
|
||||
showOptions: false
|
||||
});
|
||||
}
|
||||
|
||||
if (!ConnectionManager.isLoggedIntoConnect()) {
|
||||
servers.push({
|
||||
Name: Globalize.translate('ButtonSignInWithConnect'),
|
||||
Id: 'connect',
|
||||
showOptions: false
|
||||
showOptions: false,
|
||||
href: 'connectlogin.html?mode=manualserver'
|
||||
});
|
||||
}
|
||||
|
||||
@ -401,10 +393,16 @@
|
||||
});
|
||||
|
||||
loadInvitations(page);
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$('.connectLogin', page).hide();
|
||||
} else {
|
||||
$('.connectLogin', page).show();
|
||||
}
|
||||
}
|
||||
|
||||
function updatePageStyle(page) {
|
||||
|
||||
|
||||
if (ConnectionManager.isLoggedIntoConnect()) {
|
||||
$(page).addClass('libraryPage').addClass('noSecondaryNavPage').removeClass('standalonePage');
|
||||
} else {
|
||||
@ -412,12 +410,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pagebeforecreate pageinit pagebeforeshow', "#selectServerPage", function () {
|
||||
$(document).on('pageinitdepends pagebeforeshowready', "#selectServerPage", function () {
|
||||
|
||||
var page = this;
|
||||
updatePageStyle(page);
|
||||
|
||||
}).on('pagebeforeshow', "#selectServerPage", function () {
|
||||
}).on('pageshowready', "#selectServerPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
@ -425,21 +423,4 @@
|
||||
|
||||
});
|
||||
|
||||
window.SelectServerPage = {
|
||||
|
||||
onServerAddressEntrySubmit: function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var form = this;
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
|
||||
// Disable default form submission
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
})();
|
@ -133,7 +133,7 @@
|
||||
|
||||
$('.newKeyForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#serverSecurityPage", function () {
|
||||
}).on('pageshowready', "#serverSecurityPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -106,7 +106,9 @@ var Dashboard = {
|
||||
|
||||
onApiClientServerAddressChanged: function () {
|
||||
|
||||
Dashboard.serverAddress(ApiClient.serverAddress());
|
||||
var apiClient = this;
|
||||
|
||||
Dashboard.serverAddress(apiClient.serverAddress());
|
||||
},
|
||||
|
||||
getCurrentUser: function () {
|
||||
@ -200,7 +202,7 @@ var Dashboard = {
|
||||
Dashboard.getUserPromise = null;
|
||||
},
|
||||
|
||||
logout: function (logoutWithServer) {
|
||||
logout: function (logoutWithServer, forceReload) {
|
||||
|
||||
store.removeItem("userId");
|
||||
store.removeItem("token");
|
||||
@ -208,16 +210,20 @@ var Dashboard = {
|
||||
|
||||
function onLogoutDone() {
|
||||
|
||||
var loginPage = 'login.html';
|
||||
var loginPage;
|
||||
|
||||
if (Dashboard.isConnectMode()) {
|
||||
loginPage = 'connectlogin.html';
|
||||
window.ApiClient = null;
|
||||
} else {
|
||||
|
||||
loginPage = 'login.html';
|
||||
}
|
||||
|
||||
Dashboard.navigate(loginPage);
|
||||
if (forceReload) {
|
||||
window.location.href = loginPage;
|
||||
} else {
|
||||
Dashboard.navigate(loginPage);
|
||||
}
|
||||
}
|
||||
|
||||
if (logoutWithServer === false) {
|
||||
@ -697,14 +703,23 @@ var Dashboard = {
|
||||
|
||||
getPluginSecurityInfo: function () {
|
||||
|
||||
var apiClient = ApiClient;
|
||||
|
||||
if (!apiClient) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
deferred.reject();
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
if (!Dashboard.getPluginSecurityInfoPromise) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
// Don't let this blow up the dashboard when it fails
|
||||
ApiClient.ajax({
|
||||
apiClient.ajax({
|
||||
type: "GET",
|
||||
url: ApiClient.getUrl("Plugins/SecurityInfo"),
|
||||
url: apiClient.getUrl("Plugins/SecurityInfo"),
|
||||
dataType: 'json',
|
||||
|
||||
error: function () {
|
||||
@ -1393,7 +1408,7 @@ var Dashboard = {
|
||||
|
||||
} else {
|
||||
|
||||
quality -= 50;
|
||||
quality -= 40;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1413,7 +1428,7 @@ var Dashboard = {
|
||||
}
|
||||
},
|
||||
|
||||
getAppInfo: function () {
|
||||
getAppInfo: function (appName, deviceId, deviceName) {
|
||||
|
||||
function generateDeviceName() {
|
||||
|
||||
@ -1446,29 +1461,13 @@ var Dashboard = {
|
||||
}
|
||||
|
||||
var appVersion = window.dashboardVersion;
|
||||
var appName = "Emby Web Client";
|
||||
|
||||
var deviceName;
|
||||
var deviceId;
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
|
||||
appName = "Emby Mobile";
|
||||
|
||||
deviceName = store.getItem('cordovaDeviceName');
|
||||
deviceId = store.getItem('cordovaDeviceId');
|
||||
}
|
||||
appName = appName || "Emby Web Client";
|
||||
|
||||
deviceName = deviceName || generateDeviceName();
|
||||
|
||||
var seed = [];
|
||||
var keyName = 'randomId';
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
seed.push('cordova');
|
||||
keyName = 'cordovaDeviceId';
|
||||
}
|
||||
|
||||
deviceId = deviceId || MediaBrowser.generateDeviceId(keyName, seed.join(','));
|
||||
|
||||
return {
|
||||
@ -1501,6 +1500,23 @@ var Dashboard = {
|
||||
}
|
||||
|
||||
Dashboard.setCurrentUser(userId, accessToken);
|
||||
},
|
||||
|
||||
ready: function(fn) {
|
||||
|
||||
if (Dashboard.initPromiseDone) {
|
||||
fn();
|
||||
return;
|
||||
}
|
||||
|
||||
Dashboard.initPromise.done(fn);
|
||||
},
|
||||
|
||||
firePageEvent: function (page, name) {
|
||||
|
||||
Dashboard.ready(function () {
|
||||
$(page).trigger(name);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -1516,7 +1532,7 @@ var AppInfo = {};
|
||||
|
||||
function setAppInfo() {
|
||||
|
||||
if (isTouchDevice() && $.browser.mobile) {
|
||||
if (isTouchDevice()) {
|
||||
AppInfo.isTouchPreferred = true;
|
||||
}
|
||||
|
||||
@ -1561,7 +1577,6 @@ var AppInfo = {};
|
||||
AppInfo.enablePeopleTabs = true;
|
||||
AppInfo.enableTvEpisodesTab = true;
|
||||
AppInfo.enableMusicArtistsTab = true;
|
||||
AppInfo.enableHomeLatestTab = true;
|
||||
AppInfo.enableMovieTrailersTab = true;
|
||||
}
|
||||
|
||||
@ -1582,9 +1597,7 @@ var AppInfo = {};
|
||||
.on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged);
|
||||
}
|
||||
|
||||
function createConnectionManager() {
|
||||
|
||||
var appInfo = Dashboard.getAppInfo();
|
||||
function createConnectionManager(appInfo) {
|
||||
|
||||
var credentialProvider = new MediaBrowser.CredentialProvider();
|
||||
|
||||
@ -1653,7 +1666,7 @@ var AppInfo = {};
|
||||
|
||||
}
|
||||
|
||||
function onReady() {
|
||||
function onDocumentReady() {
|
||||
|
||||
if (AppInfo.isTouchPreferred) {
|
||||
$(document.body).addClass('touch');
|
||||
@ -1691,10 +1704,6 @@ var AppInfo = {};
|
||||
$(document.body).addClass('musicArtistsTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableHomeLatestTab) {
|
||||
$(document.body).addClass('homeLatestTabDisabled');
|
||||
}
|
||||
|
||||
if (!AppInfo.enableMovieTrailersTab) {
|
||||
$(document.body).addClass('movieTrailersTabDisabled');
|
||||
}
|
||||
@ -1818,7 +1827,7 @@ var AppInfo = {};
|
||||
});
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
requirejs(['thirdparty/cordova/connectsdk']);
|
||||
requirejs(['thirdparty/cordova/connectsdk', 'thirdparty/cordova/remotecontrols']);
|
||||
} else {
|
||||
if ($.browser.chrome) {
|
||||
requirejs(['scripts/chromecast']);
|
||||
@ -1826,38 +1835,64 @@ var AppInfo = {};
|
||||
}
|
||||
}
|
||||
|
||||
requirejs.config({
|
||||
map: {
|
||||
'*': {
|
||||
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
urlArgs: "v=" + window.dashboardVersion
|
||||
});
|
||||
function init(deferred, appName, deviceId, deviceName) {
|
||||
|
||||
// Required since jQuery is loaded before requireJs
|
||||
define('jquery', [], function () {
|
||||
return jQuery;
|
||||
});
|
||||
requirejs.config({
|
||||
map: {
|
||||
'*': {
|
||||
'css': 'thirdparty/requirecss' // or whatever the path to require-css is
|
||||
}
|
||||
},
|
||||
urlArgs: "v=" + window.dashboardVersion
|
||||
});
|
||||
|
||||
setAppInfo();
|
||||
createConnectionManager();
|
||||
// Required since jQuery is loaded before requireJs
|
||||
define('jquery', [], function () {
|
||||
return jQuery;
|
||||
});
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
setAppInfo();
|
||||
|
||||
var appInfo = Dashboard.getAppInfo(appName, deviceId, deviceName);
|
||||
|
||||
createConnectionManager(appInfo);
|
||||
|
||||
Dashboard.initPromiseDone = true;
|
||||
deferred.resolve();
|
||||
$(onDocumentReady);
|
||||
}
|
||||
|
||||
function initCordovaWithDeviceId(deferred, deviceId) {
|
||||
if ($.browser.safari) {
|
||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||
}
|
||||
|
||||
init(deferred, "Emby Mobile", deviceId, device.model);
|
||||
}
|
||||
|
||||
function initCordova(deferred) {
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
|
||||
if ($.browser.safari) {
|
||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||
}
|
||||
window.plugins.uniqueDeviceID.get(function (uuid) {
|
||||
|
||||
$(onReady);
|
||||
initCordovaWithDeviceId(deferred, uuid);
|
||||
|
||||
}, function () {
|
||||
|
||||
// Failure. Use cordova uuid
|
||||
initCordovaWithDeviceId(deferred, device.uuid);
|
||||
});
|
||||
}, false);
|
||||
}
|
||||
|
||||
var initDeferred = $.Deferred();
|
||||
Dashboard.initPromise = initDeferred.promise();
|
||||
|
||||
if (Dashboard.isRunningInCordova()) {
|
||||
initCordova(initDeferred);
|
||||
} else {
|
||||
|
||||
$(onReady);
|
||||
init(initDeferred);
|
||||
}
|
||||
|
||||
})();
|
||||
@ -1903,10 +1938,10 @@ $(document).on('pagecreate', ".page", function () {
|
||||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageinitdepends');
|
||||
Dashboard.firePageEvent(page, 'pageinitdepends');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageinitdepends');
|
||||
Dashboard.firePageEvent(page, 'pageinitdepends');
|
||||
}
|
||||
|
||||
$('.localnav a, .libraryViewNav a').attr('data-transition', 'none');
|
||||
@ -1914,16 +1949,29 @@ $(document).on('pagecreate', ".page", function () {
|
||||
}).on('pageshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
$(page).trigger('pageshown');
|
||||
Dashboard.firePageEvent(page, 'pageshowready');
|
||||
});
|
||||
} else {
|
||||
$(page).trigger('pageshown');
|
||||
Dashboard.firePageEvent(page, 'pageshowready');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
var page = this;
|
||||
var require = this.getAttribute('data-require');
|
||||
|
||||
if (require) {
|
||||
requirejs(require.split(','), function () {
|
||||
|
||||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||
});
|
||||
} else {
|
||||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||
}
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
@ -1961,7 +2009,7 @@ $(document).on('pagecreate', ".page", function () {
|
||||
if (isConnectMode) {
|
||||
|
||||
if (!Dashboard.isServerlessPage()) {
|
||||
Dashboard.logout();
|
||||
Dashboard.logout(true, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1969,7 +2017,7 @@ $(document).on('pagecreate', ".page", function () {
|
||||
if (this.id !== "loginPage" && !page.hasClass('forgotPasswordPage') && !page.hasClass('wizardPage') && !isConnectMode) {
|
||||
|
||||
console.log('Not logged into server. Redirecting to login.');
|
||||
Dashboard.logout();
|
||||
Dashboard.logout(true, true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#songsPage", function () {
|
||||
}).on('pageshowready', "#songsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
$('.streamingSettingsForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#streamingSettingsPage", function () {
|
||||
}).on('pageshowready', "#streamingSettingsPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -176,7 +176,7 @@
|
||||
|
||||
$('.supporterForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#supporterPage", function () {
|
||||
}).on('pageshowready', "#supporterPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -169,7 +169,7 @@
|
||||
LibraryBrowser.saveViewSetting(getSavedQueryKey(), view);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvGenresPage", function () {
|
||||
}).on('pageshowready', "#tvGenresPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
var page = this;
|
||||
|
@ -9,7 +9,7 @@
|
||||
return 'Thumb';
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#tvNextUpPage", function () {
|
||||
$(document).on('pageshowready', "#tvNextUpPage", function () {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvPeoplePage", function () {
|
||||
}).on('pageshowready', "#tvPeoplePage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageshown', "#tvRecommendedPage", function () {
|
||||
$(document).on('pageshowready', "#tvRecommendedPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -360,7 +360,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvShowsPage", function () {
|
||||
}).on('pageshowready', "#tvShowsPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -108,7 +108,7 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pageshown', "#tvStudiosPage", function () {
|
||||
}).on('pageshowready', "#tvStudiosPage", function () {
|
||||
|
||||
query.ParentId = LibraryMenu.getTopParentId();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
(function ($, document) {
|
||||
|
||||
$(document).on('pageshown', "#tvUpcomingPage", function () {
|
||||
$(document).on('pageshowready', "#tvUpcomingPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -151,7 +151,7 @@
|
||||
|
||||
$('.newUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#newUserPage", function () {
|
||||
}).on('pageshowready', "#newUserPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -84,7 +84,7 @@
|
||||
|
||||
$('.wizardSettingsForm', page).off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#wizardSettingsPage", function () {
|
||||
}).on('pageshowready', "#wizardSettingsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
$('.wizardUserForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
|
||||
}).on('pageshown', "#wizardUserPage", function () {
|
||||
}).on('pageshowready', "#wizardUserPage", function () {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title>Emby</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="selectServerPage" data-role="page" class="page libraryPage noSecondaryNavPage" data-theme="b">
|
||||
<div id="selectServerPage" data-role="page" class="page libraryPage noSecondaryNavPage" data-theme="b" data-require="scripts/selectserver">
|
||||
|
||||
<div data-role="content">
|
||||
|
||||
@ -24,6 +24,15 @@
|
||||
${MessageNoServersAvailableToConnect}
|
||||
</div>
|
||||
|
||||
<div class="connectLogin" style="margin:1.5em 0;display:none;">
|
||||
<a class="btn btnActionAccent" href="connectlogin.html?mode=connect">
|
||||
<span>
|
||||
${ButtonSignInWithConnect}
|
||||
</span>
|
||||
<i class="fa fa-check"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="invitationSection" style="display:none;">
|
||||
<br />
|
||||
<h1 style="margin-bottom:.5em;padding-left:5px;">${HeaderInvitations}</h1>
|
||||
|
14
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
14
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
@ -345,7 +345,7 @@
|
||||
return url;
|
||||
};
|
||||
|
||||
self.enableAutomaticNetworking = function (server, connectionMode) {
|
||||
self.enableAutomaticNetworking = function (server, connectionMode, serverUrl) {
|
||||
|
||||
logger.log('Begin enableAutomaticNetworking');
|
||||
|
||||
@ -353,12 +353,8 @@
|
||||
self.connectionMode = connectionMode;
|
||||
self.enableAutomaticNetwork = true;
|
||||
|
||||
var url = connectionMode == MediaBrowser.ConnectionMode.Local ?
|
||||
self.serverInfo().LocalAddress :
|
||||
self.serverInfo().RemoteAddress;
|
||||
|
||||
logger.log('Setting server address to ' + url);
|
||||
self.serverAddress(url);
|
||||
logger.log('Setting server address to ' + serverUrl);
|
||||
self.serverAddress(serverUrl);
|
||||
};
|
||||
|
||||
self.isWebSocketSupported = function () {
|
||||
@ -570,12 +566,12 @@
|
||||
return self.ajax({
|
||||
type: "POST",
|
||||
url: url
|
||||
}).done(done);
|
||||
}).always(done);
|
||||
}
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
deferred.resolveWith(null, []);
|
||||
return deferred.promise().done(done);
|
||||
return deferred.promise().always(done);
|
||||
};
|
||||
|
||||
function getRemoteImagePrefix(options) {
|
||||
|
@ -479,6 +479,7 @@
|
||||
for (var j = 0, numServers = servers.length; j < numServers; j++) {
|
||||
|
||||
var server = servers[j];
|
||||
|
||||
server.UserId = null;
|
||||
server.AccessToken = null;
|
||||
server.ExchangeToken = null;
|
||||
@ -902,7 +903,7 @@
|
||||
MediaBrowser.ConnectionState.ServerSignIn;
|
||||
|
||||
result.Servers.push(server);
|
||||
result.ApiClient.enableAutomaticNetworking(server, connectionMode);
|
||||
result.ApiClient.enableAutomaticNetworking(server, connectionMode, self.getServerAddress(server, connectionMode));
|
||||
|
||||
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
||||
afterConnected(result.ApiClient, options);
|
||||
@ -947,6 +948,11 @@
|
||||
|
||||
address = normalizeAddress(address);
|
||||
|
||||
function onFail() {
|
||||
logger.log('connectToAddress ' + address + ' failed');
|
||||
resolveWithFailure(deferred);
|
||||
}
|
||||
|
||||
tryConnect(address, 15000).done(function (publicInfo) {
|
||||
|
||||
logger.log('connectToAddress ' + address + ' succeeded');
|
||||
@ -961,13 +967,9 @@
|
||||
|
||||
deferred.resolveWith(null, [result]);
|
||||
|
||||
});
|
||||
}).fail(onFail);
|
||||
|
||||
}).fail(function () {
|
||||
|
||||
logger.log('connectToAddress ' + address + ' failed');
|
||||
resolveWithFailure(deferred);
|
||||
});
|
||||
}).fail(onFail);
|
||||
|
||||
return deferred.promise();
|
||||
};
|
||||
|
@ -290,11 +290,12 @@
|
||||
|
||||
function isChromecast(name) {
|
||||
|
||||
name = (name || '').toLowerCase();
|
||||
var validTokens = ['nexusplayer', 'chromecast', 'eurekadongle'];
|
||||
|
||||
return validTokens.filter(function (t) {
|
||||
|
||||
return name.toLowerCase().replace(' ', '').indexOf(t) != -1;
|
||||
return name.replace(' ', '').indexOf(t) != -1;
|
||||
|
||||
}).length > 0;
|
||||
}
|
||||
|
12
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
12
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
@ -15,8 +15,8 @@
|
||||
|
||||
var manager = ConnectSDK.discoveryManager;
|
||||
|
||||
manager.setPairingLevel(ConnectSDK.PairingLevel.OFF);
|
||||
manager.setAirPlayServiceMode(ConnectSDK.AirPlayServiceMode.Media);
|
||||
//manager.setPairingLevel(ConnectSDK.PairingLevel.OFF);
|
||||
//manager.setAirPlayServiceMode(ConnectSDK.AirPlayServiceMode.Media);
|
||||
|
||||
// Show devices that support playing videos and pausing
|
||||
//manager.setCapabilityFilters([
|
||||
@ -28,14 +28,10 @@
|
||||
|
||||
manager.startDiscovery();
|
||||
|
||||
requirejs(['thirdparty/cordova/chromecast']);
|
||||
requirejs(['thirdparty/cordova/chromecast', 'thirdparty/cordova/generaldevice']);
|
||||
}
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
|
||||
initSdk();
|
||||
|
||||
}, false);
|
||||
Dashboard.ready(initSdk);
|
||||
|
||||
|
||||
})();
|
566
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
Normal file
566
dashboard-ui/thirdparty/cordova/generaldevice.js
vendored
Normal file
@ -0,0 +1,566 @@
|
||||
(function () {
|
||||
|
||||
var currentPairingDeviceId;
|
||||
var currentDevice;
|
||||
|
||||
var PlayerName = "ConnectSDK";
|
||||
|
||||
function connectPlayer() {
|
||||
|
||||
var self = this;
|
||||
|
||||
// MediaController needs this
|
||||
self.name = PlayerName;
|
||||
|
||||
self.getItemsForPlayback = function (query) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
query.Limit = query.Limit || 100;
|
||||
query.ExcludeLocationTypes = "Virtual";
|
||||
|
||||
return ApiClient.getItems(userId, query);
|
||||
};
|
||||
|
||||
var castPlayer = {};
|
||||
|
||||
$(castPlayer).on("playbackstart", function (e, data) {
|
||||
|
||||
console.log('cc: playbackstart');
|
||||
|
||||
var state = self.getPlayerStateInternal(data);
|
||||
$(self).trigger("playbackstart", [state]);
|
||||
});
|
||||
|
||||
$(castPlayer).on("playbackstop", function (e, data) {
|
||||
|
||||
console.log('cc: playbackstop');
|
||||
var state = self.getPlayerStateInternal(data);
|
||||
|
||||
$(self).trigger("playbackstop", [state]);
|
||||
|
||||
// Reset this so the next query doesn't make it appear like content is playing.
|
||||
self.lastPlayerData = {};
|
||||
});
|
||||
|
||||
$(castPlayer).on("playbackprogress", function (e, data) {
|
||||
|
||||
console.log('cc: positionchange');
|
||||
var state = self.getPlayerStateInternal(data);
|
||||
|
||||
$(self).trigger("positionchange", [state]);
|
||||
});
|
||||
|
||||
self.play = function (options) {
|
||||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (options.items) {
|
||||
|
||||
self.playWithCommand(options, 'PlayNow');
|
||||
|
||||
} else {
|
||||
|
||||
self.getItemsForPlayback({
|
||||
|
||||
Ids: options.ids.join(',')
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
options.items = result.Items;
|
||||
self.playWithCommand(options, 'PlayNow');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.playWithCommand = function (options, command) {
|
||||
|
||||
if (!options.items) {
|
||||
ApiClient.getItem(Dashboard.getCurrentUserId(), options.ids[0]).done(function (item) {
|
||||
|
||||
options.items = [item];
|
||||
self.playWithCommand(options, command);
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
playInternal(options.items);
|
||||
};
|
||||
|
||||
function playInternal(items, serverAddress) {
|
||||
|
||||
playItemInternal(items[0], null, serverAddress);
|
||||
|
||||
}
|
||||
|
||||
function playItemInternal(items, startPosition) {
|
||||
|
||||
if (item == null) {
|
||||
throw new Error("item cannot be null");
|
||||
}
|
||||
|
||||
if (item.MediaType !== 'Audio' && item.MediaType !== 'Video') {
|
||||
throw new Error("Unrecognized media type");
|
||||
}
|
||||
|
||||
if (item.IsPlaceHolder) {
|
||||
MediaController.showPlaybackInfoErrorMessage('PlaceHolder');
|
||||
return;
|
||||
}
|
||||
|
||||
var deviceProfile = self.getDeviceProfile();
|
||||
|
||||
if (item.MediaType === "Video") {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
}
|
||||
|
||||
//getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) {
|
||||
|
||||
// if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||
|
||||
// var mediaSource = getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources);
|
||||
|
||||
// if (mediaSource) {
|
||||
|
||||
// if (mediaSource.RequiresOpening) {
|
||||
|
||||
// getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
||||
|
||||
// openLiveStreamResult.MediaSource.enableDirectPlay = supportsDirectPlay(openLiveStreamResult.MediaSource);
|
||||
|
||||
// playInternalPostMediaSourceSelection(item, openLiveStreamResult.MediaSource, startPosition, callback);
|
||||
// });
|
||||
|
||||
// } else {
|
||||
// playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback);
|
||||
// }
|
||||
// } else {
|
||||
// Dashboard.hideModalLoadingMsg();
|
||||
// MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
// }
|
||||
// }
|
||||
|
||||
//});
|
||||
}
|
||||
|
||||
self.unpause = function () {
|
||||
currentDevice.getMediaControl().play();
|
||||
};
|
||||
|
||||
self.pause = function () {
|
||||
currentDevice.getMediaControl().pause();
|
||||
};
|
||||
|
||||
self.shuffle = function (id) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
items: [item]
|
||||
|
||||
}, 'Shuffle');
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.instantMix = function (id) {
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
ApiClient.getItem(userId, id).done(function (item) {
|
||||
|
||||
self.playWithCommand({
|
||||
|
||||
items: [item]
|
||||
|
||||
}, 'InstantMix');
|
||||
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
self.canQueueMediaType = function (mediaType) {
|
||||
return false;
|
||||
};
|
||||
|
||||
self.queue = function (options) {
|
||||
};
|
||||
|
||||
self.queueNext = function (options) {
|
||||
};
|
||||
|
||||
self.stop = function () {
|
||||
currentDevice.getMediaControl().stop();
|
||||
};
|
||||
|
||||
self.displayContent = function (options) {
|
||||
|
||||
};
|
||||
|
||||
self.mute = function () {
|
||||
currentDevice.getVolumeControl().setMute(true);
|
||||
};
|
||||
|
||||
self.unMute = function () {
|
||||
currentDevice.getVolumeControl().setMute(false);
|
||||
};
|
||||
|
||||
self.toggleMute = function () {
|
||||
|
||||
var volumeControl = currentDevice.getVolumeControl();
|
||||
|
||||
volumeControl.setMute(!volumeControl.getMute());
|
||||
};
|
||||
|
||||
self.getDeviceProfile = function () {
|
||||
|
||||
var qualityOption = self.getVideoQualityOptions().filter(function (q) {
|
||||
return q.selected;
|
||||
})[0];
|
||||
|
||||
var bitrateSetting = AppSettings.maxStreamingBitrate();
|
||||
|
||||
var profile = {};
|
||||
|
||||
profile.MaxStreamingBitrate = bitrateSetting;
|
||||
profile.MaxStaticBitrate = 40000000;
|
||||
profile.MusicStreamingTranscodingBitrate = Math.min(bitrateSetting, 192000);
|
||||
|
||||
profile.DirectPlayProfiles = [];
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mp4,m4v',
|
||||
Type: 'Video',
|
||||
VideoCodec: 'h264',
|
||||
AudioCodec: 'aac,mp3,ac3'
|
||||
});
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mov',
|
||||
Type: 'Video'
|
||||
});
|
||||
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mp3',
|
||||
Type: 'Audio'
|
||||
});
|
||||
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'aac',
|
||||
Type: 'Audio'
|
||||
});
|
||||
|
||||
profile.TranscodingProfiles = [];
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'mp3',
|
||||
Type: 'Audio',
|
||||
AudioCodec: 'mp3',
|
||||
Context: 'Streaming',
|
||||
Protocol: 'http'
|
||||
});
|
||||
|
||||
if (self.canPlayHls()) {
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'ts',
|
||||
Type: 'Video',
|
||||
AudioCodec: 'aac',
|
||||
VideoCodec: 'h264',
|
||||
Context: 'Streaming',
|
||||
Protocol: 'hls'
|
||||
});
|
||||
}
|
||||
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'mp4',
|
||||
Type: 'Video',
|
||||
AudioCodec: 'aac',
|
||||
VideoCodec: 'h264',
|
||||
Context: 'Streaming',
|
||||
Protocol: 'http'
|
||||
});
|
||||
|
||||
profile.ContainerProfiles = [];
|
||||
|
||||
profile.CodecProfiles = [];
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'Audio',
|
||||
Conditions: [{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: '2'
|
||||
}]
|
||||
});
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
Codec: 'aac,mp3',
|
||||
Conditions: [
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: '6'
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'Video',
|
||||
Codec: 'h264',
|
||||
Conditions: [
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'IsAnamorphic',
|
||||
Value: 'true',
|
||||
IsRequired: false
|
||||
},
|
||||
{
|
||||
Condition: 'EqualsAny',
|
||||
Property: 'VideoProfile',
|
||||
Value: 'high|main|baseline|constrained baseline'
|
||||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoLevel',
|
||||
Value: '41'
|
||||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'Width',
|
||||
Value: qualityOption.maxWidth
|
||||
}]
|
||||
});
|
||||
|
||||
// Subtitle profiles
|
||||
profile.SubtitleProfiles = [];
|
||||
profile.ResponseProfiles = [];
|
||||
|
||||
profile.ResponseProfiles.push({
|
||||
Type: 'Video',
|
||||
Container: 'm4v',
|
||||
MimeType: 'video/mp4'
|
||||
});
|
||||
|
||||
//profile.ResponseProfiles.push({
|
||||
// Type: 'Video',
|
||||
// Container: 'mkv',
|
||||
// MimeType: 'video/webm'
|
||||
//});
|
||||
|
||||
return profile;
|
||||
};
|
||||
|
||||
|
||||
function getBaseTargetInfo() {
|
||||
var target = {};
|
||||
|
||||
target.playableMediaTypes = ["Audio", "Video"];
|
||||
target.isLocalPlayer = false;
|
||||
target.supportedCommands = [
|
||||
"VolumeUp",
|
||||
"VolumeDown",
|
||||
"Mute",
|
||||
"Unmute",
|
||||
"ToggleMute",
|
||||
"SetVolume"
|
||||
];
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function convertDeviceToTarget(device) {
|
||||
|
||||
var target = getBaseTargetInfo();
|
||||
|
||||
target.appName = target.name = target.deviceName = device.getFriendlyName();
|
||||
target.playerName = PlayerName;
|
||||
target.id = device.getId();
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
function isValid(device) {
|
||||
|
||||
var validTokens = ['AirPlay', 'Airplay', 'airplay'];
|
||||
|
||||
return validTokens.filter(function (t) {
|
||||
|
||||
return device.hasService(t);
|
||||
|
||||
}).length > 0;
|
||||
}
|
||||
|
||||
self.getTargets = function () {
|
||||
|
||||
var manager = ConnectSDK.discoveryManager;
|
||||
|
||||
return manager.getDeviceList().filter(function (d) {
|
||||
|
||||
return isValid(d);
|
||||
|
||||
}).map(convertDeviceToTarget);
|
||||
};
|
||||
|
||||
self.seek = function (position) {
|
||||
};
|
||||
|
||||
self.setAudioStreamIndex = function (index) {
|
||||
};
|
||||
|
||||
self.setSubtitleStreamIndex = function (index) {
|
||||
};
|
||||
|
||||
self.nextTrack = function () {
|
||||
};
|
||||
|
||||
self.previousTrack = function () {
|
||||
};
|
||||
|
||||
self.beginPlayerUpdates = function () {
|
||||
// Setup polling here
|
||||
};
|
||||
|
||||
self.endPlayerUpdates = function () {
|
||||
// Stop polling here
|
||||
};
|
||||
|
||||
function getCurrentVolume() {
|
||||
var state = self.lastPlayerData || {};
|
||||
state = state.PlayState || {};
|
||||
|
||||
return state.VolumeLevel == null ? 100 : state.VolumeLevel;
|
||||
}
|
||||
|
||||
self.volumeDown = function () {
|
||||
|
||||
currentDevice.getVolumeControl().volumeDown();
|
||||
};
|
||||
|
||||
self.volumeUp = function () {
|
||||
|
||||
currentDevice.getVolumeControl().volumeUp();
|
||||
};
|
||||
|
||||
self.setVolume = function (vol) {
|
||||
|
||||
vol = Math.min(vol, 100);
|
||||
vol = Math.max(vol, 0);
|
||||
|
||||
currentDevice.getVolumeControl().setVolume(vol / 100);
|
||||
};
|
||||
|
||||
self.getPlayerState = function () {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var result = self.getPlayerStateInternal();
|
||||
|
||||
deferred.resolveWith(null, [result]);
|
||||
|
||||
return deferred.promise();
|
||||
};
|
||||
|
||||
self.lastPlayerData = {};
|
||||
|
||||
self.getPlayerStateInternal = function (data) {
|
||||
|
||||
data = data || self.lastPlayerData;
|
||||
self.lastPlayerData = data;
|
||||
|
||||
console.log(JSON.stringify(data));
|
||||
return data;
|
||||
};
|
||||
|
||||
function onDisconnected(device) {
|
||||
|
||||
if (currentDevice && device.getId() == currentDevice.getId()) {
|
||||
MediaController.removeActiveTarget(device.getId());
|
||||
}
|
||||
}
|
||||
|
||||
function onDeviceReady(device) {
|
||||
|
||||
if (currentPairingDeviceId != device.getId()) {
|
||||
console.log('device ready fired for a different device. ignoring.');
|
||||
return;
|
||||
}
|
||||
|
||||
currentDevice = device;
|
||||
MediaController.setActivePlayer(PlayerName, convertDeviceToTarget(device));
|
||||
}
|
||||
|
||||
var boundHandlers = [];
|
||||
|
||||
self.tryPair = function (target) {
|
||||
|
||||
var deferred = $.Deferred();
|
||||
|
||||
var manager = ConnectSDK.discoveryManager;
|
||||
|
||||
var device = manager.getDeviceList().filter(function (d) {
|
||||
|
||||
return d.getId() == target.id;
|
||||
})[0];
|
||||
|
||||
if (device) {
|
||||
|
||||
var deviceId = device.getId();
|
||||
currentPairingDeviceId = deviceId;
|
||||
|
||||
console.log('Will attempt to connect to device');
|
||||
|
||||
if (device.isReady()) {
|
||||
console.log('Device is already ready, calling onDeviceReady');
|
||||
onDeviceReady(device);
|
||||
} else {
|
||||
|
||||
console.log('Binding device ready handler');
|
||||
|
||||
if (boundHandlers.indexOf(deviceId) == -1) {
|
||||
|
||||
boundHandlers.push(deviceId);
|
||||
device.on("ready", function () {
|
||||
console.log('device.ready fired');
|
||||
onDeviceReady(device);
|
||||
});
|
||||
device.on("disconnect", function () {
|
||||
console.log('device.disconnect fired');
|
||||
onDisconnected(device);
|
||||
});
|
||||
}
|
||||
|
||||
console.log('Calling device.connect');
|
||||
device.connect();
|
||||
}
|
||||
//deferred.resolve();
|
||||
|
||||
} else {
|
||||
deferred.reject();
|
||||
}
|
||||
|
||||
return deferred.promise();
|
||||
};
|
||||
|
||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||
|
||||
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
||||
MediaController.removeActiveTarget(currentDevice.getId());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initSdk() {
|
||||
|
||||
MediaController.registerPlayer(new connectPlayer());
|
||||
}
|
||||
|
||||
initSdk();
|
||||
|
||||
})();
|
@ -157,22 +157,17 @@
|
||||
.on('positionchange.cordovaremote', onStateChanged);
|
||||
}
|
||||
|
||||
console.log('binding remotecontrols to MediaController');
|
||||
|
||||
document.addEventListener("deviceready", function () {
|
||||
Dashboard.ready(function () {
|
||||
|
||||
console.log('binding remotecontrols to MediaController');
|
||||
|
||||
$(function () {
|
||||
|
||||
$(MediaController).on('playerchange', function () {
|
||||
|
||||
bindToPlayer(MediaController.getCurrentPlayer());
|
||||
});
|
||||
$(MediaController).on('playerchange', function () {
|
||||
|
||||
bindToPlayer(MediaController.getCurrentPlayer());
|
||||
});
|
||||
|
||||
}, false);
|
||||
bindToPlayer(MediaController.getCurrentPlayer());
|
||||
|
||||
});
|
||||
|
||||
})();
|
@ -8,9 +8,9 @@
|
||||
|
||||
<div class="libraryViewNav globalNav" style="display: none;">
|
||||
<a href="index.html">${TabHome}</a>
|
||||
<a href="homelatest.html" class="homeLatestTab">${TabLatest}</a>
|
||||
<a href="homelatest.html">${TabLatest}</a>
|
||||
<a href="#" class="ui-btn-active">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="homeFavoritesTab">${TabFavorites}</a>
|
||||
<a href="favorites.html">${TabFavorites}</a>
|
||||
<a href="tvupcoming.html">${TabUpcoming}</a>
|
||||
</div>
|
||||
<div class="libraryViewNav scopedLibraryViewNav" style="display: none;">
|
||||
|
@ -7,9 +7,9 @@
|
||||
<div id="tvUpcomingPage" data-role="page" class="page libraryPage backdropPage" data-backdroptype="series" data-require="scripts/tvupcoming">
|
||||
<div class="libraryViewNav globalNav" style="display: none;">
|
||||
<a href="index.html">${TabHome}</a>
|
||||
<a href="homelatest.html" class="homeLatestTab">${TabLatest}</a>
|
||||
<a href="homelatest.html">${TabLatest}</a>
|
||||
<a href="tvrecommended.html">${TabNextUp}</a>
|
||||
<a href="favorites.html" class="homeFavoritesTab">${TabFavorites}</a>
|
||||
<a href="favorites.html">${TabFavorites}</a>
|
||||
<a href="#" class="ui-btn-active">${TabUpcoming}</a>
|
||||
</div>
|
||||
<div class="libraryViewNav scopedLibraryViewNav" style="display: none;">
|
||||
|
Loading…
Reference in New Issue
Block a user