I know that this is a frequently asked question which does not have a trivial solution.
Found a demo which does the same - http://blog.denivip.ru/index.php/2017/01/live-streaming-on-ios/?lang=en, but it does not use AVAssetWriter.
People have also suggested using the bento4 library but I want to be able to do it programmatically without creating a new process, and without the latency of having to create a new file, and using AVAssetWriter.
If not possible, why does IOS not have in-built support to create those files using AVAssetWriter using samples?
Is RTSP the only option that Apple recommends for Live Streaming?