auto lock player fix

This commit is contained in:
tapframe 2025-09-25 23:00:07 +05:30
parent 0b7bcb52da
commit e9659ee305
2 changed files with 39 additions and 7 deletions

View file

@ -174,8 +174,8 @@
LastUpgradeCheck = 1130;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
DevelopmentTeam = NLXTHANK2N;
LastSwiftMigration = 1250;
DevelopmentTeam = "NLXTHANK2N";
ProvisioningStyle = Automatic;
};
};
@ -389,7 +389,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Nuvio/Nuvio.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NLXTHANK2N;
ENABLE_BITCODE = NO;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
@ -412,9 +415,6 @@
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
DEVELOPMENT_TEAM = "NLXTHANK2N";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
};
name = Debug;
};
@ -425,7 +425,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Nuvio/Nuvio.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NLXTHANK2N;
INFOPLIST_FILE = Nuvio/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@ -442,9 +445,6 @@
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
DEVELOPMENT_TEAM = "NLXTHANK2N";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
};
name = Release;
};

View file

@ -1833,6 +1833,38 @@ const AndroidVideoPlayer: React.FC = () => {
}
}
};
// Keep screen awake during active playback (Android)
const keepAwakeModuleRef = useRef<any>(null);
useEffect(() => {
try {
// Use require to avoid TS dynamic import constraints
// If the module is unavailable, catch and ignore
// eslint-disable-next-line @typescript-eslint/no-var-requires
const mod = require('expo-keep-awake');
keepAwakeModuleRef.current = mod;
} catch (_e) {
keepAwakeModuleRef.current = null;
}
}, []);
// Toggle keep-awake based on playback state
useEffect(() => {
const mod = keepAwakeModuleRef.current;
if (!mod) return;
const activate = mod.activateKeepAwakeAsync || mod.activateKeepAwake;
const deactivate = mod.deactivateKeepAwakeAsync || mod.deactivateKeepAwake;
try {
if (!paused && isPlayerReady && duration > 0) {
activate && activate();
} else {
deactivate && deactivate();
}
} catch (_e) {}
return () => {
try { deactivate && deactivate(); } catch (_e) {}
};
}, [paused, isPlayerReady, duration]);
const handleErrorExit = () => {
try {