mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-03-18 23:36:22 +00:00
wip
This commit is contained in:
@@ -59,7 +59,6 @@ export type Settings = {
|
||||
forceLandscapeInVideoPlayer?: boolean;
|
||||
usePopularPlugin?: boolean;
|
||||
deviceProfile?: "Expo" | "Native" | "Old";
|
||||
forceDirectPlay?: boolean;
|
||||
mediaListCollectionIds?: string[];
|
||||
searchEngine: "Marlin" | "Jellyfin";
|
||||
marlinServerUrl?: string;
|
||||
@@ -90,7 +89,6 @@ const loadSettings = async (): Promise<Settings> => {
|
||||
forceLandscapeInVideoPlayer: false,
|
||||
usePopularPlugin: false,
|
||||
deviceProfile: "Expo",
|
||||
forceDirectPlay: false,
|
||||
mediaListCollectionIds: [],
|
||||
searchEngine: "Jellyfin",
|
||||
marlinServerUrl: "",
|
||||
|
||||
@@ -19,7 +19,6 @@ export const getStreamUrl = async ({
|
||||
deviceProfile = native,
|
||||
audioStreamIndex = 0,
|
||||
subtitleStreamIndex = undefined,
|
||||
forceDirectPlay = false,
|
||||
mediaSourceId,
|
||||
}: {
|
||||
api: Api | null | undefined;
|
||||
@@ -31,7 +30,6 @@ export const getStreamUrl = async ({
|
||||
deviceProfile: any;
|
||||
audioStreamIndex?: number;
|
||||
subtitleStreamIndex?: number;
|
||||
forceDirectPlay?: boolean;
|
||||
height?: number;
|
||||
mediaSourceId?: string | null;
|
||||
}): Promise<{
|
||||
@@ -114,17 +112,17 @@ export const getStreamUrl = async ({
|
||||
);
|
||||
|
||||
if (item.MediaType === "Video") {
|
||||
if (mediaSource?.SupportsDirectPlay || forceDirectPlay === true) {
|
||||
if (mediaSource?.TranscodingUrl) {
|
||||
return {
|
||||
url: `${api.basePath}/Videos/${itemId}/stream.mp4?playSessionId=${sessionData?.PlaySessionId}&mediaSourceId=${mediaSource?.Id}&static=true&subtitleStreamIndex=${subtitleStreamIndex}&audioStreamIndex=${audioStreamIndex}&deviceId=${api.deviceInfo.id}&api_key=${api.accessToken}`,
|
||||
url: `${api.basePath}${mediaSource.TranscodingUrl}`,
|
||||
sessionId: sessionId,
|
||||
mediaSource,
|
||||
};
|
||||
}
|
||||
|
||||
if (mediaSource?.TranscodingUrl) {
|
||||
if (mediaSource?.SupportsDirectPlay) {
|
||||
return {
|
||||
url: `${api.basePath}${mediaSource.TranscodingUrl}`,
|
||||
url: `${api.basePath}/Videos/${itemId}/stream.mp4?playSessionId=${sessionData?.PlaySessionId}&mediaSourceId=${mediaSource?.Id}&static=true&subtitleStreamIndex=${subtitleStreamIndex}&audioStreamIndex=${audioStreamIndex}&deviceId=${api.deviceInfo.id}&api_key=${api.accessToken}`,
|
||||
sessionId: sessionId,
|
||||
mediaSource,
|
||||
};
|
||||
|
||||
@@ -39,13 +39,23 @@ export const runtimeTicksToSeconds = (
|
||||
// t: ms
|
||||
export const formatTimeString = (
|
||||
t: number | null | undefined,
|
||||
tick = false
|
||||
unit: "s" | "ms" | "tick" = "ms"
|
||||
): string => {
|
||||
if (t === null || t === undefined) return "0:00";
|
||||
|
||||
let seconds = t / 1000;
|
||||
if (tick) {
|
||||
seconds = Math.floor(t / 10000000); // Convert ticks to seconds
|
||||
let seconds: number;
|
||||
switch (unit) {
|
||||
case "s":
|
||||
seconds = Math.floor(t);
|
||||
break;
|
||||
case "ms":
|
||||
seconds = Math.floor(t / 1000);
|
||||
break;
|
||||
case "tick":
|
||||
seconds = Math.floor(t / 10000000);
|
||||
break;
|
||||
default:
|
||||
seconds = Math.floor(t / 1000); // Default to ms if an invalid type is provided
|
||||
}
|
||||
|
||||
if (seconds < 0) return "0:00";
|
||||
|
||||
Reference in New Issue
Block a user