From f3a9fc9d1c68995f82fab5faff3416225fa60d2b Mon Sep 17 00:00:00 2001 From: lance chant <13349722+lancechant@users.noreply.github.com> Date: Tue, 15 Jul 2025 08:41:52 +0200 Subject: [PATCH] fix: always transcode with profile 5 (#703) Signed-off-by: Lance Chant <13349722+lancechant@users.noreply.github.com> --- utils/profiles/native.js | 44 ++++++---------------------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/utils/profiles/native.js b/utils/profiles/native.js index 7a40dd8a..ff4c0ea4 100644 --- a/utils/profiles/native.js +++ b/utils/profiles/native.js @@ -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; };