mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
hls updates
This commit is contained in:
parent
bbdbdf346e
commit
9fc4c86111
19 changed files with 255 additions and 246 deletions
|
@ -52,7 +52,7 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 1000px) {
|
@media all and (max-width: 740px) {
|
||||||
.headerSelectedPlayer {
|
.headerSelectedPlayer {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.homePageSection + .homePageSection {
|
.homePageSection + .homePageSection {
|
||||||
margin-top: 1em;
|
margin-top: .25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sectionHeaderButton {
|
.sectionHeaderButton {
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
-webkit-overflow-scrolling: touch;
|
-webkit-overflow-scrolling: touch;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottomLibraryViewNav {
|
.bottomSecondaryNav .libraryViewNav {
|
||||||
top: initial;
|
top: initial;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
border-top: 1px solid #444;
|
border-top: 1px solid #444;
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
border-bottom: 5px solid transparent;
|
border-bottom: 5px solid transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
.bottomLibraryViewNav a {
|
.bottomSecondaryNav .libraryViewNav a {
|
||||||
padding: 12px 0 12px;
|
padding: 12px 0 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
max-width: 170px;
|
max-width: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 800px) {
|
@media (min-width: 800px) {
|
||||||
|
|
|
@ -1,18 +1,13 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
function onLoggedIn() {
|
|
||||||
|
|
||||||
Dashboard.hideModalLoadingMsg();
|
|
||||||
Dashboard.navigate('selectserver.html');
|
|
||||||
}
|
|
||||||
|
|
||||||
function login(page, username, password) {
|
function login(page, username, password) {
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
ConnectionManager.loginToConnect(username, password).done(function () {
|
ConnectionManager.loginToConnect(username, password).done(function () {
|
||||||
|
|
||||||
onLoggedIn();
|
Dashboard.hideModalLoadingMsg();
|
||||||
|
Dashboard.navigate('selectserver.html');
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
|
|
||||||
|
@ -39,7 +34,7 @@
|
||||||
{
|
{
|
||||||
var apiClient = result.ApiClient;
|
var apiClient = result.ApiClient;
|
||||||
|
|
||||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||||
Dashboard.navigate('index.html');
|
Dashboard.navigate('index.html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -50,7 +45,7 @@
|
||||||
break;
|
break;
|
||||||
case MediaBrowser.ConnectionState.ServerSelection:
|
case MediaBrowser.ConnectionState.ServerSelection:
|
||||||
{
|
{
|
||||||
onLoggedIn();
|
Dashboard.navigate('selectserver.html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MediaBrowser.ConnectionState.ConnectSignIn:
|
case MediaBrowser.ConnectionState.ConnectSignIn:
|
||||||
|
|
|
@ -50,8 +50,10 @@
|
||||||
|
|
||||||
var apiClient = ApiClient;
|
var apiClient = ApiClient;
|
||||||
|
|
||||||
|
if (apiClient) {
|
||||||
$(apiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
$(apiClient).off("websocketmessage", DashboardPage.onWebSocketMessage).off("websocketopen", DashboardPage.onWebSocketConnectionChange).off("websocketerror", DashboardPage.onWebSocketConnectionChange).off("websocketclose", DashboardPage.onWebSocketConnectionChange);
|
||||||
DashboardPage.stopInterval(apiClient);
|
DashboardPage.stopInterval(apiClient);
|
||||||
|
}
|
||||||
|
|
||||||
if (DashboardPage.sessionUpdateTimer) {
|
if (DashboardPage.sessionUpdateTimer) {
|
||||||
clearInterval(DashboardPage.sessionUpdateTimer);
|
clearInterval(DashboardPage.sessionUpdateTimer);
|
||||||
|
@ -1280,7 +1282,11 @@ $(document).on('pagebeforeshowready', "#dashboardPage", DashboardPage.onPageShow
|
||||||
createList(this);
|
createList(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
startListening(ApiClient);
|
var apiClient = ApiClient;
|
||||||
|
|
||||||
|
if (apiClient) {
|
||||||
|
startListening(apiClient);
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
|
@ -807,7 +807,7 @@
|
||||||
var innerElem = $('.cardOverlayTarget', elem);
|
var innerElem = $('.cardOverlayTarget', elem);
|
||||||
|
|
||||||
var dataElement = elem;
|
var dataElement = elem;
|
||||||
while (!dataElement.getAttribute('data-itemid')) {
|
while (dataElement && !dataElement.getAttribute('data-itemid')) {
|
||||||
dataElement = dataElement.parentNode;
|
dataElement = dataElement.parentNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var requiresLibraryMenuRefresh = false;
|
var requiresLibraryMenuRefresh = false;
|
||||||
|
var requiresViewMenuRefresh = false;
|
||||||
|
|
||||||
function getLibraryMenu(user) {
|
function getLibraryMenu(user) {
|
||||||
|
|
||||||
|
@ -460,7 +461,7 @@
|
||||||
|
|
||||||
function updateContextText(page) {
|
function updateContextText(page) {
|
||||||
|
|
||||||
var name = page.getAttribute('data-contextname');
|
var name = $(page)[0].getAttribute('data-contextname');
|
||||||
|
|
||||||
if (name) {
|
if (name) {
|
||||||
|
|
||||||
|
@ -490,21 +491,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', ".page", function () {
|
function buildViewMenuBar(page) {
|
||||||
|
|
||||||
var page = this;
|
if ($(page).hasClass('standalonePage')) {
|
||||||
|
$('.viewMenuBar').remove();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$('.libraryViewNav', page).wrapInner('<div class="libraryViewNavInner"></div>');
|
if (requiresViewMenuRefresh) {
|
||||||
|
$('.viewMenuBar').remove();
|
||||||
|
}
|
||||||
|
|
||||||
$('.libraryViewNav a', page).each(function () {
|
|
||||||
|
|
||||||
this.innerHTML = '<span class="libraryViewNavLinkContent">' + this.innerHTML + '</span>';
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}).on('pagebeforeshowready', ".page:not(.standalonePage)", function () {
|
|
||||||
|
|
||||||
var page = this;
|
|
||||||
var viewMenuBar = $('.viewMenuBar');
|
var viewMenuBar = $('.viewMenuBar');
|
||||||
if (!$('.viewMenuBar').length) {
|
if (!$('.viewMenuBar').length) {
|
||||||
|
|
||||||
|
@ -517,30 +514,42 @@
|
||||||
|
|
||||||
updateLibraryNavLinks(page);
|
updateLibraryNavLinks(page);
|
||||||
updateContextText(page);
|
updateContextText(page);
|
||||||
|
requiresViewMenuRefresh = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateContextText(page);
|
updateContextText(page);
|
||||||
updateLibraryNavLinks(page);
|
updateLibraryNavLinks(page);
|
||||||
updateViewMenuBarHeadroom(page, viewMenuBar);
|
updateViewMenuBarHeadroom(page, viewMenuBar);
|
||||||
|
requiresViewMenuRefresh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var jpage = $(page);
|
|
||||||
|
|
||||||
if (jpage.hasClass('libraryPage')) {
|
|
||||||
$(document.body).addClass('libraryDocument').removeClass('dashboardDocument');
|
|
||||||
}
|
|
||||||
else if (jpage.hasClass('type-interior')) {
|
|
||||||
$(document.body).addClass('dashboardDocument').removeClass('libraryDocument');
|
|
||||||
} else {
|
|
||||||
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}).on('pagebeforeshowready', ".libraryPage", function () {
|
$(document).on('pageinit', ".page", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
$('.libraryViewNav', page).wrapInner('<div class="libraryViewNavInner"></div>');
|
||||||
|
|
||||||
|
$('.libraryViewNav a', page).each(function () {
|
||||||
|
|
||||||
|
this.innerHTML = '<span class="libraryViewNavLinkContent">' + this.innerHTML + '</span>';
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}).on('pagebeforeshowready', ".page", function () {
|
||||||
|
|
||||||
|
var page = this;
|
||||||
|
buildViewMenuBar(page);
|
||||||
|
|
||||||
|
var jpage = $(page);
|
||||||
|
|
||||||
|
var isLibraryPage = jpage.hasClass('libraryPage');
|
||||||
|
|
||||||
|
if (isLibraryPage) {
|
||||||
|
$(document.body).addClass('libraryDocument').removeClass('dashboardDocument');
|
||||||
|
|
||||||
if (AppInfo.enableBottomTabs) {
|
if (AppInfo.enableBottomTabs) {
|
||||||
$('.libraryViewNav', page).addClass('bottomLibraryViewNav');
|
|
||||||
$(page).addClass('noSecondaryNavPage');
|
$(page).addClass('noSecondaryNavPage');
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
|
@ -555,6 +564,12 @@
|
||||||
initHeadRoom(this);
|
initHeadRoom(this);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (jpage.hasClass('type-interior')) {
|
||||||
|
$(document.body).addClass('dashboardDocument').removeClass('libraryDocument');
|
||||||
|
} else {
|
||||||
|
$(document.body).removeClass('dashboardDocument').removeClass('libraryDocument');
|
||||||
|
}
|
||||||
|
|
||||||
}).on('pageshow', ".libraryPage", function () {
|
}).on('pageshow', ".libraryPage", function () {
|
||||||
|
|
||||||
|
@ -601,8 +616,8 @@
|
||||||
initializeApiClient(apiClient);
|
initializeApiClient(apiClient);
|
||||||
|
|
||||||
}).on('localusersignedin localusersignedout', function () {
|
}).on('localusersignedin localusersignedout', function () {
|
||||||
$('.viewMenuBar').remove();
|
|
||||||
requiresLibraryMenuRefresh = true;
|
requiresLibraryMenuRefresh = true;
|
||||||
|
requiresViewMenuRefresh = true;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -105,12 +105,12 @@
|
||||||
var newUrl;
|
var newUrl;
|
||||||
|
|
||||||
if (user.Policy.IsAdministrator && !serverId) {
|
if (user.Policy.IsAdministrator && !serverId) {
|
||||||
newUrl = "dashboard.html?u=" + user.Id + '&t=' + result.AccessToken;
|
newUrl = "dashboard.html";
|
||||||
} else {
|
} else {
|
||||||
newUrl = "index.html?u=" + user.Id + '&t=' + result.AccessToken;
|
newUrl = "index.html";
|
||||||
}
|
}
|
||||||
|
|
||||||
Dashboard.onServerChanged(apiClient.serverAddress(), user.Id, result.AccessToken, apiClient);
|
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||||
Dashboard.navigate(newUrl);
|
Dashboard.navigate(newUrl);
|
||||||
|
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
case MediaBrowser.ConnectionState.SignedIn:
|
case MediaBrowser.ConnectionState.SignedIn:
|
||||||
{
|
{
|
||||||
Dashboard.onServerChanged(apiClient.serverAddress(), apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||||
Dashboard.navigate('index.html');
|
Dashboard.navigate('index.html');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
{
|
{
|
||||||
if (Dashboard.isRunningInCordova()) {
|
if (Dashboard.isRunningInCordova()) {
|
||||||
|
|
||||||
Dashboard.onServerChanged(apiClient.serverAddress(), null, null, apiClient);
|
Dashboard.onServerChanged(null, null, apiClient);
|
||||||
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
|
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id);
|
||||||
} else {
|
} else {
|
||||||
showServerConnectionFailure();
|
showServerConnectionFailure();
|
||||||
|
|
|
@ -104,13 +104,6 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onApiClientServerAddressChanged: function () {
|
|
||||||
|
|
||||||
var apiClient = this;
|
|
||||||
|
|
||||||
Dashboard.serverAddress(apiClient.serverAddress());
|
|
||||||
},
|
|
||||||
|
|
||||||
getCurrentUser: function () {
|
getCurrentUser: function () {
|
||||||
|
|
||||||
if (!Dashboard.getUserPromise) {
|
if (!Dashboard.getUserPromise) {
|
||||||
|
@ -130,23 +123,17 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getAccessToken: function () {
|
serverAddress: function () {
|
||||||
|
|
||||||
return store.getItem('token');
|
if (Dashboard.isConnectMode()) {
|
||||||
},
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
serverAddress: function (val) {
|
if (apiClient) {
|
||||||
|
return apiClient.serverAddress();
|
||||||
if (val != null) {
|
|
||||||
|
|
||||||
console.log('Setting server address to: ' + val);
|
|
||||||
|
|
||||||
store.setItem('serverAddress', val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var address = store.getItem('serverAddress');
|
return null;
|
||||||
|
}
|
||||||
if (!address && !Dashboard.isConnectMode()) {
|
|
||||||
|
|
||||||
// Try to get the server address from the browser url
|
// Try to get the server address from the browser url
|
||||||
// This will preserve protocol, hostname, port and subdirectory
|
// This will preserve protocol, hostname, port and subdirectory
|
||||||
|
@ -157,57 +144,43 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index != -1) {
|
if (index != -1) {
|
||||||
address = urlLower.substring(0, index);
|
return urlLower.substring(0, index);
|
||||||
return address;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the above failed, just piece it together manually
|
// If the above failed, just piece it together manually
|
||||||
var loc = window.location;
|
var loc = window.location;
|
||||||
|
|
||||||
address = loc.protocol + '//' + loc.hostname;
|
var address = loc.protocol + '//' + loc.hostname;
|
||||||
|
|
||||||
if (loc.port) {
|
if (loc.port) {
|
||||||
address += ':' + loc.port;
|
address += ':' + loc.port;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
},
|
},
|
||||||
|
|
||||||
getCurrentUserId: function () {
|
getCurrentUserId: function () {
|
||||||
|
|
||||||
var autoLoginUserId = getParameterByName('u');
|
|
||||||
|
|
||||||
var storedUserId = store.getItem("userId");
|
|
||||||
|
|
||||||
if (autoLoginUserId && autoLoginUserId != storedUserId) {
|
|
||||||
|
|
||||||
var token = getParameterByName('t');
|
|
||||||
Dashboard.setCurrentUser(autoLoginUserId, token);
|
|
||||||
}
|
|
||||||
|
|
||||||
return autoLoginUserId || storedUserId;
|
|
||||||
},
|
|
||||||
|
|
||||||
setCurrentUser: function (userId, token) {
|
|
||||||
|
|
||||||
store.setItem("userId", userId);
|
|
||||||
store.setItem("token", token);
|
|
||||||
|
|
||||||
var apiClient = window.ApiClient;
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
if (apiClient) {
|
if (apiClient) {
|
||||||
apiClient.setCurrentUserId(userId, token);
|
return apiClient.getCurrentUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
|
onServerChanged: function (userId, accessToken, apiClient) {
|
||||||
|
|
||||||
|
apiClient = apiClient || window.ApiClient;
|
||||||
|
|
||||||
|
window.ApiClient = apiClient;
|
||||||
|
|
||||||
Dashboard.getUserPromise = null;
|
Dashboard.getUserPromise = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
logout: function (logoutWithServer, forceReload) {
|
logout: function (logoutWithServer, forceReload) {
|
||||||
|
|
||||||
store.removeItem("userId");
|
|
||||||
store.removeItem("token");
|
|
||||||
store.removeItem("serverAddress");
|
|
||||||
|
|
||||||
function onLogoutDone() {
|
function onLogoutDone() {
|
||||||
|
|
||||||
var loginPage;
|
var loginPage;
|
||||||
|
@ -594,9 +567,11 @@ var Dashboard = {
|
||||||
|
|
||||||
refreshSystemInfoFromServer: function () {
|
refreshSystemInfoFromServer: function () {
|
||||||
|
|
||||||
if (Dashboard.getAccessToken()) {
|
var apiClient = ApiClient;
|
||||||
if (AppInfo.enableFooterNotifications) {
|
|
||||||
ApiClient.getSystemInfo().done(function (info) {
|
if (apiClient.accessToken()) {
|
||||||
|
if (apiClient.enableFooterNotifications) {
|
||||||
|
apiClient.getSystemInfo().done(function (info) {
|
||||||
|
|
||||||
Dashboard.updateSystemInfo(info);
|
Dashboard.updateSystemInfo(info);
|
||||||
});
|
});
|
||||||
|
@ -1040,14 +1015,14 @@ var Dashboard = {
|
||||||
Dashboard.updateSystemInfo(msg.Data);
|
Dashboard.updateSystemInfo(msg.Data);
|
||||||
}
|
}
|
||||||
else if (msg.MessageType === "UserUpdated" || msg.MessageType === "UserConfigurationUpdated") {
|
else if (msg.MessageType === "UserUpdated" || msg.MessageType === "UserConfigurationUpdated") {
|
||||||
Dashboard.validateCurrentUser();
|
|
||||||
|
|
||||||
var user = msg.Data;
|
var user = msg.Data;
|
||||||
|
|
||||||
if (user.Id == Dashboard.getCurrentUserId()) {
|
if (user.Id == Dashboard.getCurrentUserId()) {
|
||||||
|
|
||||||
|
Dashboard.validateCurrentUser();
|
||||||
$('.currentUsername').html(user.Name);
|
$('.currentUsername').html(user.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (msg.MessageType === "PackageInstallationCompleted") {
|
else if (msg.MessageType === "PackageInstallationCompleted") {
|
||||||
Dashboard.getCurrentUser().done(function (currentUser) {
|
Dashboard.getCurrentUser().done(function (currentUser) {
|
||||||
|
@ -1076,7 +1051,7 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (msg.MessageType === "PackageInstalling") {
|
else if (msg.MessaapiclientcgeType === "PackageInstalling") {
|
||||||
Dashboard.getCurrentUser().done(function (currentUser) {
|
Dashboard.getCurrentUser().done(function (currentUser) {
|
||||||
|
|
||||||
if (currentUser.Policy.IsAdministrator) {
|
if (currentUser.Policy.IsAdministrator) {
|
||||||
|
@ -1492,17 +1467,7 @@ var Dashboard = {
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
},
|
},
|
||||||
|
|
||||||
onServerChanged: function (serverAddress, userId, accessToken, apiClient) {
|
ready: function (fn) {
|
||||||
|
|
||||||
window.ApiClient = apiClient;
|
|
||||||
if (Dashboard.isConnectMode()) {
|
|
||||||
Dashboard.serverAddress(serverAddress);
|
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.setCurrentUser(userId, accessToken);
|
|
||||||
},
|
|
||||||
|
|
||||||
ready: function(fn) {
|
|
||||||
|
|
||||||
if (Dashboard.initPromiseDone) {
|
if (Dashboard.initPromiseDone) {
|
||||||
fn();
|
fn();
|
||||||
|
@ -1593,8 +1558,7 @@ var AppInfo = {};
|
||||||
|
|
||||||
$(apiClient).off('.dashboard')
|
$(apiClient).off('.dashboard')
|
||||||
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
|
.on("websocketmessage.dashboard", Dashboard.onWebSocketMessageReceived)
|
||||||
.on('requestfail.dashboard', Dashboard.onRequestFail)
|
.on('requestfail.dashboard', Dashboard.onRequestFail);
|
||||||
.on('serveraddresschanged.dashboard', Dashboard.onApiClientServerAddressChanged);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function createConnectionManager(appInfo) {
|
function createConnectionManager(appInfo) {
|
||||||
|
@ -1605,41 +1569,36 @@ var AppInfo = {};
|
||||||
|
|
||||||
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
|
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
|
||||||
|
|
||||||
if (Dashboard.isConnectMode()) {
|
|
||||||
|
|
||||||
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) {
|
||||||
|
|
||||||
initializeApiClient(apiClient);
|
initializeApiClient(apiClient);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var lastApiClient = ConnectionManager.getLastUsedApiClient();
|
||||||
|
|
||||||
|
if (Dashboard.isConnectMode()) {
|
||||||
|
|
||||||
if (!Dashboard.isServerlessPage()) {
|
if (!Dashboard.isServerlessPage()) {
|
||||||
|
|
||||||
if (Dashboard.serverAddress() && Dashboard.getCurrentUserId() && Dashboard.getAccessToken()) {
|
if (lastApiClient && lastApiClient.serverAddress() && lastApiClient.getCurrentUserId() && lastApiClient.accessToken()) {
|
||||||
|
|
||||||
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
window.ApiClient = lastApiClient;
|
||||||
|
|
||||||
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
initializeApiClient(lastApiClient);
|
||||||
|
|
||||||
initializeApiClient(ApiClient);
|
//ConnectionManager.addApiClient(lastApiClient, true).fail(Dashboard.logout);
|
||||||
|
|
||||||
ConnectionManager.addApiClient(ApiClient, true).fail(Dashboard.logout);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
Dashboard.logout();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
window.ApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
if (!lastApiClient) {
|
||||||
|
lastApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
|
||||||
|
ConnectionManager.addApiClient(lastApiClient);
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.setCurrentUserId(Dashboard.getCurrentUserId(), Dashboard.getAccessToken());
|
window.ApiClient = lastApiClient;
|
||||||
|
|
||||||
initializeApiClient(ApiClient);
|
|
||||||
|
|
||||||
ConnectionManager.addApiClient(ApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.ApiClient) {
|
if (window.ApiClient) {
|
||||||
|
@ -1835,7 +1794,7 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(deferred, appName, deviceId, deviceName) {
|
function init(deferred, appName, deviceId, deviceName, resolveOnReady) {
|
||||||
|
|
||||||
requirejs.config({
|
requirejs.config({
|
||||||
map: {
|
map: {
|
||||||
|
@ -1857,9 +1816,17 @@ var AppInfo = {};
|
||||||
|
|
||||||
createConnectionManager(appInfo);
|
createConnectionManager(appInfo);
|
||||||
|
|
||||||
|
if (!resolveOnReady) {
|
||||||
Dashboard.initPromiseDone = true;
|
Dashboard.initPromiseDone = true;
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
$(onDocumentReady);
|
}
|
||||||
|
$(function () {
|
||||||
|
onDocumentReady();
|
||||||
|
if (resolveOnReady) {
|
||||||
|
Dashboard.initPromiseDone = true;
|
||||||
|
deferred.resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCordovaWithDeviceId(deferred, deviceId) {
|
function initCordovaWithDeviceId(deferred, deviceId) {
|
||||||
|
@ -1867,7 +1834,7 @@ var AppInfo = {};
|
||||||
requirejs(['thirdparty/cordova/imagestore.js']);
|
requirejs(['thirdparty/cordova/imagestore.js']);
|
||||||
}
|
}
|
||||||
|
|
||||||
init(deferred, "Emby Mobile", deviceId, device.model);
|
init(deferred, "Emby Mobile", deviceId, device.model, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCordova(deferred) {
|
function initCordova(deferred) {
|
||||||
|
@ -1974,15 +1941,14 @@ $(document).on('pagecreate', ".page", function () {
|
||||||
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
Dashboard.firePageEvent(page, 'pagebeforeshowready');
|
||||||
}
|
}
|
||||||
|
|
||||||
}).on('pagebeforeshow', ".page", function () {
|
}).on('pagebeforeshowready', ".page", function () {
|
||||||
|
|
||||||
var page = $(this);
|
var page = $(this);
|
||||||
|
|
||||||
var apiClient = window.ApiClient;
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
if (Dashboard.getAccessToken() && Dashboard.getCurrentUserId()) {
|
if (apiClient && apiClient.accessToken() && Dashboard.getCurrentUserId()) {
|
||||||
|
|
||||||
if (apiClient) {
|
|
||||||
Dashboard.getCurrentUser().done(function (user) {
|
Dashboard.getCurrentUser().done(function (user) {
|
||||||
|
|
||||||
var isSettingsPage = page.hasClass('type-interior');
|
var isSettingsPage = page.hasClass('type-interior');
|
||||||
|
@ -1996,7 +1962,6 @@ $(document).on('pagecreate', ".page", function () {
|
||||||
Dashboard.ensureToolsMenu(page, user);
|
Dashboard.ensureToolsMenu(page, user);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
Dashboard.ensureHeader(page);
|
Dashboard.ensureHeader(page);
|
||||||
Dashboard.ensurePageTitle(page);
|
Dashboard.ensurePageTitle(page);
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
$(document).on('pageshowready', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
|
@ -255,14 +255,19 @@ $(document).on('pageshow', "#supporterKeyPage", SupporterKeyPage.onPageShow);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', "#supporterKeyPage", function () {
|
$(document).on('pageinitdepends', "#supporterKeyPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
$('#btnAddConnectUser', page).on('click', function () {
|
$('#btnAddConnectUser', page).on('click', function () {
|
||||||
showAddUserForm(page);
|
showAddUserForm(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
}).on('pageshow', "#supporterKeyPage", function () {
|
$('#supporterKeyForm').on('submit', SupporterKeyPage.updateSupporterKey);
|
||||||
|
$('#lostKeyForm').on('submit', SupporterKeyPage.retrieveSupporterKey);
|
||||||
|
$('#linkKeysForm').on('submit', SupporterKeyPage.linkSupporterKeys);
|
||||||
|
$('.popupAddUserForm').on('submit', SupporterKeyPage.onAddConnectUserSubmit).on('submit', SupporterKeyPage.onAddConnectUserSubmit);
|
||||||
|
|
||||||
|
}).on('pageshowready', "#supporterKeyPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
loadConnectSupporters(page);
|
loadConnectSupporters(page);
|
||||||
|
|
|
@ -387,7 +387,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', ".libraryPage", function () {
|
$(document).on('pageinitdepends', ".libraryPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@
|
||||||
onCategorySyncButtonClick(page, this);
|
onCategorySyncButtonClick(page, this);
|
||||||
});
|
});
|
||||||
|
|
||||||
}).on('pagebeforeshow', ".libraryPage", function () {
|
}).on('pagebeforeshowready', ".libraryPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<title>${TitleSupport}</title>
|
<title>${TitleSupport}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="supporterKeyPage" data-role="page" class="page type-interior">
|
<div id="supporterKeyPage" data-role="page" class="page type-interior" data-require="scripts/supporterkeypage">
|
||||||
|
|
||||||
<div data-role="content">
|
<div data-role="content">
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
|
@ -132,13 +132,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$('#supporterKeyForm').on('submit', SupporterKeyPage.updateSupporterKey);
|
|
||||||
$('#lostKeyForm').on('submit', SupporterKeyPage.retrieveSupporterKey);
|
|
||||||
$('#linkKeysForm').on('submit', SupporterKeyPage.linkSupporterKeys);
|
|
||||||
$('.popupAddUserForm').on('submit', SupporterKeyPage.onAddConnectUserSubmit).on('submit', SupporterKeyPage.onAddConnectUserSubmit);
|
|
||||||
</script>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
62
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
62
dashboard-ui/thirdparty/apiclient/apiclient.js
vendored
|
@ -7,7 +7,7 @@
|
||||||
/**
|
/**
|
||||||
* Creates a new api client instance
|
* Creates a new api client instance
|
||||||
* @param {String} serverAddress
|
* @param {String} serverAddress
|
||||||
* @param {String} clientName
|
* @param {String} clientName s
|
||||||
* @param {String} applicationVersion
|
* @param {String} applicationVersion
|
||||||
*/
|
*/
|
||||||
globalScope.MediaBrowser.ApiClient = function (logger, serverAddress, clientName, applicationVersion, deviceName, deviceId) {
|
globalScope.MediaBrowser.ApiClient = function (logger, serverAddress, clientName, applicationVersion, deviceName, deviceId) {
|
||||||
|
@ -23,10 +23,8 @@
|
||||||
logger.log('ApiClient deviceId: ' + deviceId);
|
logger.log('ApiClient deviceId: ' + deviceId);
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var currentUserId;
|
|
||||||
var accessToken;
|
|
||||||
var webSocket;
|
var webSocket;
|
||||||
var serverInfo;
|
var serverInfo = {};
|
||||||
|
|
||||||
self.enableAppStorePolicy = false;
|
self.enableAppStorePolicy = false;
|
||||||
|
|
||||||
|
@ -37,6 +35,10 @@
|
||||||
|
|
||||||
if (val != null) {
|
if (val != null) {
|
||||||
|
|
||||||
|
if (val.toLowerCase().indexOf('http') != 0) {
|
||||||
|
throw new Error('Invalid url: ' + val);
|
||||||
|
}
|
||||||
|
|
||||||
var changed = val != serverAddress;
|
var changed = val != serverAddress;
|
||||||
|
|
||||||
serverAddress = val;
|
serverAddress = val;
|
||||||
|
@ -81,18 +83,11 @@
|
||||||
*/
|
*/
|
||||||
self.getCurrentUserId = function () {
|
self.getCurrentUserId = function () {
|
||||||
|
|
||||||
return currentUserId;
|
return serverInfo.UserId;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.accessToken = function () {
|
self.accessToken = function () {
|
||||||
return accessToken;
|
return serverInfo.AccessToken;
|
||||||
};
|
|
||||||
|
|
||||||
self.setCurrentUserId = function (userId, token) {
|
|
||||||
|
|
||||||
currentUserId = userId;
|
|
||||||
currentUserPromise = null;
|
|
||||||
accessToken = token;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.deviceName = function () {
|
self.deviceName = function () {
|
||||||
|
@ -104,13 +99,14 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
self.clearAuthenticationInfo = function () {
|
self.clearAuthenticationInfo = function () {
|
||||||
accessToken = null;
|
self.setAuthenticationInfo(null, null);
|
||||||
currentUserId = null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.setAuthenticationInfo = function (accessKey, userId) {
|
self.setAuthenticationInfo = function (accessKey, userId) {
|
||||||
accessToken = accessKey;
|
currentUserPromise = null;
|
||||||
currentUserId = userId;
|
|
||||||
|
serverInfo.AccessToken = accessKey;
|
||||||
|
serverInfo.UserId = userId;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.encodeName = function (name) {
|
self.encodeName = function (name) {
|
||||||
|
@ -156,8 +152,10 @@
|
||||||
|
|
||||||
var auth = 'MediaBrowser Client="' + clientName + '", Device="' + deviceName + '", DeviceId="' + deviceId + '", Version="' + applicationVersion + '"';
|
var auth = 'MediaBrowser Client="' + clientName + '", Device="' + deviceName + '", DeviceId="' + deviceId + '", Version="' + applicationVersion + '"';
|
||||||
|
|
||||||
if (currentUserId) {
|
var userId = serverInfo.UserId;
|
||||||
auth += ', UserId="' + currentUserId + '"';
|
|
||||||
|
if (userId) {
|
||||||
|
auth += ', UserId="' + userId + '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
request.headers = {
|
request.headers = {
|
||||||
|
@ -165,12 +163,14 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var accessToken = serverInfo.AccessToken;
|
||||||
|
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
request.headers['X-MediaBrowser-Token'] = accessToken;
|
request.headers['X-MediaBrowser-Token'] = accessToken;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.enableAutomaticNetwork || !self.serverInfo() || self.connectionMode == null) {
|
if (!self.enableAutomaticNetwork || self.connectionMode == null) {
|
||||||
logger.log('Requesting url without automatic networking: ' + request.url);
|
logger.log('Requesting url without automatic networking: ' + request.url);
|
||||||
return AjaxApi.ajax(request).fail(onRequestFail);
|
return AjaxApi.ajax(request).fail(onRequestFail);
|
||||||
}
|
}
|
||||||
|
@ -332,6 +332,10 @@
|
||||||
|
|
||||||
var url = serverAddress;
|
var url = serverAddress;
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
throw new Error("serverAddress is yet not set");
|
||||||
|
}
|
||||||
|
|
||||||
if (name.charAt(0) != '/') {
|
if (name.charAt(0) != '/') {
|
||||||
url += '/';
|
url += '/';
|
||||||
}
|
}
|
||||||
|
@ -347,6 +351,18 @@
|
||||||
|
|
||||||
self.enableAutomaticNetworking = function (server, connectionMode, serverUrl) {
|
self.enableAutomaticNetworking = function (server, connectionMode, serverUrl) {
|
||||||
|
|
||||||
|
if (server == null) {
|
||||||
|
throw new Error('server cannot be null');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (connectionMode == null) {
|
||||||
|
throw new Error('connectionMode cannot be null');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!serverUrl) {
|
||||||
|
throw new Error('serverUrl cannot be null or empty');
|
||||||
|
}
|
||||||
|
|
||||||
logger.log('Begin enableAutomaticNetworking');
|
logger.log('Begin enableAutomaticNetworking');
|
||||||
|
|
||||||
self.serverInfo(server);
|
self.serverInfo(server);
|
||||||
|
@ -363,6 +379,8 @@
|
||||||
|
|
||||||
self.openWebSocket = function () {
|
self.openWebSocket = function () {
|
||||||
|
|
||||||
|
var accessToken = serverInfo.AccessToken;
|
||||||
|
|
||||||
if (!accessToken) {
|
if (!accessToken) {
|
||||||
throw new Error("Cannot open web socket without access token.");
|
throw new Error("Cannot open web socket without access token.");
|
||||||
}
|
}
|
||||||
|
@ -557,10 +575,10 @@
|
||||||
self.closeWebSocket();
|
self.closeWebSocket();
|
||||||
|
|
||||||
var done = function () {
|
var done = function () {
|
||||||
self.setCurrentUserId(null, null);
|
self.setAuthenticationInfo(null, null);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (accessToken) {
|
if (serverInfo.AccessToken) {
|
||||||
var url = self.getUrl("Sessions/Logout");
|
var url = self.getUrl("Sessions/Logout");
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var apiClients = [];
|
var apiClients = [];
|
||||||
|
var defaultTimeout = 15000;
|
||||||
|
|
||||||
function mergeServers(list1, list2) {
|
function mergeServers(list1, list2) {
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
|
||||||
timeout: timeout || 15000
|
timeout: timeout || defaultTimeout
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -100,10 +101,33 @@
|
||||||
return credentialProvider.credentials().ConnectAccessToken;
|
return credentialProvider.credentials().ConnectAccessToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
self.addApiClient = function (apiClient, enableAutomaticNetworking) {
|
self.getLastUsedApiClient = function() {
|
||||||
|
|
||||||
|
var servers = credentialProvider.credentials().servers;
|
||||||
|
|
||||||
|
servers.sort(function (a, b) {
|
||||||
|
return b.DateLastAccessed - a.DateLastAccessed;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!servers.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var server = servers[0];
|
||||||
|
|
||||||
|
return getOrAddApiClient(server, server.LastConnectionMode);
|
||||||
|
};
|
||||||
|
|
||||||
|
self.addApiClient = function (apiClient) {
|
||||||
|
|
||||||
apiClients.push(apiClient);
|
apiClients.push(apiClient);
|
||||||
|
|
||||||
|
Events.on(apiClient, 'authenticated', function (e, result) {
|
||||||
|
onAuthenticated(this, result, {}, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
||||||
|
|
||||||
return apiClient.getPublicSystemInfo().done(function (systemInfo) {
|
return apiClient.getPublicSystemInfo().done(function (systemInfo) {
|
||||||
|
|
||||||
var server = credentialProvider.credentials().servers.filter(function (s) {
|
var server = credentialProvider.credentials().servers.filter(function (s) {
|
||||||
|
@ -115,13 +139,7 @@
|
||||||
updateServerInfo(server, systemInfo);
|
updateServerInfo(server, systemInfo);
|
||||||
|
|
||||||
apiClient.serverInfo(server);
|
apiClient.serverInfo(server);
|
||||||
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
|
||||||
|
|
||||||
if (enableAutomaticNetworking) {
|
|
||||||
self.connectToServer(server);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function onConnectUserSignIn(user) {
|
function onConnectUserSignIn(user) {
|
||||||
|
@ -151,7 +169,7 @@
|
||||||
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
Events.trigger(self, 'apiclientcreated', [apiClient]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server.AccessToken) {
|
if (server.AccessToken && server.UserId) {
|
||||||
|
|
||||||
apiClient.setAuthenticationInfo(server.AccessToken, server.UserId);
|
apiClient.setAuthenticationInfo(server.AccessToken, server.UserId);
|
||||||
}
|
}
|
||||||
|
@ -799,7 +817,7 @@
|
||||||
var address = self.getServerAddress(server, mode);
|
var address = self.getServerAddress(server, mode);
|
||||||
var enableRetry = false;
|
var enableRetry = false;
|
||||||
var skipTest = false;
|
var skipTest = false;
|
||||||
var timeout = 15000;
|
var timeout = defaultTimeout;
|
||||||
|
|
||||||
if (mode == MediaBrowser.ConnectionMode.Local) {
|
if (mode == MediaBrowser.ConnectionMode.Local) {
|
||||||
|
|
||||||
|
@ -807,7 +825,7 @@
|
||||||
skipTest = true;
|
skipTest = true;
|
||||||
}
|
}
|
||||||
enableRetry = true;
|
enableRetry = true;
|
||||||
timeout = 5000;
|
timeout = 7000;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (mode == MediaBrowser.ConnectionMode.Manual) {
|
else if (mode == MediaBrowser.ConnectionMode.Manual) {
|
||||||
|
@ -924,7 +942,7 @@
|
||||||
case MediaBrowser.ConnectionMode.Remote:
|
case MediaBrowser.ConnectionMode.Remote:
|
||||||
return server.RemoteAddress;
|
return server.RemoteAddress;
|
||||||
default:
|
default:
|
||||||
throw new Error("Unexpected ConnectionMode");
|
return server.ManualAddress || server.LocalAddress || server.RemoteAddress;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -934,6 +952,10 @@
|
||||||
address = "http://" + address;
|
address = "http://" + address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Seeing failures in iOS when protocol isn't lowercase
|
||||||
|
address = address.replace('Http:', 'http:');
|
||||||
|
address = address.replace('Https:', 'https:');
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +975,7 @@
|
||||||
resolveWithFailure(deferred);
|
resolveWithFailure(deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
tryConnect(address, 15000).done(function (publicInfo) {
|
tryConnect(address, defaultTimeout).done(function (publicInfo) {
|
||||||
|
|
||||||
logger.log('connectToAddress ' + address + ' succeeded');
|
logger.log('connectToAddress ' + address + ' succeeded');
|
||||||
|
|
||||||
|
|
|
@ -580,12 +580,15 @@
|
||||||
|
|
||||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||||
|
|
||||||
if (newPlayer.name != PlayerName || newTarget.id != currentPairedDeviceId) {
|
if (currentPairedDeviceId) {
|
||||||
|
if (newTarget.id != currentPairedDeviceId) {
|
||||||
if (currentWebAppSession) {
|
if (currentWebAppSession) {
|
||||||
|
console.log('Disconnecting from chromecast');
|
||||||
currentWebAppSession.disconnect();
|
currentWebAppSession.disconnect();
|
||||||
onDisconnected();
|
onDisconnected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
15
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
15
dashboard-ui/thirdparty/cordova/connectsdk.js
vendored
|
@ -1,16 +1,5 @@
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
|
|
||||||
function onDeviceFound(e) {
|
|
||||||
|
|
||||||
console.log('device found');
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDeviceLost(e) {
|
|
||||||
|
|
||||||
console.log('device lost');
|
|
||||||
}
|
|
||||||
|
|
||||||
function initSdk() {
|
function initSdk() {
|
||||||
|
|
||||||
var manager = ConnectSDK.discoveryManager;
|
var manager = ConnectSDK.discoveryManager;
|
||||||
|
@ -23,9 +12,6 @@
|
||||||
// new ConnectSDK.CapabilityFilter(["MediaPlayer.Display.Video", "MediaControl.Pause"])
|
// new ConnectSDK.CapabilityFilter(["MediaPlayer.Display.Video", "MediaControl.Pause"])
|
||||||
//]);
|
//]);
|
||||||
|
|
||||||
manager.addListener('devicefound', onDeviceFound);
|
|
||||||
manager.addListener('devicelost', onDeviceLost);
|
|
||||||
|
|
||||||
manager.startDiscovery();
|
manager.startDiscovery();
|
||||||
|
|
||||||
requirejs(['thirdparty/cordova/chromecast', 'thirdparty/cordova/generaldevice']);
|
requirejs(['thirdparty/cordova/chromecast', 'thirdparty/cordova/generaldevice']);
|
||||||
|
@ -33,5 +19,4 @@
|
||||||
|
|
||||||
Dashboard.ready(initSdk);
|
Dashboard.ready(initSdk);
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
|
@ -481,6 +481,7 @@
|
||||||
function onDisconnected(device) {
|
function onDisconnected(device) {
|
||||||
|
|
||||||
if (currentDevice && device.getId() == currentDevice.getId()) {
|
if (currentDevice && device.getId() == currentDevice.getId()) {
|
||||||
|
currentDevice = null;
|
||||||
MediaController.removeActiveTarget(device.getId());
|
MediaController.removeActiveTarget(device.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,6 +553,7 @@
|
||||||
|
|
||||||
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
if (currentDevice && newTarget.id != currentDevice.getId()) {
|
||||||
MediaController.removeActiveTarget(currentDevice.getId());
|
MediaController.removeActiveTarget(currentDevice.getId());
|
||||||
|
currentDevice = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue