mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 19:08:18 -07:00
update bitrate detection
This commit is contained in:
parent
0e6672699e
commit
8c248c229a
@ -528,7 +528,7 @@
|
||||
// First try a small amount so that we don't hang up their mobile connection
|
||||
self.getDownloadSpeed(1000000).done(function (bitrate) {
|
||||
|
||||
if (bitrate < 3000000) {
|
||||
if (bitrate < 1000000) {
|
||||
deferred.resolveWith(null, [Math.round(bitrate * .8)]);
|
||||
} else {
|
||||
|
||||
|
@ -19,19 +19,10 @@
|
||||
<form>
|
||||
|
||||
<div data-role="controlgroup" data-type="horizontal" data-mini="true" class="viewPanelTabs">
|
||||
<a href="#" data-role="button" class="viewTabButton" data-tab="tabView">${TabView}</a>
|
||||
<a href="#" data-role="button" class="viewTabButton" data-tab="tabSort">${TabSort}</a>
|
||||
<a href="#" data-role="button" class="viewTabButton" data-tab="tabFilter">${TabFilter}</a>
|
||||
</div>
|
||||
|
||||
<div class="tabView viewTab">
|
||||
|
||||
<div>
|
||||
<label for="selectPageSize">${LabelPageSize}</label>
|
||||
<select id="selectPageSize" class="selectPageSize"></select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="tabFilter viewTab">
|
||||
<fieldset data-role="controlgroup" class="filterControls">
|
||||
<legend>
|
||||
|
@ -43,8 +43,10 @@
|
||||
|
||||
function sendRequest(request) {
|
||||
|
||||
var method = request.type || "GET";
|
||||
|
||||
// For now, we can only handle json responses
|
||||
if (request.dataType) {
|
||||
if (request.dataType || method == "GET") {
|
||||
if (request.dataType != 'json') {
|
||||
return baseAjaxMethod(request);
|
||||
}
|
||||
@ -68,7 +70,7 @@
|
||||
}
|
||||
|
||||
var javaRequest = {
|
||||
Method: request.type || "GET",
|
||||
Method: method,
|
||||
Url: request.url,
|
||||
RequestHeaders: request.headers
|
||||
};
|
||||
|
@ -8,6 +8,22 @@
|
||||
|
||||
window.AppSettings = {
|
||||
|
||||
enableAutomaticBitrateDetection: function (val) {
|
||||
|
||||
if (val != null) {
|
||||
update('enableAutomaticBitrateDetection', val.toString());
|
||||
}
|
||||
|
||||
var savedVal = appStorage.getItem('enableAutomaticBitrateDetection');
|
||||
|
||||
if (!savedVal) {
|
||||
if (AppInfo.isNativeApp) {
|
||||
//return false;
|
||||
}
|
||||
}
|
||||
|
||||
return appStorage.getItem('enableAutomaticBitrateDetection') != 'false';
|
||||
},
|
||||
maxStreamingBitrate: function (val) {
|
||||
|
||||
if (val != null) {
|
||||
|
@ -11,20 +11,6 @@
|
||||
StartIndex: 0
|
||||
};
|
||||
|
||||
function getPageSizes() {
|
||||
|
||||
var sizes = [];
|
||||
|
||||
if (!maxPageSize || maxPageSize >= 10) sizes.push(10);
|
||||
if (!maxPageSize || maxPageSize >= 20) sizes.push(20);
|
||||
if (!maxPageSize || maxPageSize >= 30) sizes.push(30);
|
||||
if (!maxPageSize || maxPageSize >= 40) sizes.push(40);
|
||||
if (!maxPageSize || maxPageSize >= 50) sizes.push(50);
|
||||
if (!maxPageSize || maxPageSize >= 100) sizes.push(100);
|
||||
|
||||
return sizes;
|
||||
}
|
||||
|
||||
function getSavedQueryId() {
|
||||
return 'channels-1-' + getParameterByName('id') + (getParameterByName('folderId') || '');
|
||||
}
|
||||
@ -198,7 +184,6 @@
|
||||
}).checkboxradio('refresh');
|
||||
|
||||
$('.alphabetPicker', page).alphaValue(query.NameStartsWith);
|
||||
$('#selectPageSize', page).val(query.Limit);
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#channelItemsPage", function () {
|
||||
@ -248,12 +233,6 @@
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
$('#selectPageSize', page).on('change', function () {
|
||||
query.Limit = parseInt(this.value);
|
||||
query.StartIndex = 0;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
}).on('pagebeforeshow', "#channelItemsPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
@ -2540,24 +2540,24 @@
|
||||
|
||||
if (showControls) {
|
||||
|
||||
html += '<paper-button raised class="subdued notext btnPreviousPage" ' + (startIndex ? '' : 'disabled') + '><iron-icon icon="arrow-back"></iron-icon></paper-button>';
|
||||
html += '<paper-button raised class="subdued notext btnNextPage" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '><iron-icon icon="arrow-forward"></iron-icon></paper-button>';
|
||||
html += '<paper-icon-button class="btnPreviousPage" icon="arrow-back" ' + (startIndex ? '' : 'disabled') + '></paper-icon-button>';
|
||||
html += '<paper-icon-button class="btnNextPage" icon="arrow-forward" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '></paper-icon-button>';
|
||||
}
|
||||
|
||||
html += (options.additionalButtonsHtml || '');
|
||||
|
||||
if (options.addSelectionButton) {
|
||||
html += '<paper-button raised class="subdued notext btnToggleSelections"><iron-icon icon="check"></iron-icon></paper-button>';
|
||||
html += '<paper-icon-button class="btnToggleSelections" icon="check"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.addLayoutButton) {
|
||||
|
||||
html += '<paper-button raised class="subdued notext btnChangeLayout" data-layouts="' + (options.layouts || '') + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || '') + '\');"><iron-icon icon="view-comfy"></iron-icon></paper-button>';
|
||||
html += '<paper-icon-button class="btnChangeLayout" data-layouts="' + (options.layouts || '') + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || '') + '\');" icon="view-comfy"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.sortButton) {
|
||||
|
||||
html += '<paper-button raised class="subdued notext btnSort" title="' + Globalize.translate('ButtonSort') + '"><iron-icon icon="sort-by-alpha"></iron-icon></paper-button>';
|
||||
html += '<paper-icon-button class="btnSort" title="' + Globalize.translate('ButtonSort') + '" icon="sort-by-alpha"></paper-icon-button>';
|
||||
}
|
||||
|
||||
if (options.viewButton) {
|
||||
@ -2565,7 +2565,7 @@
|
||||
//html += '<paper-button raised class="subdued notext"><iron-icon icon="view-comfy"></iron-icon></paper-button>';
|
||||
var viewPanelClass = options.viewPanelClass || 'viewPanel';
|
||||
var title = options.viewIcon == 'filter-list' ? Globalize.translate('ButtonFilter') : Globalize.translate('ButtonMenu');
|
||||
html += '<paper-button raised class="subdued notext" title="' + title + '" onclick="require([\'jqmicons\']);jQuery(\'.' + viewPanelClass + '\', jQuery(this).parents(\'.page\')).panel(\'toggle\');"><iron-icon icon="' + (options.viewIcon || AppInfo.moreIcon) + '"></iron-icon></paper-button>';
|
||||
html += '<paper-icon-button title="' + title + '" icon="' + (options.viewIcon || AppInfo.moreIcon) + '" onclick="require([\'jqmicons\']);jQuery(\'.' + viewPanelClass + '\', jQuery(this).parents(\'.page\')).panel(\'toggle\');"></paper-icon-button>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
@ -451,6 +451,10 @@
|
||||
Format: 'pgssub',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'dvdsub',
|
||||
Method: 'Embed'
|
||||
});
|
||||
profile.SubtitleProfiles.push({
|
||||
Format: 'vtt',
|
||||
Method: 'Embed'
|
||||
@ -988,6 +992,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
var lastBitrateDetect = 0;
|
||||
|
||||
self.playInternal = function (item, startPosition, callback) {
|
||||
|
||||
if (item == null) {
|
||||
@ -1008,7 +1014,28 @@
|
||||
return;
|
||||
}
|
||||
|
||||
var deviceProfile = self.getDeviceProfile();
|
||||
if (item.MediaType == 'Video' && AppSettings.enableAutomaticBitrateDetection() && (new Date().getTime() - lastBitrateDetect) > 1000) {
|
||||
|
||||
Dashboard.showModalLoadingMsg();
|
||||
|
||||
ApiClient.detectBitrate().done(function (bitrate) {
|
||||
|
||||
Logger.log('Max bitrate auto detected to ' + bitrate);
|
||||
lastBitrateDetect = new Date().getTime();
|
||||
AppSettings.maxStreamingBitrate(bitrate);
|
||||
|
||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||
}).fail(function () {
|
||||
|
||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||
});
|
||||
|
||||
} else {
|
||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||
}
|
||||
};
|
||||
|
||||
function playOnDeviceProfileCreated(deviceProfile, item, startPosition, callback) {
|
||||
|
||||
if (item.MediaType === "Video") {
|
||||
|
||||
@ -1040,9 +1067,8 @@
|
||||
MediaController.showPlaybackInfoErrorMessage('NoCompatibleStream');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function playInternalPostMediaSourceSelection(item, mediaSource, startPosition, callback) {
|
||||
|
||||
|
@ -39,8 +39,16 @@
|
||||
return '<option value="' + i.bitrate + '">' + i.name + '</option>';
|
||||
|
||||
}).join('');
|
||||
$('#selectMaxBitrate', page).html(bitrateOptions).val(AppSettings.maxStreamingBitrate());
|
||||
|
||||
bitrateOptions = '<option value="">' + Globalize.translate('OptionAutomatic') + '</option>' + bitrateOptions;
|
||||
|
||||
$('#selectMaxBitrate', page).html(bitrateOptions);
|
||||
|
||||
if (AppSettings.enableAutomaticBitrateDetection()) {
|
||||
$('#selectMaxBitrate', page).val('');
|
||||
} else {
|
||||
$('#selectMaxBitrate', page).val(AppSettings.maxStreamingBitrate());
|
||||
}
|
||||
|
||||
$('#selectMaxChromecastBitrate', page).val(AppSettings.maxChromecastBitrate());
|
||||
|
||||
@ -100,7 +108,13 @@
|
||||
|
||||
AppSettings.enableExternalPlayers(page.querySelector('.chkExternalVideoPlayer').checked);
|
||||
|
||||
AppSettings.maxStreamingBitrate($('#selectMaxBitrate', page).val());
|
||||
if ($('#selectMaxBitrate', page).val()) {
|
||||
AppSettings.maxStreamingBitrate($('#selectMaxBitrate', page).val());
|
||||
AppSettings.enableAutomaticBitrateDetection(false);
|
||||
} else {
|
||||
AppSettings.enableAutomaticBitrateDetection(true);
|
||||
}
|
||||
|
||||
AppSettings.maxChromecastBitrate($('#selectMaxChromecastBitrate', page).val());
|
||||
AppSettings.enableChromecastAc3(page.querySelector('.chkEnableChromecastAc3').checked);
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
"TitleLiveTV": "Live TV",
|
||||
"ButtonCancelSyncJob": "Cancel sync job",
|
||||
"TitleSync": "Sync",
|
||||
"OptionAutomatic": "Auto",
|
||||
"HeaderSelectDate": "Select Date",
|
||||
"ButtonDonate": "Donate",
|
||||
"LabelRecurringDonationCanBeCancelledHelp": "Recurring donations can be cancelled at any time from within your PayPal account.",
|
||||
|
@ -242,6 +242,10 @@ paper-icon-button paper-ripple {
|
||||
color: inherit !important;
|
||||
}
|
||||
|
||||
.ui-page-theme-b paper-icon-button[disabled] {
|
||||
color: #444 !important;
|
||||
}
|
||||
|
||||
paper-dialog + iron-overlay-backdrop {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user