I have a jsp servlet application which allows users to listen meida files(audio video). I have 2 solutions. 1 st solution-. upload media files to youtube and keep the url in my database. when a user needs an audio file, link to the youtube and play. 2nd solution is that host in a commercial hosting server. My application is not for profit (no ads, no any hidden business purpose). It is for all people's benefit. On the other hand, I have problems with these solutions. If I upload them to youtube, someone can use media files for commercials or vulnerable activities or edit them and do none ethical things to them. If I go to a hosting server (purchase a commercial vps and host..) the disk space is a problem and money is also problem for me to continue. I expect a best solution from you all experts and your reviews will be highly appreciated.
As soon as you load your content onto the web, (then with the limited exception of DRM technologies) then anyone can simply download your files locally.
This fact is true of any content that is hosted with a paid-for-by-you service, or with a free-to-use-but-ad-revenue service like youtube. So the key thing is, that if you absolutely want to protect your files 100%, then don't put them on the pubic internet.
However... generally, to get started you might as well co-host your media content with your same service provider as your jsp servlet application host, as most commercial shared java servlet hosting companies provide 20GB disk space for only a few USD per month.
If you have particular technical requirements, then you could add them as comments, or update your question with further details.
(its worth mentioning that for any non-revenue generating content that you want to put on the web, that if you host it yourself then the more traffic you get the more the cost to you, however for services like you-tube, the more traffic your video gets, the more ads that youtube can display, hence they may even pay you some money.)