Start a new topic

How to listen for video player exit

Hi there, I am trying to mitigate an issue where at times even though an image is recognized by the AR.cloudRecognitionService, it is then not found in the scene by the AR.imageTrackable (i.e. it never enters the onImageRecognized state) and thus nothing in the cam is visible to the user. We had two ideas to mitigate this:

- Snap the video and other drawables to the screen so they're still visible even though they can't be seen in augmented reality view. The problem with this is that the snapToScreen method does not work at this point since the AR.imageTrackable has never (and likely will never in a reasonable amount of time) enter the onImageRecognized state.


- Open the video in the native player using the AR.context.startVideoPlayer method. The issue we're running into with this is there's no way (that we know of yet) to listen for when the user finishes/exits the native player so we can start continuous recognition again.

Can you make a suggestion of how to mitigate this issue? Is there a way to show the video / other drawables whenever the AR.imageTrackable won't enter the onImageRecognized state? Or is there some way to listen for video player events so we can start the recognition cycle again after the user is done? Or do you have some other suggestion.


1 Comment

Hi Matthew,

From what I understand, you're basically just interested in whether or not the video is visible in the cam - w/o the need of augmenting the target as such.

Poor targets might in fact be recognised on the server side but not on the client side (the server sends over the most promising information for client side recognition and tracking).

Assuming that this phenomenon only occurs on specific (but important) targets, you should not go with your option 1) "Snap the video and....") but instead choose from

2) "Open the video in the native player using the AR.context.startVideoPlayer method..." but intercept the onResume event in your native environment to then call architectView.callJavaScript to notify your JS environment about the returning from the video player. Note that you may also call a custom action in your native environment by triggering "AR.platform.sendJSONObject" in your JS environment (compare native POI detail page sample)

3) You may also embed a video player in your html so that a user can watch it while the cam is still active and visible. This option may drain battery and is therefore only recommended if you're using short video-clips. You can pause/resume the cloud-recognition when user plays/exits the video-player in your div.

I hope this helps.

Best regards,

Login or Signup to post a comment