Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen flickers when start recording #29

Open
agam-colaburate opened this issue Mar 2, 2023 · 3 comments
Open

Screen flickers when start recording #29

agam-colaburate opened this issue Mar 2, 2023 · 3 comments

Comments

@agam-colaburate
Copy link

agam-colaburate commented Mar 2, 2023

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;
@ridvanaltun
Copy link
Owner

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

@singhagam1
Copy link

singhagam1 commented Jun 22, 2023

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.

@ridvanaltun
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants