react-native-deepar icon indicating copy to clipboard operation
react-native-deepar copied to clipboard

Screen flickers when start recording

Open agam-colaburate opened this issue 2 years ago • 3 comments

Untitled Hi Team, Thanks for this sdk, its wonderfull. I am recently facing an issue that the screen flickers as attached in the gif file and the code is very simple, no rerendering. Help is appreciated.

Pasting the code below

import React, {useRef} from 'react';
import {
  View,
  Platform,
  StyleSheet,
  Text
} from 'react-native';
import DeepARView, {
  CameraPositions,
} from 'react-native-deepar';
import {
  widthPercentageToDP as wp,
} from 'react-native-responsive-screen';

const FilterScreen = () => {
  const deepARRef = useRef(null);

  return (
    <View style={styles.container}>
      <DeepARView
          ref={deepARRef}
          apiKey={API_KEY}
          position={CameraPositions.FRONT}
          onScreenshotTaken={(screenshotPath) => {
            console.log("Screenshot")
          }}
          onVideoRecordingPrepared={() => {
            console.log('onVideoRecordingPrepared');
          }}
          onVideoRecordingStarted={() => {
            console.log('onVideoRecordingStarted');
          }}
          onVideoRecordingFinished={(videoPath) => {
            console.log('onVideoRecordingFinished');
          }}
          onError={(text, type) => {
            console.log('onError =>', text, 'type =>', type);
          }}
          style={{
            width: wp(100),
            height: '100%',
          }}
        />
        <Text onPress={()=>)} style={{position:'absolute',bottom:100, left:10, backgroundColor:'white'}}>Press to record</Text>
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

export default FilterScreen;

agam-colaburate avatar Mar 02 '23 14:03 agam-colaburate

Can you try latest version? There is some major changes @agam-colaburate

ridvanaltun avatar Jun 22 '23 01:06 ridvanaltun

Thanks @ridvanaltun On behalf of agam-colaburate,

I will try it out in a couple of days, but just a side note, I was thinking that the latest version would come with a fix for the very popular issue "Direct local .aar file dependencies are not supported when building an AAR...." in this library where everytime I Install the node module, I have to replace one line in the android level build.gradle of the library as described below -

Original -> implementation fileTree(dir: "libs", include: ["*.aar"])
After changing -> implementation(name: 'deepar-3.4.4', ext: 'aar')

Updated dependencies of android level build.gradle looks like

dependencies {
  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:+"  // From node_modules
  implementation(name: 'deepar-3.4.4', ext: 'aar')

  // CameraX core library using the camera2 implementation
  def camerax_version = "1.1.0"

  implementation "androidx.camera:camera-camera2:${camerax_version}"
  implementation "androidx.camera:camera-lifecycle:${camerax_version}"
  implementation "androidx.camera:camera-view:${camerax_version}"

  // The following line is optional, as the core library is included indirectly by camera-camera2
  implementation "androidx.camera:camera-core:${camerax_version}"
}

TIA.

singhagam1 avatar Jun 22 '23 06:06 singhagam1

Thanks @ridvanaltun On behalf of agam-colaburate,

I will try it out in a couple of days, but just a side note, I was thinking that the latest version would come with a fix for the very popular issue "Direct local .aar file dependencies are not supported when building an AAR...." in this library where everytime I Install the node module, I have to replace one line in the android level build.gradle of the library as described below -

Original -> implementation fileTree(dir: "libs", include: ["*.aar"])
After changing -> implementation(name: 'deepar-3.4.4', ext: 'aar')

Updated dependencies of android level build.gradle looks like

dependencies {
  //noinspection GradleDynamicVersion
  implementation "com.facebook.react:react-native:+"  // From node_modules
  implementation(name: 'deepar-3.4.4', ext: 'aar')

  // CameraX core library using the camera2 implementation
  def camerax_version = "1.1.0"

  implementation "androidx.camera:camera-camera2:${camerax_version}"
  implementation "androidx.camera:camera-lifecycle:${camerax_version}"
  implementation "androidx.camera:camera-view:${camerax_version}"

  // The following line is optional, as the core library is included indirectly by camera-camera2
  implementation "androidx.camera:camera-core:${camerax_version}"
}

TIA.

Hello @singhagam1,

I'm aware of the existence of this error, but when I tried the solution you suggested, I encountered another error. Additionally, this error does not occur in the projects I'm currently working on or in the sample project within the library.

If we move the .aar file to a remote location like Maven on the Android side, the problem will be resolved, but it requires action from the DeepAR team. In fact, the first issue report in this project is about this topic, and you can check it out here: #1.

When the DeepAR team put the SDK on a remote server, we will completely resolve this problem.

Anyways, there is a package called "patch-package" that you can use in your project to more easily resolve the issue you encountered in this library. If you're not using it, I recommend you to use it.

ridvanaltun avatar Jun 22 '23 11:06 ridvanaltun