保护音频文件HTML5音频标签 [英] Protect audio files in HTML5 audio tags

查看:189
本文介绍了保护音频文件HTML5音频标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个网站,将有音乐播放使用HTML5标签在网站上,并想知道是否有什么办法来保护这些文件被下载?

我打电话,通过PHP的音乐文件,并在需要的时候选择了不支持MP3浏览器的OGG文件。

实际的文件无法进入公共但PHP文件可以下载和播放。

我在想,如果有什么我可以做这将阻止人们下载文件,但允许其通过标签上播放?

编辑:

我知道用户必须能够访问该URL为播放该文件。

我想知道如何当用户访问该文件,而不标签prevent下载。

我相信YouTube上做类似的事情与HTML5视频标签(可能是全部或YouTube视频,现在都可以免费下载)

编辑2:

我已经注意到,当一个文件是由用户下载的,它不会通过$ _SERVER阵列中的HTTP_CACHE_CONTROL变量

这将是能够prevent人通过返回一个空白文件,下载文件,如果他们直接下载呢?


解决方案

  

和想知道是否有任何方式来保护这些文件被下载?


不。该浏览器已下载文件,因此没有什么可以做,以保护它。你可以开始使用流媒体解决方案,这将使下载文件至少比较困难,但你不得不使用的专利技术如Flash。

I am making a site which will have music playing on the site using HTML5 tags and was wondering if there was any way to protect the files from being downloaded?

I am calling the music file through PHP and if needed it selects an OGG file for browsers that don't support MP3.

The actual files are inaccessible to the public but the PHP file can be downloaded and played.

I was wondering if there was anything I could do which would stop people downloading the file but allow it to be played through the tags?

EDIT:

I know that the user must be able to access the URL for the file to play.

I am wondering how to prevent download when the user accesses the file without the tag.

I believe YouTube do a similar thing with the HTML5 video tag (either that or all YouTube videos are now free to download)

EDIT 2:

I have noticed that when a file is downloaded by the user, it does not get passed a HTTP_CACHE_CONTROL variable in the $_SERVER array.

Would this be able to prevent people downloading the file by returning a blank file if they directly download it?

解决方案

and was wondering if there was any way to protect the files from being downloaded?

Nope. The browser has to download the file, hence there is nothing you can do to protect it. You could start using a streaming solution that would make downloading the file at least more difficult, but then you'd have to use proprietary technology like Flash.

这篇关于保护音频文件HTML5音频标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆