简体   繁体   English

如何在不暴露源文件位置的情况下播放mp3文件?

[英]How to play mp3 file without exposing source file location?

I want to play mp3 file (using HTML, JS, jQuery, PHP) but without the possibility that the visitor in the website will be able to get the address of the file and could therefore download it. 我想播放mp3文件(使用HTML,JS,jQuery,PHP),但是网站上的访问者无法获取文件地址并因此可以下载该文件。

What can I do? 我能做什么?

Thanks 谢谢

In short: You can't. 简而言之:你不能。 Somehow you have to submit the files URL and a user with some background knowledge will use extensions like Firebug to view all made HTTP requests. 您必须以某种方式提交文件URL,并且具有一些背景知识的用户将使用诸如Firebug之类的扩展名来查看所有发出的HTTP请求。

Thinking this further: As long as the user is able to listen to the sound file, it somehow has to be sent over the wire. 进一步思考:只要用户能够收听声音文件,就必须以某种方式通过有线发送声音文件。 And once it has arrived on the client side you have literally now control what the user does with it. 一旦它到达客户端,您就可以真正控制用户对它的操作了。

If you're only using those technologies, the link will probably always have to be visible, so this isn't really possible. 如果仅使用这些技术,则该链接可能总是必须可见,因此这实际上是不可能的。

Jplayer is one option you have that I can think of off the top of my head, if the user has a minimal knowledge about stuff like viewing source, he'll still be able to find the mp3 link, But It'll still keep the majority of people at bay though as they won't know where to look. Jplayer是您可以想到的一种选择,如果用户对诸如查看源代码之类的知识知之甚少,他仍然可以找到mp3链接,但仍然可以尽管大多数人不知道去哪里看,但他们在海湾。

If you REALLY want to keep it hidden from the user, you could even go as far as embedding the mp3 file in a flash application. 如果您真的想对用户隐藏它,甚至可以将mp3文件嵌入到Flash应用程序中。 This is particularly nasty though, but it would get you what sounds like your desired result. 虽然这特别令人讨厌,但它可以使您听起来像所需的结果。

You could store them in a Flash file or something else, or even stream them from an Icecast server, if you just want them to play back 如果您只想播放它们,则可以将它们存储在Flash文件或其他文件中,甚至可以从Icecast服务器中流式传输它们。

REFERENCE 参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM