ridvanaltun / react-native-deepar

Snapchat-like filters, AR lenses, and real-time facial animations.
https://deepar.ai
MIT License
127 stars 17 forks source link

Getting blank screen when reopens the camera in some Iphones #43

Open ctlincfaisal opened 10 months ago

ctlincfaisal commented 10 months ago

Camera got open fine at the first time, Then when i leave the page and comes back, I see blank screen. Some suggestions says to shutdown the camera when goes back and then when you come back to camera page it will reinitialised itself. But the deepARRef1 does not contain shutdown function to call. Here is the code i am using

import React, { useEffect, useRef } from 'react'; import { TouchableOpacity } from 'react-native'; import { View } from 'react-native'; import { Text } from 'react-native'; import DeepARView from 'react-native-deepar';

const DeepARWrapper = (props) => { const deepARRef1 = useRef(null);

return ( <View style={{ flex: 1 }}> <TouchableOpacity style={{ position: 'absolute', top: 70, left: 20, zIndex: 33333, flexDirection: 'row', justifyContent: 'center', alignItems: 'center' }} onPress={()=>{ deepARRef1.current.shutdown(); // tried to call here

        props.navigation.goBack();
      }}>
        <Text style={{ color: 'red', marginLeft: 5 }}>Go Back</Text>
      </TouchableOpacity>
      <DeepARView 
        ref={deepARRef1}
        apiKey="-" 
        style={{flex: 1}} 
        onInitialized={() => {
          // deepARRef1.current.resume();
          console.log('==================initialized now==================');
        }}
        onShutdownFinished={() => {

          console.log('================== onShutdownFinished now ==================');
        }}
      />
</View>

); };

export default DeepARWrapper;

ctlincfaisal commented 9 months ago

Anyone have solution for this issue yet ?