Merge branch 'feat/audio-select'

This commit is contained in:
Fredrik Burmester
2024-08-13 13:27:09 +02:00
9 changed files with 253 additions and 19 deletions

View File

@@ -14,6 +14,8 @@ export const getStreamUrl = async ({
maxStreamingBitrate,
sessionData,
deviceProfile = ios12,
audioStreamIndex = 0,
subtitleStreamIndex = 0,
}: {
api: Api | null | undefined;
item: BaseItemDto | null | undefined;
@@ -22,6 +24,8 @@ export const getStreamUrl = async ({
maxStreamingBitrate?: number;
sessionData: PlaybackInfoResponse;
deviceProfile: any;
audioStreamIndex?: number;
subtitleStreamIndex?: number;
}) => {
if (!api || !userId || !item?.Id) {
return null;
@@ -40,6 +44,8 @@ export const getStreamUrl = async ({
AutoOpenLiveStream: true,
MediaSourceId: itemId,
AllowVideoStreamCopy: maxStreamingBitrate ? false : true,
AudioStreamIndex: audioStreamIndex,
SubtitleStreamIndex: subtitleStreamIndex,
},
{
headers: {

7
utils/textTools.ts Normal file
View File

@@ -0,0 +1,7 @@
/*
* Truncate a text longer than a certain length
*/
export const tc = (text: string | null | undefined, length: number = 20) => {
if (!text) return "";
return text.length > length ? text.substr(0, length) + "..." : text;
};