'Swift 5 stream video from url instead of waiting to download it completely

Currently I am using AVPlayer to display videos which works perfectly fine. But even though the videos are small (1-4mb) it takes some time to download them. Until then, the AVPlayer doesnt start at all. I would like to stream the videos and as soon as I can start the first seconds, I want to display it. Just like the other big platforms do. Waiting for a video to fully download is just bad practice but I haven't found a library or solution online yet (looked for similar issues but haven't found a really helpful guide yet as I am not that deep into coding yet :/)

Thanks in advance :::)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source