AR Kit image detection problem on App relaunch

Hi code Crew,

I’m seeking help with debugging my AR app I’m stuck for 3 months now :confused:

App: it allows a user to upload an image, upload a video and when the camera detects the uploaded image in the real world, it plays the video over the physical image. Almost like in Harry Potter :wink:

Problem: On a launch, everything works fine. When I kill and relaunch the app, the camera detects black squares and videos are not playing. But if I upload a new video, then everything is working again. Here in action:
https://drive.google.com/file/d/1825VMLrjdH8DNKxhI5v9IRLVkbZpNYhn/view?usp=sharing

I use AR Kit on Xcode and Realm for persisting the data.
Source code here: https://drive.google.com/drive/folders/1s4ZaNF8QLyoTurMpSnz2tQr53agRk0Z3?usp=sharing

I’ll be thankful for eternity if someone can help