mirror of
https://github.com/streamyfin/streamyfin.git
synced 2025-08-20 18:37:18 +02:00
fix: always transcode with profile 5 (#703)
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