Add version check for SyncPlay

This commit is contained in:
MrTimscampi 2020-07-22 18:49:35 +02:00
parent a83f541a70
commit 293a87902b
3 changed files with 12 additions and 4 deletions

View File

@ -405,7 +405,8 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
name: 'Original Media Info' name: 'Original Media Info'
}); });
if (syncPlayManager.isSyncPlayEnabled()) { var apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) {
categories.push({ categories.push({
stats: getSyncPlayStats(), stats: getSyncPlayStats(),
name: 'SyncPlay Info' name: 'SyncPlay Info'

View File

@ -104,7 +104,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
$('#chkEnableSharing', page).prop('checked', user.Policy.EnablePublicSharing); $('#chkEnableSharing', page).prop('checked', user.Policy.EnablePublicSharing);
$('#txtRemoteClientBitrateLimit', page).val(user.Policy.RemoteClientBitrateLimit / 1e6 || ''); $('#txtRemoteClientBitrateLimit', page).val(user.Policy.RemoteClientBitrateLimit / 1e6 || '');
$('#txtLoginAttemptsBeforeLockout', page).val(user.Policy.LoginAttemptsBeforeLockout || '0'); $('#txtLoginAttemptsBeforeLockout', page).val(user.Policy.LoginAttemptsBeforeLockout || '0');
$('#selectSyncPlayAccess').val(user.Policy.SyncPlayAccess); if (ApiClient.isMinServerVersion('10.6.0')) {
$('#selectSyncPlayAccess').val(user.Policy.SyncPlayAccess);
}
loading.hide(); loading.hide();
} }
@ -146,7 +148,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
}).map(function (c) { }).map(function (c) {
return c.getAttribute('data-id'); return c.getAttribute('data-id');
}); });
user.Policy.SyncPlayAccess = page.querySelector('#selectSyncPlayAccess').value; if (ApiClient.isMinServerVersion('10.6.0')) {
user.Policy.SyncPlayAccess = page.querySelector('#selectSyncPlayAccess').value;
}
ApiClient.updateUser(user).then(function () { ApiClient.updateUser(user).then(function () {
ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () { ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
onSaveComplete(page, user); onSaveComplete(page, user);

View File

@ -89,7 +89,8 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
var policy = user.Policy ? user.Policy : user.localUser.Policy; var policy = user.Policy ? user.Policy : user.localUser.Policy;
if (headerSyncButton && policy && policy.SyncPlayAccess !== 'None') { var apiClient = getCurrentApiClient();
if (headerSyncButton && policy && policy.SyncPlayAccess !== 'None' && apiClient.isMinServerVersion('10.6.0')) {
headerSyncButton.classList.remove('hide'); headerSyncButton.classList.remove('hide');
} }
} else { } else {
@ -967,8 +968,10 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
updateUserInHeader(); updateUserInHeader();
}); });
events.on(playbackManager, 'playerchange', updateCastIcon); events.on(playbackManager, 'playerchange', updateCastIcon);
events.on(syncPlayManager, 'enabled', onSyncPlayEnabled); events.on(syncPlayManager, 'enabled', onSyncPlayEnabled);
events.on(syncPlayManager, 'syncing', onSyncPlaySyncing); events.on(syncPlayManager, 'syncing', onSyncPlaySyncing);
loadNavDrawer(); loadNavDrawer();
return LibraryMenu; return LibraryMenu;
}); });