Calling playReplay from cpp is not working, whereas from widget it works fine

I am recording my game while playing using demo player. And I am able to play the replay from a widget. When the same recorded file is called from cpp code, it is not working. In the former case, tick functions of my own custom game state and player controller are called, but in the later, tick functions are not triggering. Player camera is coming somewhere else and I cannot move my spectator camera. And when I try to close it, I am getting GEngine->findnameddriver() ===demo net driver error. Please help me with this problem.

Solved. Problem was, I was calling the Recorded file from an IO thread (invoked from another application). I changed the calling from that thread to another ( from the tick of another actor ). it worked.