如何在网页上播放 mp3 但不允许下载该声音?

How to play an mp3 on a webpage but disallow that sound to be downloaded?

我有一个音乐界的客户,他出了一张新专辑。加载专辑唱片公司的给定页面后,我有些惊讶地发现从他们的网站下载声音非常容易,声音在以下源代码中运行,在 HTML5:

<div class="sqs-audio-embed" data-url="https://...fileserverURL...SD+Master+V2.mp3" data-mime-type="" data-title="title" data-author="author" data-show-download="false" data-design-style="legacy" data-duration-in-ms="761000" data-color-theme="light" id="yui_3_17_2_1_144058079_1116">
    <div id="yui_3_17_2_1_149458079_1120" class="yui3-widget sqs-widget sqs-audio-player play-state-stopped ready-state-initialized">
     <div id="yui_3_17_2_1_149058079_1122" class="sqs-audio-player-content">
                </div>
            </div>
</div>

它是基于另一个域的嵌入式 URL。

所以我的问题是....

如何在网站上播放声音但拒绝直接下载或直接link?

我的想法:

1) 我想,在 文件服务器 [=60= 上使用自定义 内容安全策略 ] 可以做到这一点,拒绝直接访问,除非访问来自唱片公司网站的域名(例如)。

2) .htaccess 请求 - 例如那些阻止图像直接访问的请求 - 是否也可以工作,如果是 played/called 则有一些例外通过某个域或网页?


总结:

I have looked at other questions on Stack Overflow but I didn't find any (any!) that related to practical workarounds for the above situation (allow play disallow direct access). The closest I found was this question from 2010 which seems to imply the above can't be done, but I am sure it can (now) be done if the two servers (filehost and website) are set to allow acces to a file if only via the website server acting as a gatekeeper, as in point 1, above.)


Yes, I'm also aware that committed people can copy the sound from the downloaded browser cache (from which the sound is actually played), but I'm not getting too obsessive over this, just, well, a little....

我建议查看 EME(加密媒体扩展)。

这里有教程https://www.html5rocks.com/en/tutorials/eme/basics/

CSP 不是为此而设计的,它是为相反的问题而设计的:网站的运营商想要防止从不同的服务器加载内容(你是不同服务器的运营商,你想保留大多数网站从加载您的内容)。

如您所述,您的第二个想法应该可以解决问题。深度链接预防不关心它是 MP3 还是 JPEG。它必须在托管 mp3 的站点上。从浏览器中提取它或伪造来源仍然微不足道。

虽然我这么说很痛苦,但您可能应该寻找 Encrypted Media Extensions 更完整(如果更难实施)的解决方案。