From ac9bcbcb9f6353a989f52f0c7df11e19dbab6d6c Mon Sep 17 00:00:00 2001 From: Fredrik Burmester Date: Tue, 15 Oct 2024 13:08:03 +0200 Subject: [PATCH] fix: always use native device profile --- components/DownloadItem.tsx | 10 +- components/settings/SettingToggles.tsx | 57 ----- providers/PlaySettingsProvider.tsx | 12 +- utils/jellyfin/media/getStreamUrl.ts | 4 +- utils/jellyfin/session/capabilities.ts | 11 +- utils/profiles/native.js | 339 +++++++------------------ 6 files changed, 100 insertions(+), 333 deletions(-) diff --git a/components/DownloadItem.tsx b/components/DownloadItem.tsx index e68b5dae..451195e6 100644 --- a/components/DownloadItem.tsx +++ b/components/DownloadItem.tsx @@ -98,18 +98,10 @@ export const DownloadItem: React.FC = ({ item, ...props }) => { ); } - let deviceProfile: any = iosFmp4; - - if (settings?.deviceProfile === "Native") { - deviceProfile = native; - } else if (settings?.deviceProfile === "Old") { - deviceProfile = old; - } - const response = await api.axiosInstance.post( `${api.basePath}/Items/${item.Id}/PlaybackInfo`, { - DeviceProfile: deviceProfile, + DeviceProfile: native, UserId: user.Id, MaxStreamingBitrate: maxBitrate.value, StartTimeTicks: 0, diff --git a/components/settings/SettingToggles.tsx b/components/settings/SettingToggles.tsx index 0688226a..fc9cbf00 100644 --- a/components/settings/SettingToggles.tsx +++ b/components/settings/SettingToggles.tsx @@ -350,63 +350,6 @@ export const SettingToggles: React.FC = ({ ...props }) => { /> - - - Device profile - - A profile used for deciding what audio and video codecs the - device supports. - - - - - - {settings.deviceProfile} - - - - Profiles - { - updateSettings({ deviceProfile: "Expo" }); - }} - > - Expo - - { - updateSettings({ deviceProfile: "Native" }); - }} - > - Native - - { - updateSettings({ deviceProfile: "Old" }); - }} - > - Old - - - - - = ({ return null; } - let deviceProfile: any = iosFmp4; - if (settings?.deviceProfile === "Native") deviceProfile = native; - if (settings?.deviceProfile === "Old") deviceProfile = old; - try { const data = await getStreamUrl({ api, - deviceProfile, + deviceProfile: native, item: newSettings?.item, mediaSourceId: newSettings?.mediaSource?.Id, startTimeTicks: 0, @@ -127,16 +123,12 @@ export const PlaySettingsProvider: React.FC<{ children: React.ReactNode }> = ({ ); useEffect(() => { - let deviceProfile: any = ios; - if (settings?.deviceProfile === "Native") deviceProfile = native; - if (settings?.deviceProfile === "Old") deviceProfile = old; - const postCaps = async () => { if (!api) return; await getSessionApi(api).postFullCapabilities({ clientCapabilitiesDto: { AppStoreUrl: "https://apps.apple.com/us/app/streamyfin/id6593660679", - DeviceProfile: deviceProfile, + DeviceProfile: native as any, IconUrl: "https://raw.githubusercontent.com/retardgerman/streamyfinweb/refs/heads/redesign/public/assets/images/icon_new_withoutBackground.png", PlayableMediaTypes: ["Audio", "Video"], diff --git a/utils/jellyfin/media/getStreamUrl.ts b/utils/jellyfin/media/getStreamUrl.ts index 8096d827..38af5c7f 100644 --- a/utils/jellyfin/media/getStreamUrl.ts +++ b/utils/jellyfin/media/getStreamUrl.ts @@ -16,7 +16,7 @@ export const getStreamUrl = async ({ startTimeTicks = 0, maxStreamingBitrate, sessionData, - deviceProfile = iosFmp4, + deviceProfile = native, audioStreamIndex = 0, subtitleStreamIndex = undefined, forceDirectPlay = false, @@ -89,7 +89,7 @@ export const getStreamUrl = async ({ { method: "POST", data: { - deviceProfile: forceDirectPlay ? native : deviceProfile, + deviceProfile: native, userId, maxStreamingBitrate, startTimeTicks, diff --git a/utils/jellyfin/session/capabilities.ts b/utils/jellyfin/session/capabilities.ts index 0d26b813..99ef5cb1 100644 --- a/utils/jellyfin/session/capabilities.ts +++ b/utils/jellyfin/session/capabilities.ts @@ -31,15 +31,6 @@ export const postCapabilities = async ({ throw new Error("Missing parameters for marking item as not played"); } - let profile: any = iosFmp4; - - if (deviceProfile === "Native") { - profile = native; - } - if (deviceProfile === "Old") { - profile = old; - } - try { const d = api.axiosInstance.post( api.basePath + "/Sessions/Capabilities/Full", @@ -57,7 +48,7 @@ export const postCapabilities = async ({ ], supportsMediaControl: true, id: sessionId, - DeviceProfile: profile, + DeviceProfile: native, }, { headers: getAuthHeaders(api), diff --git a/utils/profiles/native.js b/utils/profiles/native.js index 41bf0f29..4d030936 100644 --- a/utils/profiles/native.js +++ b/utils/profiles/native.js @@ -15,280 +15,129 @@ export default { MusicStreamingTranscodingBitrate: 384000, CodecProfiles: [ { - Codec: "h264", - Conditions: [ - { - Condition: "NotEquals", - IsRequired: false, - Property: "IsAnamorphic", - Value: "true", - }, - { - Condition: "EqualsAny", - IsRequired: false, - Property: "VideoProfile", - Value: "high|main|baseline|constrained baseline", - }, - { - Condition: "LessThanEqual", - IsRequired: false, - Property: "VideoLevel", - Value: "80", - }, - { - Condition: "NotEquals", - IsRequired: false, - Property: "IsInterlaced", - Value: "true", - }, - ], Type: MediaTypes.Video, + Codec: "h264,h265,hevc,mpeg4,divx,xvid,wmv,vc1,vp8,vp9,av1", }, { - Codec: "hevc", - Conditions: [ - { - Condition: "NotEquals", - IsRequired: false, - Property: "IsAnamorphic", - Value: "true", - }, - { - Condition: "EqualsAny", - IsRequired: false, - Property: "VideoProfile", - Value: "high|main|main 10", - }, - { - Condition: "LessThanEqual", - IsRequired: false, - Property: "VideoLevel", - Value: "175", - }, - { - Condition: "NotEquals", - IsRequired: false, - Property: "IsInterlaced", - Value: "true", - }, - ], - Type: MediaTypes.Video, + Type: MediaTypes.Audio, + Codec: "aac,ac3,eac3,mp3,flac,alac,opus,vorbis,pcm,wma", }, ], DirectPlayProfiles: [ { - AudioCodec: "flac,alac,aac,eac3,ac3,opus", - Container: "mp4", Type: MediaTypes.Video, - VideoCodec: "hevc,h264,mpeg4", + Container: "mp4,mkv,avi,mov,flv,ts,m2ts,webm,ogv,3gp", + VideoCodec: "h264,h265,hevc,mpeg4,divx,xvid,wmv,vc1,vp8,vp9,av1", + AudioCodec: "aac,ac3,eac3,mp3,flac,alac,opus,vorbis,wma", }, { - AudioCodec: "flac,alac,aac,eac3,ac3,opus", - Container: "mkv", - Type: MediaTypes.Video, - VideoCodec: "hevc,h264,mpeg4", - }, - { - AudioCodec: "alac,aac,ac3", - Container: "m4v", - Type: MediaTypes.Video, - VideoCodec: "h264,mpeg4", - }, - { - AudioCodec: - "alac,aac,eac3,ac3,mp3,pcm_s24be,pcm_s24le,pcm_s16be,pcm_s16le", - Container: "mov", - Type: MediaTypes.Video, - VideoCodec: "hevc,h264,mpeg4,mjpeg", - }, - { - AttrudioCodec: "aac,eac3,ac3,mp3", - Container: "mpegts", - Type: MediaTypes.Video, - VideoCodec: "h264", - }, - { - AttrudioCodec: "aac,amr_nb", - Container: "3gp,3g2", - Type: MediaTypes.Video, - VideoCodec: "h264,mpeg4", - }, - { - AttrudioCodec: "pcm_s16le,pcm_mulaw", - Container: "avi", - Type: MediaTypes.Video, - VideoCodec: "mjpeg", - }, - { - Container: "mp3", - Type: MediaTypes.Audio, - }, - { - Container: "aac", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "aac", - Container: "m4a", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "aac", - Container: "m4b", - Type: MediaTypes.Audio, - }, - { - Container: "flac", - Type: MediaTypes.Audio, - }, - { - Container: "alac", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "alac", - Container: "m4a", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "alac", - Container: "m4b", - Type: MediaTypes.Audio, - }, - { - Container: "wav", Type: MediaTypes.Audio, + Container: "mp3,aac,flac,alac,wav,ogg,wma", + AudioCodec: "mp3,aac,flac,alac,opus,vorbis,wma,pcm", }, ], TranscodingProfiles: [ { - AudioCodec: "flac,alac,aac,eac3,ac3,opus", - BreakOnNonKeyFrames: true, - Container: "mp4", - Context: "streaming", - MaxAudioChannels: "8", - MinSegments: 2, + Type: MediaTypes.Video, + Context: "Streaming", Protocol: "hls", - Type: "video", - VideoCodec: "hevc,h264,mpeg4", - }, - { - AudioCodec: "aac", - BreakOnNonKeyFrames: true, - Container: "aac", - Context: "Streaming", - MaxAudioChannels: "6", - MinSegments: "2", - Protocol: "hls", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "aac", - Container: "aac", - Context: "Streaming", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "mp3", - Container: "mp3", - Context: "Streaming", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "wav", - Container: "wav", - Context: "Streaming", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "mp3", - Container: "mp3", - Context: "Static", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "aac", - Container: "aac", - Context: "Static", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "wav", - Container: "wav", - Context: "Static", - MaxAudioChannels: "6", - Protocol: "http", - Type: MediaTypes.Audio, - }, - { - AudioCodec: "aac,mp3", - BreakOnNonKeyFrames: true, Container: "ts", - Context: "Streaming", - MaxAudioChannels: "6", - MinSegments: "2", - Protocol: "hls", - Type: MediaTypes.Video, VideoCodec: "h264", + AudioCodec: "aac,mp3,ac3", + MaxAudioChannels: "8", + MinSegments: "2", + BreakOnNonKeyFrames: true, }, { - AudioCodec: "aac,mp3,ac3,eac3,flac,alac", - Container: "mp4", - Context: "Static", + Type: MediaTypes.Audio, + Context: "Streaming", Protocol: "http", - Type: MediaTypes.Video, - VideoCodec: "h264", + Container: "mp3", + AudioCodec: "mp3", + MaxAudioChannels: "2", }, ], ResponseProfiles: [ { - Container: "m4v", + Container: "mkv", + MimeType: "video/x-matroska", + Type: MediaTypes.Video, + }, + { + Container: "mp4", MimeType: "video/mp4", Type: MediaTypes.Video, }, ], SubtitleProfiles: [ - { - Format: "srt", - Method: "external", - }, - { - Format: "pgssub", - Method: "embed", - }, - { - Format: "dvdsub", - Method: "embed", - }, - { - Format: "dvbsub", - Method: "embed", - }, - { - Format: "xsub", - Method: "embed", - }, - { - Format: "vtt", - Method: "embed", - }, - { - Format: "ttml", - Method: "embed", - }, - { - Format: "cc_dec", - Method: "embed", - }, + { Format: "srt", Method: "Embed" }, + { Format: "srt", Method: "External" }, + { Format: "srt", Method: "Encode" }, + { Format: "ass", Method: "Embed" }, + { Format: "ass", Method: "External" }, + { Format: "ass", Method: "Encode" }, + { Format: "ssa", Method: "Embed" }, + { Format: "ssa", Method: "External" }, + { Format: "ssa", Method: "Encode" }, + { Format: "sub", Method: "Embed" }, + { Format: "sub", Method: "External" }, + { Format: "sub", Method: "Encode" }, + { Format: "vtt", Method: "Embed" }, + { Format: "vtt", Method: "External" }, + { Format: "vtt", Method: "Encode" }, + { Format: "ttml", Method: "Embed" }, + { Format: "ttml", Method: "External" }, + { Format: "ttml", Method: "Encode" }, + { Format: "pgs", Method: "Embed" }, + { Format: "pgs", Method: "External" }, + { Format: "pgs", Method: "Encode" }, + { Format: "dvdsub", Method: "Embed" }, + { Format: "dvdsub", Method: "External" }, + { Format: "dvdsub", Method: "Encode" }, + { Format: "dvbsub", Method: "Embed" }, + { Format: "dvbsub", Method: "External" }, + { Format: "dvbsub", Method: "Encode" }, + { Format: "xsub", Method: "Embed" }, + { Format: "xsub", Method: "External" }, + { Format: "xsub", Method: "Encode" }, + { Format: "mov_text", Method: "Embed" }, + { Format: "mov_text", Method: "External" }, + { Format: "mov_text", Method: "Encode" }, + { Format: "scc", Method: "Embed" }, + { Format: "scc", Method: "External" }, + { Format: "scc", Method: "Encode" }, + { Format: "smi", Method: "Embed" }, + { Format: "smi", Method: "External" }, + { Format: "smi", Method: "Encode" }, + { Format: "teletext", Method: "Embed" }, + { Format: "teletext", Method: "External" }, + { Format: "teletext", Method: "Encode" }, + { Format: "microdvd", Method: "Embed" }, + { Format: "microdvd", Method: "External" }, + { Format: "microdvd", Method: "Encode" }, + { Format: "mpl2", Method: "Embed" }, + { Format: "mpl2", Method: "External" }, + { Format: "mpl2", Method: "Encode" }, + { Format: "pjs", Method: "Embed" }, + { Format: "pjs", Method: "External" }, + { Format: "pjs", Method: "Encode" }, + { Format: "realtext", Method: "Embed" }, + { Format: "realtext", Method: "External" }, + { Format: "realtext", Method: "Encode" }, + { Format: "stl", Method: "Embed" }, + { Format: "stl", Method: "External" }, + { Format: "stl", Method: "Encode" }, + { Format: "subrip", Method: "Embed" }, + { Format: "subrip", Method: "External" }, + { Format: "subrip", Method: "Encode" }, + { Format: "subviewer", Method: "Embed" }, + { Format: "subviewer", Method: "External" }, + { Format: "subviewer", Method: "Encode" }, + { Format: "text", Method: "Embed" }, + { Format: "text", Method: "External" }, + { Format: "text", Method: "Encode" }, + { Format: "vplayer", Method: "Embed" }, + { Format: "vplayer", Method: "External" }, + { Format: "vplayer", Method: "Encode" }, ], };