如何在浏览器之外播放 Widevine 加密的内容?

huangapple go评论42阅读模式
英文:

How can I play Widevine-encrypted content out of the browser?

问题

我正在尝试在浏览器之外播放 Widevine 加密的内容。我尝试使用随 Chrome 一起提供的内容解密模块(Content Decryption Module),该模块导出了这个 API。经过多次试验和研究,我成功初始化了 CDM 并从内容服务器获取了 Widevine 许可证。问题是,我不太确定如何调用 API 进行播放。我有一些包含加密样本的 DASH 段,我能够从盒子中解析出样本信息(样本数量、样本大小、样本 IV 和样本数据)。我以为我可以通过 ContentDecryptionModule_10::Decrypt() 解密音频;该调用返回 kSuccess,但给我返回了全是零的解密缓冲区。我接下来尝试使用 CDM 音频解码器通过 InitializeAudioDecoder(),但总是返回 kInitializationError。所以我不太确定我哪里出错了。我意识到我忽略了很多细节,但如果有人熟悉其中任何部分,我可以提供更多数据和代码。

英文:

I'm trying to playback Widevine-encrypted content outside of the browser. I'm trying to use the Content Decryption Module that ships with Chrome, which exports this API. After a lot of trial-and-error and research, I'm able to successfully initialize the CDM and obtain a Widevine license from the content server. The problem is that I'm not quite sure how the API is to be invoked for playback. I've got some DASH segments with encrypted samples, and I'm able to parse the sample information out of the boxes (number of samples, size of samples, sample IVs, and sample data). I thought I could decrypt audio via ContentDecryptionModule_10::Decrypt(); the call returns kSuccess but gives me decrypted buffers full of zeros. My next attempt was to try to use the CDM audio decoder via InitializeAudioDecoder() but that always returns kInitializationError. So I'm not quite sure where I'm going wrong. I realize I'm glossing over a lot of detail, but if anyone is familiar with any of this I can provide more data and code.

答案1

得分: 1

在非常高的层面上,不深入讨论代码等细节,如果您能够使用CDM解密内容并收到未加密的内容,以便您或您的应用程序可以查看它,那么这将是内容保护系统中的一个漏洞或错误,因为它不应该允许这种情况发生。

这并不意味着不可能实现,只是这不是本意,您不能依赖于这个漏洞或错误不会随着时间的推移而被修复。

CDM通常旨在要么安全地解密并播放内容本身,要么将其传递回一个安全的媒体路径,该路径可以在应用程序甚至操作系统无法查看解密媒体的情况下播放它。

这在EME规范中的下面图表中有所显示 - 内容或帧永远不会返回到应用程序本身(https://www.w3.org/TR/encrypted-media/):

如何在浏览器之外播放 Widevine 加密的内容?

然而,在您的情况下,我认为您只想播放内容,而不是尝试查看或访问解密后的内容。如果是这样,跨平台的Electron框架有一个支持基于CDM的应用程序播放的分支。这可能满足您的需求,尽管它仍然使用Chromium和Web技术。即使它不满足您的需求,它也可能为您提供有关Castlabs的团队是如何实现这一点的有用见解。

英文:

At a very high level, without going into detail of the code etc, if you were able to use the CDM to decrypt the content and receive back unencrypted content that you or your app could view, then this would be a loophole or an error in the content protection system as it should not allow this.

This does not mean it is not possible, just that it's not the intent and you could not rely on the loophole or error not being fixed over time.

The CDM is usually intended to either decrypt and play the content securely itself, or to pass it back to a secure media path that will play it back without the app or even the OS being able to see the decrypted media.

This is sort of shown in the diagram below in the EME spec - the content, or frames, never get back to the app itself (https://www.w3.org/TR/encrypted-media/):

如何在浏览器之外播放 Widevine 加密的内容?

However, in your case, I think you just want to play back the content and you are not trying to actually view or access the decrypted content. If so, the cross platform Electron framework has a fork which supports CDM based playback for apps. This may meet your needs, although it is still using chromium and web technologies. Even if it does not it may give you useful insight into how the guys at Castlabs, the ones who created the fork, achieved this.

huangapple
  • 本文由 发表于 2023年7月14日 00:39:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/76681621.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定