1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Backport pull request #4263 from jellyfin/release-10.8.z

Fix change audio track

Original-merge: 9139153d16

Merged-by: Bill Thornton <thornbill@users.noreply.github.com>

Backported-by: Joshua M. Boniface <joshua@boniface.me>
This commit is contained in:
Dmitry Lyzo 2023-01-22 14:08:02 -05:00 committed by Joshua M. Boniface
parent 5e6de2d7db
commit abed235b50
4 changed files with 84 additions and 42 deletions

View file

@ -11,6 +11,7 @@ import { appHost } from '../apphost';
import Screenfull from 'screenfull';
import ServerConnections from '../ServerConnections';
import alert from '../alert';
import { includesAny } from '../../utils/container.ts';
const UNLIMITED_ITEMS = -1;
@ -1287,6 +1288,7 @@ class PlaybackManager {
return false;
}
const container = mediaSource.Container.toLowerCase();
const codec = (mediaStream.Codec || '').toLowerCase();
if (!codec) {
@ -1295,22 +1297,11 @@ class PlaybackManager {
const profiles = deviceProfile.DirectPlayProfiles || [];
return profiles.filter(function (p) {
if (p.Type === 'Video') {
if (!p.AudioCodec) {
return true;
}
// This is an exclusion filter
if (p.AudioCodec.indexOf('-') === 0) {
return p.AudioCodec.toLowerCase().indexOf(codec) === -1;
}
return p.AudioCodec.toLowerCase().indexOf(codec) !== -1;
}
return false;
}).length > 0;
return profiles.some(function (p) {
return p.Type === 'Video'
&& includesAny((p.Container || '').toLowerCase(), container)
&& includesAny((p.AudioCodec || '').toLowerCase(), codec);
});
}
self.setAudioStreamIndex = function (index, player) {