keep awake while playing video or audio

This commit is contained in:
balzack 2025-01-19 07:59:02 -08:00
parent 0ba2eeab96
commit 97f359f2da
6 changed files with 13056 additions and 9303 deletions

View File

@ -644,7 +644,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
@ -728,7 +731,10 @@
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
OTHER_LDFLAGS = "$(inherited) ";
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;

View File

@ -1355,6 +1355,8 @@ PODS:
- Yoga
- react-native-image-resizer (3.0.11):
- React-Core
- react-native-keep-awake (1.3.0):
- React-Core
- react-native-rsa-native (2.0.5):
- React
- react-native-safe-area-context (4.14.1):
@ -1896,6 +1898,7 @@ DEPENDENCIES:
- react-native-create-thumbnail (from `../node_modules/react-native-create-thumbnail`)
- react-native-document-picker (from `../node_modules/react-native-document-picker`)
- "react-native-image-resizer (from `../node_modules/@bam.tech/react-native-image-resizer`)"
- "react-native-keep-awake (from `../node_modules/@sayem314/react-native-keep-awake`)"
- react-native-rsa-native (from `../node_modules/react-native-rsa-native`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-sqlite-storage (from `../node_modules/react-native-sqlite-storage`)
@ -2038,6 +2041,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-document-picker"
react-native-image-resizer:
:path: "../node_modules/@bam.tech/react-native-image-resizer"
react-native-keep-awake:
:path: "../node_modules/@sayem314/react-native-keep-awake"
react-native-rsa-native:
:path: "../node_modules/react-native-rsa-native"
react-native-safe-area-context:
@ -2136,14 +2141,14 @@ SPEC CHECKSUMS:
FirebaseInstallations: d8063d302a426d114ac531cd82b1e335a0565745
FirebaseMessaging: 9f4e42053241bd45ce8565c881bfdd9c1df2f7da
fmt: 4c2741a687cc09f0634a2e2c72a838b99f1ff120
glog: fdfdfe5479092de0c4bdbebedd9056951f092c4f
glog: 69ef571f3de08433d766d614c73a9838a06bf7eb
GoogleDataTransport: aae35b7ea0c09004c3797d53c8c41f66f219d6a7
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
hermes-engine: 3b6e0717ca847e2fc90a201e59db36caf04dee88
libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
RCT-Folly: 02617c592a293bd6d418e0a88ff4ee1f88329b47
RCT-Folly: 4464f4d875961fce86008d45f4ecf6cef6de0740
RCTDeprecation: 726d24248aeab6d7180dac71a936bbca6a994ed1
RCTRequired: a94e7febda6db0345d207e854323c37e3a31d93b
RCTTypeSafety: 28e24a6e44f5cbf912c66dde6ab7e07d1059a205
@ -2176,6 +2181,7 @@ SPEC CHECKSUMS:
react-native-create-thumbnail: 4ffd51a6c02a9313edc74e2460cd07264221f554
react-native-document-picker: 1928548d8b19bbc9f2219b01f1d350aa8ff76508
react-native-image-resizer: 6260ba497fb8d1a593c1c92ccd593f570df6f5b7
react-native-keep-awake: 294e077916c643d38883731ea1b2fe5e4903b255
react-native-rsa-native: 12132eb627797529fdb1f0d22fd0f8f9678df64a
react-native-safe-area-context: 141eca0fd4e4191288dfc8b96a7c7e1c2983447a
react-native-sqlite-storage: f6d515e1c446d1e6d026aa5352908a25d4de3261
@ -2222,7 +2228,7 @@ SPEC CHECKSUMS:
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
Yoga: a9ef4f5c2cd79ad812110525ef61048be6a582a4
Yoga: b05994d1933f507b0a28ceaa4fdb968dc18da178
PODFILE CHECKSUM: 9cf7373afef7b881c911fda82ff1f94eacee3e98

View File

@ -22,6 +22,7 @@
"@react-navigation/native": "^6.1.18",
"@react-navigation/native-stack": "^6.11.0",
"@react-navigation/stack": "^6.4.1",
"@sayem314/react-native-keep-awake": "^1.3.0",
"@types/react-native": "^0.73.0",
"@types/react-native-video": "^5.0.20",
"crypto-js": "^3.3.0",

View File

@ -8,6 +8,7 @@ import {BlurView} from '@react-native-community/blur';
import Video, { VideoRef } from 'react-native-video'
import thumb from '../../images/audio.png';
import {Colors} from '../../constants/Colors';
import { activateKeepAwake, deactivateKeepAwake} from "@sayem314/react-native-keep-awake";
export function AudioAsset({ topicId, asset, loaded, show }: { topicId: string, asset: MediaAsset, loaded: ()=>void, show: boolean }) {
const { state, actions } = useAudioAsset(topicId, asset);
@ -30,11 +31,13 @@ export function AudioAsset({ topicId, asset, loaded, show }: { topicId: string,
const showAudio = () => {
setModal(true);
actions.loadAudio();
activateKeepAwake()
};
const hideAudio = () => {
setModal(false);
actions.cancelLoad();
deactivateKeepAwake();
}
const play = () => {

View File

@ -7,6 +7,7 @@ import { styles } from './VideoAsset.styled'
import {BlurView} from '@react-native-community/blur';
import Video, { VideoRef } from 'react-native-video'
import { Colors } from '../../constants/Colors';
import { activateKeepAwake, deactivateKeepAwake} from "@sayem314/react-native-keep-awake";
export function VideoAsset({ topicId, asset, loaded, show }: { topicId: string, asset: MediaAsset, loaded: ()=>void, show: boolean }) {
const { state, actions } = useVideoAsset(topicId, asset);
@ -34,11 +35,13 @@ export function VideoAsset({ topicId, asset, loaded, show }: { topicId: string,
const showVideo = () => {
setModal(true);
actions.loadVideo();
activateKeepAwake();
};
const hideVideo = () => {
setModal(false);
actions.cancelLoad();
deactivateKeepAwake();
}
const controls = () => {

File diff suppressed because it is too large Load Diff