Using Multiple DeepAR instances does not seem to work

This is on iOS sdk version 5.4.1.

My app is using DeepAR and rendering in off-screen mode, using use processFrame for each frame. Things are working however we are implementing the ability to change cameras, and in doing so, we are creating a new instance of DeepAR. However it only works on the first instance. I have tried without changing cameras, simply creating a new DeepAR instance.

Any ideas here? Do we need to do cleanup of the previous instance? I’ve tried shutdown but that seems to crash. Same with pause.

Thanks!

You do need to do a full cleanup with shutdown yes, seeing as you’re feeding the frames yourself you will likely need to do a manual check that the shutdown is not in process before calling process frame

Thanks for the response!

It seems to be working for me now by doing the following during clean-up:

deepAR.delegate = nil
deepAR.initialize()
deepAR.shutdown()

The initialize() call seems necessary to avoid a crash, I guess because I am using offscreen rendering.

How can I check this?

We have a did shutdown callback, you would need your own flag that would be true after you call shutdown and before the callback is called

Ah I see, in the DeepARDelegate! Thanks!

1 Like