Flasher light is used to let the upcoming train LP know that, his train need attention and has been stopped due to emergency. Even the horn during such emergency brake follows a pattern. This is to alert railway staff(especially gangman) that, train has been stopped because of emergency and need attention.
In this video, if you see, railway staff had shown red flag. He might have seen flasher light, and then saw the sparks coming out.