makis.k
makis.k

Reputation: 462

ArCore Augmented Images image not visible

I am implementing the new augmenting images recognition feature of the ArCore. The recognition of my database images is working fine and a video start playing when they get recognized. However i was wondering if there is any listener that is called when the image is not visible any more in the scene so that i can stop and hide the video of that image. Currently in my implementation the video stays to the same position in the scene where the image was recognized even if i remove the physical image.

Upvotes: 0

Views: 1147

Answers (2)

kewal kishan
kewal kishan

Reputation: 156

Check the current TrackingMethod for the AugmentedImage when the TrackingState is Tracking. When the image is in view of the camera the TrackingMethod is FULL_TRACKING ,else it will be in LAST_KNOWN_POSE. If you are using the sample augmentedImages example, it will be like this in AugmentedImageActvity.java -

 private void onUpdateFrame(FrameTime frameTime) 
 {
 .
   for (AugmentedImage augmentedImage : updatedAugmentedImages) 
   {
   .
     switch (augmentedImage.getTrackingState())
     {
     .
       case TRACKING: if(augmentedImage.getTrackingMethod()==AugmentedImage.TrackingMethod.FULL_TRACKING) {
                        //Enable VideoNode 
                      }
                      else{
                        //Disable VideoNode / Pause MediaPlayer /detach node
                      }
      }
    }
  }

Upvotes: 2

Ali Kanat
Ali Kanat

Reputation: 1889

You can use public TrackingState getTrackingState () if it returns public static final TrackingState STOPPED you can stop your video or destroy however you want. For more details you can refer here

Upvotes: 1

Related Questions