feat: prepare for force resolution

This commit is contained in:
Fredrik Burmester
2024-08-25 11:14:43 +02:00
parent ec5aab99b8
commit 5c95730715
3 changed files with 21 additions and 7 deletions

View File

@@ -114,6 +114,7 @@ const page: React.FC = () => {
audioStreamIndex: selectedAudioStream,
subtitleStreamIndex: selectedSubtitleStream,
forceDirectPlay: settings?.forceDirectPlay,
height: maxBitrate.height,
});
console.log("Transcode URL: ", url);

View File

@@ -1,11 +1,11 @@
import { TouchableOpacity, View } from "react-native";
import * as DropdownMenu from "zeego/dropdown-menu";
import { Text } from "./common/Text";
import { atom, useAtom } from "jotai";
export type Bitrate = {
key: string;
value: number | undefined;
height?: number;
};
const BITRATES: Bitrate[] = [
@@ -16,22 +16,27 @@ const BITRATES: Bitrate[] = [
{
key: "8 Mb/s",
value: 8000000,
height: 1080,
},
{
key: "4 Mb/s",
key: "4 Mb/s - 1080p",
value: 4000000,
height: 1080,
},
{
key: "2 Mb/s",
key: "2 Mb/s - 720p",
value: 2000000,
height: 720,
},
{
key: "500 Kb/s",
key: "500 Kb/s - 480p",
value: 500000,
height: 480,
},
{
key: "250 Kb/s",
key: "250 Kb/s - 480p",
value: 250000,
height: 480,
},
];

View File

@@ -17,6 +17,7 @@ export const getStreamUrl = async ({
audioStreamIndex = 0,
subtitleStreamIndex = 0,
forceDirectPlay = false,
height,
}: {
api: Api | null | undefined;
item: BaseItemDto | null | undefined;
@@ -28,6 +29,7 @@ export const getStreamUrl = async ({
audioStreamIndex?: number;
subtitleStreamIndex?: number;
forceDirectPlay?: boolean;
height?: number;
}) => {
if (!api || !userId || !item?.Id) {
return null;
@@ -48,12 +50,16 @@ export const getStreamUrl = async ({
AllowVideoStreamCopy: maxStreamingBitrate ? false : true,
AudioStreamIndex: audioStreamIndex,
SubtitleStreamIndex: subtitleStreamIndex,
DeInterlace: true,
BreakOnNonKeyFrames: false,
CopyTimestamps: false,
EnableMpegtsM2TsMode: false,
},
{
headers: {
Authorization: `MediaBrowser DeviceId="${api.deviceInfo.id}", Token="${api.accessToken}"`,
},
},
}
);
const mediaSource = response.data.MediaSources?.[0] as MediaSourceInfo;
@@ -87,7 +93,9 @@ export const getStreamUrl = async ({
EnableRedirection: "true",
EnableRemoteMedia: "false",
});
return `${api.basePath}/Audio/${itemId}/universal?${searchParams.toString()}`;
return `${
api.basePath
}/Audio/${itemId}/universal?${searchParams.toString()}`;
}
}