There believe is no built-in functionality for this in the engine. So lets look at the approaches and alternatives arranged by difficulty from easiest to hardest:
A. Use third party broadcast software. Steam, OBS, Shadowplay, etc…
B. Implement spectator in your game. Downside of this is that only those who has game installed can spectate.
C. Integrate OBS right in your game. It’s an open source software with license that allows such usage. But thats relatively hard.
Offtopic: you may want to visit UE4’s replay system Using the Replay System in Unreal Engine | Unreal Engine 5.1 Documentation