How to save videos offline using a link with encryption

I am looking for a functionality to save videos offline. So that user can download videos and watch offline when have no access to internet. I am not able to get how to save .exo format like youtube so that it will protected and then it can be accessible with my app only. Let me know anybody worked on it.