mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
Add track sorting to mediainfo and player track selection
This commit is contained in:
parent
dc956eb48c
commit
b69b9227c4
@ -12,6 +12,7 @@ import toast from '../toast/toast';
|
||||
import { copy } from '../../scripts/clipboard';
|
||||
import dom from '../../scripts/dom';
|
||||
import globalize from '../../scripts/globalize';
|
||||
import itemHelper from '../../components/itemHelper';
|
||||
import loading from '../loading/loading';
|
||||
import '../../elements/emby-select/emby-select';
|
||||
import '../listview/listview.scss';
|
||||
@ -71,8 +72,8 @@ const attributeDelimiterHtml = layoutManager.tv ? '' : '<span class="hide">: </s
|
||||
const size = `${(version.Size / (1024 * 1024)).toFixed(0)} MB`;
|
||||
html += `${createAttribute(globalize.translate('MediaInfoSize'), size)}<br/>`;
|
||||
}
|
||||
for (let i = 0, length = version.MediaStreams.length; i < length; i++) {
|
||||
const stream = version.MediaStreams[i];
|
||||
version.MediaStreams.sort(itemHelper.sortTracks);
|
||||
for (const stream of version.MediaStreams) {
|
||||
if (stream.Type === 'Data') {
|
||||
continue;
|
||||
}
|
||||
|
@ -3657,7 +3657,7 @@ class PlaybackManager {
|
||||
if (player.audioTracks) {
|
||||
const result = player.audioTracks();
|
||||
if (result) {
|
||||
return result;
|
||||
return result.sort(itemHelper.sortTracks);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3666,14 +3666,14 @@ class PlaybackManager {
|
||||
const mediaStreams = (mediaSource || {}).MediaStreams || [];
|
||||
return mediaStreams.filter(function (s) {
|
||||
return s.Type === 'Audio';
|
||||
});
|
||||
}).sort(itemHelper.sortTracks);
|
||||
}
|
||||
|
||||
subtitleTracks(player = this._currentPlayer) {
|
||||
if (player.subtitleTracks) {
|
||||
const result = player.subtitleTracks();
|
||||
if (result) {
|
||||
return result;
|
||||
return result.sort(itemHelper.sortTracks);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3682,7 +3682,7 @@ class PlaybackManager {
|
||||
const mediaStreams = (mediaSource || {}).MediaStreams || [];
|
||||
return mediaStreams.filter(function (s) {
|
||||
return s.Type === 'Subtitle';
|
||||
});
|
||||
}).sort(itemHelper.sortTracks);
|
||||
}
|
||||
|
||||
getSupportedCommands(player) {
|
||||
|
@ -274,7 +274,7 @@ function renderAudioSelections(page, mediaSources) {
|
||||
const tracks = mediaSource.MediaStreams.filter(function (m) {
|
||||
return m.Type === 'Audio';
|
||||
});
|
||||
tracks.sort((a, b) => itemHelper.sortTracks(a, b));
|
||||
tracks.sort(itemHelper.sortTracks);
|
||||
const select = page.querySelector('.selectAudio');
|
||||
select.setLabel(globalize.translate('Audio'));
|
||||
const selectedId = mediaSource.DefaultAudioStreamIndex;
|
||||
@ -304,7 +304,7 @@ function renderSubtitleSelections(page, mediaSources) {
|
||||
const tracks = mediaSource.MediaStreams.filter(function (m) {
|
||||
return m.Type === 'Subtitle';
|
||||
});
|
||||
tracks.sort((a, b) => itemHelper.sortTracks(a, b));
|
||||
tracks.sort(itemHelper.sortTracks);
|
||||
const select = page.querySelector('.selectSubtitles');
|
||||
select.setLabel(globalize.translate('Subtitles'));
|
||||
const selectedId = mediaSource.DefaultSubtitleStreamIndex == null ? -1 : mediaSource.DefaultSubtitleStreamIndex;
|
||||
|
Loading…
Reference in New Issue
Block a user