Skip to content

Commit

Permalink
fix: choose default/selected audio streams first
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbenincasa committed Dec 27, 2024
1 parent 2f39648 commit 732e81d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions server/src/stream/jellyfin/JellyfinStreamDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
isUndefined,
map,
replace,
sortBy,
takeWhile,
trimEnd,
trimStart,
Expand Down Expand Up @@ -254,9 +255,12 @@ export class JellyfinStreamDetails {
}

const audioStreamDetails = map(
filter(
firstMediaSource?.MediaStreams,
(stream) => stream.Type === 'Audio',
sortBy(
filter(
firstMediaSource?.MediaStreams,
(stream) => stream.Type === 'Audio',
),
(stream) => [stream.Index ?? 0, !!stream.IsDefault],
),
(audioStream) => {
return {
Expand Down
10 changes: 7 additions & 3 deletions server/src/stream/plex/PlexStreamDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
maxBy,
replace,
round,
sortBy,
trimEnd,
} from 'lodash-es';
import { NonEmptyArray } from 'ts-essentials';
Expand Down Expand Up @@ -304,9 +305,12 @@ export class PlexStreamDetails {
}

const audioStreamDetails = map(
filter(mediaStreams, (stream): stream is PlexMediaAudioStream => {
return stream.streamType === 2;
}),
sortBy(
filter(mediaStreams, (stream): stream is PlexMediaAudioStream => {
return stream.streamType === 2;
}),
(stream) => [stream.index, stream.selected ?? stream.default ?? false],
),
(audioStream) => {
return {
bitrate: audioStream.bitrate,
Expand Down

0 comments on commit 732e81d

Please sign in to comment.