mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
add mono CreateWebRequest workaround
This commit is contained in:
parent
386e63ee64
commit
ec469a7b05
18 changed files with 184 additions and 106 deletions
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
.bottomPaddedCard .cardBox {
|
||||
margin-bottom: 5px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.visualCardBox {
|
||||
|
@ -85,7 +85,7 @@
|
|||
}
|
||||
|
||||
.ui-page-theme-b .visualCardBox {
|
||||
background: rgba(45,45,45,.85);
|
||||
background: rgba(40,40,40,.85);
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@
|
|||
}
|
||||
|
||||
.visualCardBox .outerCardFooter {
|
||||
padding: 5px;
|
||||
padding: 3px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
@ -195,6 +195,12 @@
|
|||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.cardButtonContainer {
|
||||
text-align: right;
|
||||
float: right;
|
||||
padding: 5px 0 2px;
|
||||
}
|
||||
|
||||
.cardContent .cardFooter .cardText {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
@ -220,7 +226,6 @@
|
|||
}
|
||||
|
||||
.cardBox:not(.visualCardBox) .outerCardFooter .cardText:last-child {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
@media all and (max-width: 600px) {
|
||||
|
|
|
@ -1367,13 +1367,6 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
|||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
.itemsListview .ui-li-aside {
|
||||
right: 70px;
|
||||
font-size: 13px;
|
||||
top: 35%;
|
||||
font-weight: 300 !important;
|
||||
}
|
||||
|
||||
.itemsListview .ui-li-count {
|
||||
right: 1em;
|
||||
top: 70%;
|
||||
|
@ -1409,11 +1402,20 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
|||
background-position: center center;
|
||||
}
|
||||
|
||||
.listViewMoreButton {
|
||||
.listViewAside {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 10%;
|
||||
padding: 15px 20px;
|
||||
}
|
||||
|
||||
.listViewAside button {
|
||||
padding: 15px 10px;
|
||||
margin: 0 !important;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.listViewMoreButton {
|
||||
padding-left: 20px !important;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
|
@ -1475,9 +1477,27 @@ span.itemCommunityRating:not(:empty) + .userDataIcons {
|
|||
color: #2ad;
|
||||
}
|
||||
|
||||
.listViewUserDataButtons {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
@media all and (min-width: 1200px) {
|
||||
|
||||
li:hover .listViewUserDataButtons {
|
||||
visibility: visible !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 1200px) {
|
||||
|
||||
.listViewUserDataButtons {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 600px) {
|
||||
|
||||
.itemsListview .ui-li-aside {
|
||||
.listViewAsideText {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
update('enableItemPreviews', val.toString());
|
||||
}
|
||||
|
||||
return store.getItem('enableItemPreviews') != 'false';
|
||||
return store.getItem('enableItemPreviews') == 'true';
|
||||
},
|
||||
enableFullScreen: function (val) {
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
type: "Backdrop",
|
||||
tag: item.tag,
|
||||
maxWidth: screenWidth,
|
||||
quality: 80
|
||||
quality: 50
|
||||
});
|
||||
|
||||
setBackdropImage(getElement(), imgUrl);
|
||||
|
@ -174,7 +174,7 @@
|
|||
type: "Backdrop",
|
||||
tag: item.tag,
|
||||
maxWidth: screenWidth,
|
||||
quality: 80
|
||||
quality: 50
|
||||
});
|
||||
|
||||
setBackdropImage(getElement(), imgUrl);
|
||||
|
|
|
@ -147,9 +147,9 @@
|
|||
context: 'channels',
|
||||
showTitle: true,
|
||||
coverImage: true,
|
||||
cardLayout: true,
|
||||
showYear: true,
|
||||
lazy: true
|
||||
lazy: true,
|
||||
centerText: true
|
||||
});
|
||||
|
||||
var elem = $('#items', page).html(html).lazyChildren();
|
||||
|
|
|
@ -32,51 +32,51 @@
|
|||
var item = items[i];
|
||||
|
||||
var icon;
|
||||
var backgroundColor = 'rgba(82, 181, 75, 0.7)';
|
||||
var backgroundColor = 'rgba(82, 181, 75, 0.9)';
|
||||
|
||||
switch (item.CollectionType) {
|
||||
case "movies":
|
||||
icon = "fa-film";
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.7)';
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.9)';
|
||||
break;
|
||||
case "music":
|
||||
icon = "fa-music";
|
||||
backgroundColor = 'rgba(217, 145, 67, 0.7)';
|
||||
backgroundColor = 'rgba(217, 145, 67, 0.9)';
|
||||
break;
|
||||
case "photos":
|
||||
icon = "fa-photo";
|
||||
backgroundColor = 'rgba(127, 0, 0, 0.7)';
|
||||
backgroundColor = 'rgba(127, 0, 0, 0.9)';
|
||||
break;
|
||||
case "livetv":
|
||||
icon = "fa-video-camera";
|
||||
backgroundColor = 'rgba(255, 233, 127, 0.7)';
|
||||
backgroundColor = 'rgba(217, 145, 67, 0.9)';
|
||||
break;
|
||||
case "tvshows":
|
||||
icon = "fa-video-camera";
|
||||
backgroundColor = 'rgba(77, 88, 164, 0.7)';
|
||||
backgroundColor = 'rgba(77, 88, 164, 0.9)';
|
||||
break;
|
||||
case "games":
|
||||
icon = "fa-gamepad";
|
||||
backgroundColor = 'rgba(183, 202, 72, 0.7)';
|
||||
backgroundColor = 'rgba(183, 202, 72, 0.9)';
|
||||
break;
|
||||
case "trailers":
|
||||
icon = "fa-film";
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.7)';
|
||||
backgroundColor = 'rgba(176, 94, 81, 0.9)';
|
||||
break;
|
||||
case "homevideos":
|
||||
icon = "fa-video-camera";
|
||||
backgroundColor = 'rgba(110, 52, 32, 0.7)';
|
||||
backgroundColor = 'rgba(110, 52, 32, 0.9)';
|
||||
break;
|
||||
case "musicvideos":
|
||||
icon = "fa-video-camera";
|
||||
backgroundColor = 'rgba(143, 54, 168, 0.7)';
|
||||
backgroundColor = 'rgba(143, 54, 168, 0.9)';
|
||||
break;
|
||||
case "books":
|
||||
icon = "fa-book";
|
||||
break;
|
||||
case "channels":
|
||||
icon = "fa-globe";
|
||||
backgroundColor = 'rgba(51, 136, 204, 0.7)';
|
||||
backgroundColor = 'rgba(51, 136, 204, 0.9)';
|
||||
break;
|
||||
case "playlists":
|
||||
icon = "fa-list";
|
||||
|
@ -153,7 +153,7 @@
|
|||
html += '<div>';
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="listHeader">' + Globalize.translate('HeaderLatestMedia') + '</h1>';
|
||||
|
||||
if (user.Policy.EnableUserPreferenceAccess) {
|
||||
if (user.Policy.EnableUserPreferenceAccess && !AppInfo.isNativeApp) {
|
||||
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@
|
|||
html += '<div>';
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderMyMedia') + '</h1>';
|
||||
|
||||
if (user.Policy.EnableUserPreferenceAccess) {
|
||||
if (user.Policy.EnableUserPreferenceAccess && !AppInfo.isNativeApp) {
|
||||
html += '<a href="mypreferencesdisplay.html" class="accentButton"><i class="fa fa-pencil"></i>' + Globalize.translate('ButtonEdit') + '</a>';
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@
|
|||
|
||||
(function ($, document) {
|
||||
|
||||
var defaultFirstSection = 'smalllibrarytiles-automobile';
|
||||
var defaultFirstSection = 'smalllibrarytiles';
|
||||
|
||||
function getDefaultSection(index) {
|
||||
|
||||
|
@ -643,7 +643,10 @@
|
|||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
loadSections(page, user, result).done(function () {
|
||||
|
||||
if (!AppInfo.isNativeApp) {
|
||||
showWelcomeIfNeeded(page, result);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -453,7 +453,8 @@
|
|||
html = LibraryBrowser.getListViewHtml({
|
||||
items: result.Items,
|
||||
playFromHere: true,
|
||||
defaultAction: 'playallfromhere'
|
||||
defaultAction: 'playallfromhere',
|
||||
smallIcon: true
|
||||
});
|
||||
}
|
||||
else if (query.IncludeItemTypes == "Movie" || query.IncludeItemTypes == "Trailer") {
|
||||
|
@ -503,7 +504,8 @@
|
|||
else {
|
||||
|
||||
html = LibraryBrowser.getListViewHtml({
|
||||
items: result.Items
|
||||
items: result.Items,
|
||||
smallIcon: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@
|
|||
|
||||
Dashboard.getCurrentUser().done(function (user) {
|
||||
|
||||
if (user.Policy.IsAdministrator && query.ParentId) {
|
||||
if (user.Policy.IsAdministrator && query.ParentId && !AppInfo.isNativeApp) {
|
||||
$('#editButtonContainer', page).show();
|
||||
} else {
|
||||
$('#editButtonContainer', page).hide();
|
||||
|
|
|
@ -848,10 +848,6 @@
|
|||
html += '</p>';
|
||||
}
|
||||
|
||||
html += '<div class="ui-li-aside">';
|
||||
html += textlines[verticalTextLines] || LibraryBrowser.getRatingHtml(item, false);
|
||||
html += '</div>';
|
||||
|
||||
html += LibraryBrowser.getSyncIndicator(item);
|
||||
|
||||
if (item.Type == 'Series' || item.Type == 'Season' || item.Type == 'BoxSet' || item.MediaType == 'Video') {
|
||||
|
@ -863,9 +859,17 @@
|
|||
}
|
||||
html += '</a>';
|
||||
|
||||
html += '<div class="listViewAside">';
|
||||
html += '<span class="listViewAsideText">';
|
||||
html += textlines[verticalTextLines] || LibraryBrowser.getRatingHtml(item, false);
|
||||
html += '</span>';
|
||||
html += '<button type="button" data-role="none" class="listviewMenuButton imageButton listViewMoreButton" data-icon="none">';
|
||||
html += '<i class="material-icons">more_vert</i>';
|
||||
html += '</button>';
|
||||
html += '<span class="listViewUserDataButtons">';
|
||||
html += LibraryBrowser.getUserDataIconsHtml(item);
|
||||
html += '</span>';
|
||||
html += '</div>';
|
||||
|
||||
html += '</li>';
|
||||
|
||||
|
@ -1553,7 +1557,7 @@
|
|||
html += '<div class="' + footerClass + '">';
|
||||
|
||||
if (options.cardLayout) {
|
||||
html += '<div class="cardText" style="text-align:right; float:right;">';
|
||||
html += '<div class="cardButtonContainer">';
|
||||
html += '<button class="listviewMenuButton imageButton btnCardOptions" type="button" data-role="none" style="margin: 4px 0 0;"><i class="material-icons">more_vert</i></button>';
|
||||
html += "</div>";
|
||||
}
|
||||
|
@ -2269,7 +2273,7 @@
|
|||
|
||||
btnCssClass += " imageButton";
|
||||
|
||||
return '<button data-itemid="' + itemId + '" class="' + btnCssClass + '" type="button" onclick="LibraryBrowser.' + method + '(this);return false;" title="' + tooltip + '"><i class="fa ' + icon + '"></i></button>';
|
||||
return '<button data-itemid="' + itemId + '" class="' + btnCssClass + '" type="button" onclick="LibraryBrowser.' + method + '(this);return false;" title="' + tooltip + '" data-role="none"><i class="fa ' + icon + '"></i></button>';
|
||||
|
||||
},
|
||||
|
||||
|
@ -2284,7 +2288,7 @@
|
|||
|
||||
var tooltipPlayed = Globalize.translate('TooltipPlayed');
|
||||
|
||||
if ((item.MediaType || item.IsFolder) && type != "TvChannel" && type != "MusicArtist") {
|
||||
if ((item.MediaType || item.IsFolder) && type != "TvChannel" && type != "MusicArtist" && item.MediaType != "Audio") {
|
||||
if (userData.Played) {
|
||||
html += LibraryBrowser.getUserDataButtonHtml('markPlayed', itemId, 'btnUserItemRating btnUserItemRating', 'fa-check', tooltipPlayed);
|
||||
} else {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
// html += '<button class="headerButtonViewMenu headerButton headerButtonRight" type="button" data-role="none"><i class="material-icons">more_vert</i></button>';
|
||||
//}
|
||||
|
||||
if (!$.browser.mobile && !AppInfo.isTouchPreferred) {
|
||||
if (!$.browser.mobile && !AppInfo.isNativeApp) {
|
||||
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton" style="display:none;"><i class="material-icons">settings</i></a>';
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,21 @@
|
|||
$(initViewMenuBarHeadroom);
|
||||
|
||||
//$('.headerButtonViewMenu').off('click', onViewButtonClick).on('click', onViewButtonClick);
|
||||
|
||||
if (AppInfo.isNativeApp) {
|
||||
$(document).off('swiperight.drawer').on('swiperight.drawer', '.libraryPage', onSwipeRight);
|
||||
}
|
||||
}
|
||||
|
||||
function onSwipeRight(event) {
|
||||
|
||||
if (event.swipestop && event.swipestop.coords) {
|
||||
var x = event.swipestop.coords[0];
|
||||
|
||||
if (x < 50) {
|
||||
showLibraryMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//function onViewButtonClick() {
|
||||
|
@ -155,7 +170,7 @@
|
|||
html += Globalize.translate('HeaderAdmin');
|
||||
html += '</div>';
|
||||
|
||||
html += '<a class="sidebarLink lnkMediaFolder" data-itemid="dashboard" href="dashboard.html"><span class="fa fa-server sidebarLinkIcon"></span>' + Globalize.translate('ButtonManageServer') + '</a>';
|
||||
html += '<a class="sidebarLink lnkMediaFolder lnkManageServer" data-itemid="dashboard" href="#"><span class="fa fa-server sidebarLinkIcon"></span>' + Globalize.translate('ButtonManageServer') + '</a>';
|
||||
html += '<a class="sidebarLink lnkMediaFolder editorViewMenu" data-itemid="editor" href="edititemmetadata.html"><span class="fa fa-edit sidebarLinkIcon"></span>' + Globalize.translate('ButtonMetadataManager') + '</a>';
|
||||
|
||||
if (!$.browser.mobile && !AppInfo.isTouchPreferred) {
|
||||
|
@ -412,6 +427,8 @@
|
|||
|
||||
panel = $('#libraryPanel').panel({}).lazyChildren().trigger('create');
|
||||
|
||||
$('.lnkManageServer', panel).on('click', onManageServerClicked);
|
||||
|
||||
updateLibraryMenu();
|
||||
}
|
||||
else if (requiresLibraryMenuRefresh) {
|
||||
|
@ -422,6 +439,17 @@
|
|||
return panel;
|
||||
}
|
||||
|
||||
function onManageServerClicked() {
|
||||
|
||||
requirejs(["scripts/registrationservices"], function () {
|
||||
|
||||
RegistrationServices.validateFeature('manageserver').done(function () {
|
||||
Dashboard.navigate('dashboard.html');
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getDashboardMenu(page) {
|
||||
|
||||
var panel = $('#dashboardPanel', page);
|
||||
|
|
|
@ -1109,7 +1109,10 @@
|
|||
var requiresNativeControls = !self.enableCustomVideoControls();
|
||||
|
||||
// Can't autoplay in these browsers so we need to use the full controls
|
||||
if (requiresNativeControls) {
|
||||
if (requiresNativeControls && AppInfo.isNativeApp && $.browser.android) {
|
||||
html += '<video data-viblast-key="N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=" class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous" ' + posterCode + ' webkit-playsinline>';
|
||||
}
|
||||
else if (requiresNativeControls) {
|
||||
html += '<video data-viblast-key="N8FjNTQ3NDdhZqZhNGI5NWU5ZTI=" class="itemVideo" id="itemVideo" preload="metadata" autoplay="autoplay" crossorigin="anonymous" controls="controls"' + posterCode + ' webkit-playsinline>';
|
||||
}
|
||||
else {
|
||||
|
@ -1219,6 +1222,10 @@
|
|||
}, 3000);
|
||||
}
|
||||
|
||||
if (requiresNativeControls) {
|
||||
$(this).attr('controls', 'controls');
|
||||
}
|
||||
|
||||
}).on("volumechange.mediaplayerevent", function (e) {
|
||||
|
||||
var vol = this.volume;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'ThumbCard');
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb');
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'ThumbCard');
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb');
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
|
|
@ -99,7 +99,8 @@
|
|||
title: item.Name,
|
||||
showRemoveFromPlaylist: true,
|
||||
playFromHere: true,
|
||||
defaultAction: 'playallfromhere'
|
||||
defaultAction: 'playallfromhere',
|
||||
smallIcon: true
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ var Dashboard = {
|
|||
$.mobile.popup.prototype.options.transition = "pop";
|
||||
|
||||
if ($.browser.mobile) {
|
||||
$.mobile.defaultPageTransition = "slide";
|
||||
$.mobile.defaultPageTransition = "none";
|
||||
} else {
|
||||
$.mobile.defaultPageTransition = "none";
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ var Dashboard = {
|
|||
// Make panels a little larger than the defaults
|
||||
$.mobile.panel.prototype.options.classes.modalOpen = "largePanelModalOpen ui-panel-dismiss-open";
|
||||
$.mobile.panel.prototype.options.classes.panel = "largePanel ui-panel";
|
||||
|
||||
$.event.special.swipe.verticalDistanceThreshold = 40;
|
||||
$.mobile.loader.prototype.options.disabled = true;
|
||||
},
|
||||
|
||||
isConnectMode: function () {
|
||||
|
@ -92,7 +95,7 @@ var Dashboard = {
|
|||
}
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
if (!Dashboard.suppressAjaxErrors && data.type != 'GET') {
|
||||
if (!Dashboard.suppressAjaxErrors && data.type != 'GET' && !AppInfo.isNativeApp) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
|
@ -731,7 +734,7 @@ var Dashboard = {
|
|||
if (item.selected) {
|
||||
menuHtml += '<a class="sidebarLink selectedSidebarLink" href="' + item.href + '">';
|
||||
} else {
|
||||
menuHtml += '<a data-transition="none" class="sidebarLink" href="' + item.href + '">';
|
||||
menuHtml += '<a class="sidebarLink" href="' + item.href + '">';
|
||||
}
|
||||
|
||||
var icon = item.icon;
|
||||
|
@ -765,7 +768,7 @@ var Dashboard = {
|
|||
|
||||
html += '<div data-role="panel" id="dashboardPanel" class="dashboardPanel" data-position="left" data-display="overlay" data-position-fixed="true" data-theme="a">';
|
||||
|
||||
html += '<p class="libraryPanelHeader" style="margin: 15px 0 15px 20px;"><a href="index.html" data-transition="none" class="imageLink"><img src="css/images/mblogoicon.png" /><span style="color:#333;">EMBY</span></a></p>';
|
||||
html += '<p class="libraryPanelHeader" style="margin: 15px 0 15px 20px;"><a href="index.html" class="imageLink"><img src="css/images/mblogoicon.png" /><span style="color:#333;">EMBY</span></a></p>';
|
||||
|
||||
html += '<div class="sidebarLinks">';
|
||||
html += menuHtml;
|
||||
|
@ -1982,7 +1985,7 @@ $(document).on('pagecreate', ".page", function () {
|
|||
Dashboard.firePageEvent(page, 'pageinitdepends');
|
||||
}
|
||||
|
||||
$('.localnav a, .libraryViewNav a').attr('data-transition', 'none');
|
||||
//$('.localnav a, .libraryViewNav a').attr('data-transition', 'none');
|
||||
|
||||
}).on('pagebeforeshow', ".page", function () {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(function ($, document) {
|
||||
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'ThumbCard');
|
||||
var view = LibraryBrowser.getDefaultItemsView('Thumb', 'Thumb');
|
||||
|
||||
// The base query options
|
||||
var query = {
|
||||
|
|
87
dashboard-ui/thirdparty/cordova/chromecast.js
vendored
87
dashboard-ui/thirdparty/cordova/chromecast.js
vendored
|
@ -2,9 +2,6 @@
|
|||
|
||||
var PlayerName = "Chromecast";
|
||||
var ApplicationID = "2D4B1DA3";
|
||||
var currentPairingDeviceId;
|
||||
var currentPairedDeviceId;
|
||||
var currentDeviceFriendlyName;
|
||||
var currentWebAppSession;
|
||||
var currentDevice;
|
||||
|
||||
|
@ -87,7 +84,7 @@
|
|||
accessToken: ApiClient.accessToken(),
|
||||
serverAddress: ApiClient.serverAddress(),
|
||||
maxBitrate: bitrateSetting,
|
||||
receiverName: currentDeviceFriendlyName
|
||||
receiverName: currentDevice.getFriendlyName()
|
||||
});
|
||||
|
||||
getEndpointInfo().done(function (endpoint) {
|
||||
|
@ -462,32 +459,45 @@
|
|||
MediaController.removeActivePlayer(PlayerName);
|
||||
}
|
||||
|
||||
function setupWebAppSession(device, session) {
|
||||
function onWebAppSessionConnect(webAppSession, device) {
|
||||
|
||||
// hold on to a reference
|
||||
currentWebAppSession = session.acquire();
|
||||
|
||||
currentWebAppSession.on('message', handleMessage);
|
||||
|
||||
currentWebAppSession.connect().success(function () {
|
||||
currentWebAppSession = webAppSession;
|
||||
|
||||
console.log('session.connect succeeded');
|
||||
currentWebAppSession.setWebAppSessionListener();
|
||||
currentWebAppSession.on('disconnect', handleSessionDisconnect);
|
||||
webAppSession.setWebAppSessionListener();
|
||||
|
||||
MediaController.setActivePlayer(PlayerName, convertDeviceToTarget(device));
|
||||
currentDeviceFriendlyName = device.getFriendlyName();
|
||||
currentPairedDeviceId = device.getId();
|
||||
currentDevice = device;
|
||||
|
||||
$(castPlayer).trigger('connect');
|
||||
|
||||
sendIdentifyMessage();
|
||||
}
|
||||
|
||||
function setupWebAppSession(device, session, connectToSession) {
|
||||
|
||||
// hold on to a reference
|
||||
var currentSession = session.acquire();
|
||||
|
||||
currentSession.on('message', handleMessage);
|
||||
currentSession.on('disconnect', handleSessionDisconnect);
|
||||
|
||||
if (connectToSession || $.browser.safari) {
|
||||
currentSession.connect().success(function () {
|
||||
|
||||
onWebAppSessionConnect(currentSession, device);
|
||||
|
||||
}).error(handleSessionError);
|
||||
} else {
|
||||
onWebAppSessionConnect(currentSession, device);
|
||||
}
|
||||
}
|
||||
|
||||
function sendIdentifyMessage() {
|
||||
sendMessageToDevice({
|
||||
options: {},
|
||||
command: 'Identify'
|
||||
});
|
||||
|
||||
}).error(handleSessionError);
|
||||
}
|
||||
|
||||
function handleSessionError() {
|
||||
|
@ -508,17 +518,7 @@
|
|||
session.release();
|
||||
}
|
||||
|
||||
if (currentDevice != null) {
|
||||
currentDevice.off("ready");
|
||||
currentDevice.off("disconnect");
|
||||
|
||||
currentDevice.disconnect();
|
||||
}
|
||||
|
||||
currentWebAppSession = null;
|
||||
currentPairedDeviceId = null;
|
||||
currentDeviceFriendlyName = null;
|
||||
currentDevice = null;
|
||||
}
|
||||
|
||||
function tryLaunchWebSession(device) {
|
||||
|
@ -527,7 +527,7 @@
|
|||
device.getWebAppLauncher().launchWebApp(ApplicationID).success(function (session) {
|
||||
|
||||
console.log('launchWebApp success. calling onSessionConnected');
|
||||
setupWebAppSession(device, session);
|
||||
setupWebAppSession(device, session, true);
|
||||
|
||||
}).error(function (err1) {
|
||||
|
||||
|
@ -544,7 +544,7 @@
|
|||
device.getWebAppLauncher().joinWebApp(ApplicationID).success(function (session) {
|
||||
|
||||
console.log('joinWebApp success. calling onSessionConnected');
|
||||
setupWebAppSession(device, session);
|
||||
setupWebAppSession(device, session, false);
|
||||
|
||||
}).error(function (err) {
|
||||
|
||||
|
@ -563,15 +563,16 @@
|
|||
|
||||
function launchWebApp(device) {
|
||||
|
||||
if (currentWebAppSession) {
|
||||
cleanupSession();
|
||||
}
|
||||
|
||||
tryJoinWebSession(device, true);
|
||||
}
|
||||
|
||||
function onDeviceReady(device) {
|
||||
|
||||
if (currentPairingDeviceId != device.getId()) {
|
||||
console.log('device ready fired for a different device. ignoring.');
|
||||
return;
|
||||
}
|
||||
device.off("ready");
|
||||
|
||||
console.log('creating webAppSession');
|
||||
|
||||
|
@ -600,11 +601,13 @@
|
|||
|
||||
self.tryPairWithDevice = function (device, deferred) {
|
||||
|
||||
var deviceId = device.getId();
|
||||
currentPairingDeviceId = deviceId;
|
||||
|
||||
console.log('Will attempt to connect to Chromecast');
|
||||
|
||||
device.on("disconnect", function () {
|
||||
device.off("ready");
|
||||
device.off("disconnect");
|
||||
});
|
||||
|
||||
if (device.isReady()) {
|
||||
console.log('Device is already ready, calling onDeviceReady');
|
||||
onDeviceReady(device);
|
||||
|
@ -617,11 +620,6 @@
|
|||
onDeviceReady(device);
|
||||
});
|
||||
|
||||
device.on("disconnect", function () {
|
||||
device.off("ready");
|
||||
device.off("disconnect");
|
||||
});
|
||||
|
||||
console.log('Calling device.connect');
|
||||
device.connect();
|
||||
}
|
||||
|
@ -629,11 +627,12 @@
|
|||
|
||||
$(MediaController).on('playerchange', function (e, newPlayer, newTarget) {
|
||||
|
||||
if (currentPairedDeviceId) {
|
||||
if (newTarget.id != currentPairedDeviceId) {
|
||||
if (currentDevice) {
|
||||
if (newTarget.id != currentDevice.getId()) {
|
||||
if (currentWebAppSession) {
|
||||
console.log('Disconnecting from chromecast');
|
||||
cleanupSession();
|
||||
currentDevice.disconnect();
|
||||
currentDevice = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,10 @@
|
|||
validateFeature(getPremiumUnlockFeatureId(), deferred);
|
||||
}
|
||||
|
||||
function validateServerManagement(deferred) {
|
||||
deferred.resolve();
|
||||
}
|
||||
|
||||
function getRegistrationInfo(feature, enableSupporterUnlock) {
|
||||
|
||||
if (!enableSupporterUnlock) {
|
||||
|
@ -224,6 +228,8 @@
|
|||
validatePlayback(deferred);
|
||||
} else if (name == 'livetv') {
|
||||
validateLiveTV(deferred);
|
||||
} else if (name == 'manageserver') {
|
||||
validateServerManagement(deferred);
|
||||
} else {
|
||||
deferred.resolve();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue