mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 23:59:08 +00:00
wip
This commit is contained in:
@@ -35,6 +35,11 @@ export const getStreamUrl = async ({
|
||||
mediaSourceId?: string | null;
|
||||
}) => {
|
||||
if (!api || !userId || !item?.Id) {
|
||||
console.log("getStreamUrl: missing params", {
|
||||
api: api?.basePath,
|
||||
userId,
|
||||
item: item?.Id,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -122,6 +127,12 @@ export const getStreamUrl = async ({
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
console.log("getStreamUrl: no url found", {
|
||||
api: api.basePath,
|
||||
userId,
|
||||
item: item.Id,
|
||||
mediaSourceId,
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,16 @@ import { Api } from "@jellyfin/sdk";
|
||||
import { getAuthHeaders } from "../jellyfin";
|
||||
import { postCapabilities } from "../session/capabilities";
|
||||
import { Settings } from "@/utils/atoms/settings";
|
||||
import {
|
||||
getMediaInfoApi,
|
||||
getPlaystateApi,
|
||||
getSessionApi,
|
||||
} from "@jellyfin/sdk/lib/utils/api";
|
||||
import { DeviceProfile } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getOrSetDeviceId } from "@/providers/JellyfinProvider";
|
||||
import ios from "@/utils/profiles/ios";
|
||||
import native from "@/utils/profiles/native";
|
||||
import old from "@/utils/profiles/old";
|
||||
|
||||
interface ReportPlaybackProgressParams {
|
||||
api?: Api | null;
|
||||
@@ -33,31 +43,29 @@ export const reportPlaybackProgress = async ({
|
||||
console.info("reportPlaybackProgress ~ IsPaused", IsPaused);
|
||||
|
||||
try {
|
||||
await postCapabilities({
|
||||
api,
|
||||
await getPlaystateApi(api).onPlaybackProgress({
|
||||
itemId,
|
||||
sessionId,
|
||||
deviceProfile,
|
||||
audioStreamIndex: 0,
|
||||
subtitleStreamIndex: 0,
|
||||
mediaSourceId: itemId,
|
||||
positionTicks: Math.round(positionTicks),
|
||||
isPaused: IsPaused,
|
||||
isMuted: false,
|
||||
playMethod: "Transcode",
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to post capabilities.", error);
|
||||
throw new Error("Failed to post capabilities.");
|
||||
}
|
||||
|
||||
try {
|
||||
await api.axiosInstance.post(
|
||||
`${api.basePath}/Sessions/Playing/Progress`,
|
||||
{
|
||||
ItemId: itemId,
|
||||
PlaySessionId: sessionId,
|
||||
IsPaused,
|
||||
PositionTicks: Math.round(positionTicks),
|
||||
CanSeek: true,
|
||||
MediaSourceId: itemId,
|
||||
EventName: "timeupdate",
|
||||
},
|
||||
{ headers: getAuthHeaders(api) }
|
||||
);
|
||||
// await api.axiosInstance.post(
|
||||
// `${api.basePath}/Sessions/Playing/Progress`,
|
||||
// {
|
||||
// ItemId: itemId,
|
||||
// PlaySessionId: sessionId,
|
||||
// IsPaused,
|
||||
// PositionTicks: Math.round(positionTicks),
|
||||
// CanSeek: true,
|
||||
// MediaSourceId: itemId,
|
||||
// EventName: "timeupdate",
|
||||
// },
|
||||
// { headers: getAuthHeaders(api) }
|
||||
// );
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user