Nature finds a way. If it breaks, it fixes itself. Maybe not always, but often and certainly in this case.
As per the description of the YouTube video, the friend of the video recorder was trapping the spider to take it outside and accidently crushed its leg under the glass. It was then that the spider got to work fashioning a cast.
To create the cast, the spider uses its two pedipalps, appendages on the front of its body similar to hands. It feeds silk from the spinneret glands located near its abdomen and ravels it around the busted leg.
Spiders make all sorts of things with their webs, including slingshots and protective walls. To them, building a cast is no big thing. To us; it's sort of magical.