react-native-unity-view icon indicating copy to clipboard operation
react-native-unity-view copied to clipboard

Easy AR implementation

Open rpassareti opened this issue 5 years ago • 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

rpassareti avatar Jul 11 '19 17:07 rpassareti

@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 avatar Aug 07 '19 08:08 igrir

@igrir can you share your code and project plz?

rpassareti avatar Aug 07 '19 15:08 rpassareti

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

igrir avatar Aug 08 '19 04:08 igrir

@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

rpassareti avatar Aug 09 '19 17:08 rpassareti

@rpassareti I haven't tried video player on EasyAR

igrir avatar Aug 11 '19 01:08 igrir

@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)

rpassareti avatar Aug 12 '19 17:08 rpassareti

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.

igrir avatar Aug 14 '19 04:08 igrir

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 avatar Aug 14 '19 15:08 rpassareti

@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.

JanOwiesniak avatar Sep 25 '19 15:09 JanOwiesniak

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

rpassareti avatar Nov 13 '19 20:11 rpassareti

on logcat is showing this:

any solution ?

qu4sar avatar Apr 29 '20 13:04 qu4sar

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

rpassareti avatar Apr 29 '20 14:04 rpassareti

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 ?

qu4sar avatar May 04 '20 08:05 qu4sar

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

rpassareti avatar May 05 '20 23:05 rpassareti

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

ridhoRH avatar May 27 '20 13:05 ridhoRH

@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

rpassareti avatar May 27 '20 14:05 rpassareti

@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 avatar May 27 '20 20:05 jfilipedias

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

ridhoRH avatar May 28 '20 07:05 ridhoRH