We have an article that outlines and walks you through setting this function up. By creating a server-side stream, you can loop another video as a filler video in place of a live stream that isn't available. For this to work, you must create a server-side stream that has the video that will be used in place of the live stream. The ModuleLoopUntilLive module is then used to detect when the live stream is available and it will switch from the filler video to the live stream. When the live stream ends, it will switch back to the filler video.
This article describes how to configure the module.