f111fei/react-native-unity-view

Easy AR implementation

rpassareti opened this issue · 18 comments

Hi everyone,

I'm trying to implement this plugin with EasyAR 3.0, but every effort I did mades the screen black, without activating the camera.

Looking at the logcat, it's seems the easyar couldn't initialize the camera, but when I build a version from unity directly to the device, works normal

Any tip or advice?

I'm using Unity 2018.2.9
React-Native 0.59.10

igrir commented

@rpassareti I'm using Unity 2019.1.6.f1, React-Native 0.60.4, and EasyAR 3.0.1. I only use Metal for Graphics API (because I'm targeting iOS and also using ARKit for other features). It works fine. I'll try to compile it later into Android

IMG_0410

[Update]

I managed to run it on Android. Some configuration to note of:

  1. Make sure package name which located on app/src/main/AndroidManifest.xml has the same package name with your registered key on EasyAR's website
  2. In Build.Gradle located on UnityExport folder, set the dependencies with this config
    api fileTree(include: ['.jar','.aar'], dir: 'libs')

@igrir can you share your code and project plz?

@igrir thx for the share!

but where did you change the EasyAR Key on the react?

I'm trying to use one of mine EasyAR Key, but when I build to the react gives me that the key is incorrect with the bundle.

I noticed that you deleted your key (no problem with that), but when I created one of mine, and put on the EasyARKey at unity works, but not on the React.

[Edit]
ok.... FINALLY I could made my project works!!!!

things that I learned and I think there is no place talking about it
you CAN'T have more than one project on the Unity folder (on the main folder)

the EasyAR Key works normal, it was something on my machine, restarted it, and start to work again.

now I'm having problem with playing video.

any tips? ;D

igrir commented

@rpassareti I haven't tried video player on EasyAR

@igrir the problem is not the EasyAR
on an apk exported from unity, works normal
but when exported to react, the video stay black and don't play

[EDIT]

on logcat is showing this:

08-12 15:36:02.104 28043 28137 W Unity   : AndroidVideoMedia::OpenExtractor could not translate sharedassets0.resource to local file. Make sure file exists, is on disk (not in memory) and not compressed.
08-12 15:36:02.104 28043 28137 W Unity   :
08-12 15:36:02.104 28043 28137 W Unity   : (Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 328)
08-12 15:36:02.104 28043 28137 W Unity   :
08-12 15:36:02.105 28043 28137 W Unity   : AndroidVideoMedia: Error opening extractor: -10004
08-12 15:36:02.105 28043 28137 W Unity   :
08-12 15:36:02.105 28043 28137 W Unity   : (Filename: ./PlatformDependent/AndroidPlayer/Modules/Video/Private/AndroidVideoMedia.cpp Line: 472)
igrir commented

Is the video embbeded on the apk? Are you sure the video is there? Maybe you can try to check the generated apk using android studio's APK Analyzer. It could be the video didn't added into the APK.

will check this, but i think the export doesn't include the video, any idea to do this?

what I did was putting the video on Streaming Asset and works on React build

but some kind of video, like with transparent, doesn't work without passing by a unity transcode, so we will change our video to work with a shader from EasyAR video example

thx for the help!

@rpassareti you could try out this package: https://assetstore.unity.com/packages/tools/video/avpro-video-56355

We are using it together with Vuforia to play AR videos and it works great on iOS and Android.

hey @igrir !
i'm having some trouble to build this app to iOS now
what did you do to build it?

on logcat is showing this:

any solution ?

on logcat is showing this:

any solution ?

you mean to play the video on react?

i put the video on streaming asset, and played from this folder, and used a shader for transparent video.

but i don't have a workaround for iOS

on logcat is showing this:

any solution ?

you mean to play the video on react?

i put the video on streaming asset, and played from this folder, and used a shader for transparent video.

but i don't have a workaround for iOS

How do you play the video from unity by android's assets folder path ?

on logcat is showing this:

any solution ?

you mean to play the video on react?
i put the video on streaming asset, and played from this folder, and used a shader for transparent video.
but i don't have a workaround for iOS

How do you play the video from unity by android's assets folder path ?

https://docs.unity3d.com/Manual/Video.html

set the VideoPlayer as URL, and follow on the end of the page, to set StreamingAsset video

Hi

Any solution on EasyAR showing "Invalid Key"?
It works when I make a Unity Build but shows "Invalid Key" when I run it with react-native-unity-view

@rpassareti here you go https://github.com/igrir/ReactEasyARSample

@ridhoRH clone this project, and use as base for you, this what I did to make it work

@ridhoRH I had this same Issue. I'm using a node module forked from this repository, that it is just a update to a new Unity Editor and React Native versions.

What helped me was to change the build.gradle file inside the UnityExport directory. In my case, I have a unity-classes.jar and EasyAR.jar file in the UnityExport \ libs directory. So in build.gradle I already had "implementation ': unity-classes'" and I just needed to add "implementation ': EasyAR'" to point to my EasyAR.jar file.

@jfilipedias thanks so much. I'm also using the updated one and that solution worked.