mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-15 15:48:05 +00:00
fix: always transcode with profile 5 (#703)
Some checks failed
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
Some checks failed
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com>
This commit is contained in:
@@ -7,28 +7,7 @@ import DeviceInfo from "react-native-device-info";
|
||||
*/
|
||||
import MediaTypes from "../../constants/MediaTypes";
|
||||
|
||||
// Helper function to detect Dolby Vision support
|
||||
const supportsDolbyVision = async () => {
|
||||
if (Platform.OS === "ios") {
|
||||
const deviceModel = await DeviceInfo.getModel();
|
||||
// iPhone 12 and newer generally support Dolby Vision
|
||||
const modelNumber = Number.parseInt(deviceModel.replace(/iPhone/, ""), 10);
|
||||
return !Number.isNaN(modelNumber) && modelNumber >= 12;
|
||||
}
|
||||
|
||||
if (Platform.OS === "android") {
|
||||
const apiLevel = await DeviceInfo.getApiLevel();
|
||||
const isHighEndDevice =
|
||||
(await DeviceInfo.getTotalMemory()) > 4 * 1024 * 1024 * 1024; // >4GB RAM
|
||||
// Very rough approximation - Android 10+ on higher-end devices may support it
|
||||
return apiLevel >= 29 && isHighEndDevice;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
export const generateDeviceProfile = async () => {
|
||||
const dolbyVisionSupported = await supportsDolbyVision();
|
||||
/**
|
||||
* Device profile for Native video player
|
||||
*/
|
||||
@@ -51,7 +30,12 @@ export const generateDeviceProfile = async () => {
|
||||
Value: "153",
|
||||
IsRequired: false,
|
||||
},
|
||||
// We'll add Dolby Vision condition below if not supported
|
||||
{
|
||||
Condition: "NotEquals",
|
||||
Property: "VideoRangeType",
|
||||
Value: "DOVI", //no dolby vision at all
|
||||
IsRequired: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -172,22 +156,6 @@ export const generateDeviceProfile = async () => {
|
||||
],
|
||||
};
|
||||
|
||||
// Add Dolby Vision restriction if not supported
|
||||
if (!dolbyVisionSupported) {
|
||||
const hevcProfile = profile.CodecProfiles.find(
|
||||
(p) => p.Type === MediaTypes.Video && p.Codec.includes("hevc"),
|
||||
);
|
||||
|
||||
if (hevcProfile) {
|
||||
hevcProfile.Conditions.push({
|
||||
Condition: "NotEquals",
|
||||
Property: "VideoRangeType",
|
||||
Value: "DOVI", //no dolby vision at all
|
||||
IsRequired: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return profile;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user