FairPlay流:在AVPlayerItemVideoOutput上调用copyPixelBufferForItemTime返回NULL [英] FairPlay Streaming: Calling copyPixelBufferForItemTime on AVPlayerItemVideoOutput returns NULL
问题描述
有没有人曾在Fairplay上使用HLS并成功检索了像素缓冲区?
Has anybody had experience using HLS with Fairplay and succeeded in retrieving the pixel buffer?
我正在使用具有resourceLoader
委托集的AVURLAsset
.我的AVAssetResourceLoaderDelegate
负责处理Fairplay流程.
I'm using an AVURLAsset
with its resourceLoader
delegate set. My AVAssetResourceLoaderDelegate
takes care of dealing with the Fairplay process.
它在AVPlayerLayer
上显示正常,但是,当我尝试使用连接到AVPlayerItem
的AVPlayerItemVideoOutput
并在其上使用copyPixelBufferForItemTime
时,返回的pixelBuffer始终为NULL.
It displays fine on an AVPlayerLayer
, however, when I try to use an AVPlayerItemVideoOutput
that is attached to the AVPlayerItem
and use copyPixelBufferForItemTime
on it, the pixelBuffer returned is always NULL.
另一方面,当我使用非加密流而不使用resourceLoader时,copyPixelBufferForItemTime返回预期的像素缓冲区.
On the other hand, when I use a non-encrypted stream and not use the resourceLoader copyPixelBufferForItemTime returns a pixelbuffer as expected.
这是按预期进行的吗? (即使用FairPlay保护的视频流不会公开其像素缓冲区以防止误用.)
Is this by working as intended? (i.e. Streams that are protected using FairPlay don't expose their pixel buffer to prevent misuse.)
如果没有,是否有任何方法可以从iOS上使用FairPlay保护的流中获取像素缓冲区?
And if not, is there any way to get the pixel buffer from a stream that is protected using FairPlay on iOS?
推荐答案
在进一步研究了这个问题之后,我得出的结论是,Apple设计了AVPlayer的方式是,一旦使用FairPlay保护的HLS,它就是唯一的退出点(请参阅A :),对于已解密的数据copyPixelBufferForItemTime
始终返回nil.
After researching into this issue further, I have come to the conclusion that Apple engineered their AVPlayer in such a way that once you use FairPlay protected HLS the only exit point (see A:) for the decrypted data copyPixelBufferForItemTime
always returns nil.
- 我已经测试了没有加密的完全相同的流,并且
copyPixelBufferForItemTime
按预期返回了对像素缓冲区的引用. - 我已经在AVPlayerLayer上用 加密测试了完全相同的流,并且该视频显示了例外.
- I have tested the exact same stream without encryption and
copyPixelBufferForItemTime
returns a reference to the pixel buffer as expected. - I have tested the exact same stream with encryption on an AVPlayerLayer and it displays the video as excepted.
看来,一旦您使用FairPlay,显示受保护的视频内容的唯一方法就是使用AVPlayerLayer
.到目前为止,似乎还没有办法从Apple的API中检索受FairPlay保护的HLS媒体,以便将其显示在3D空间中的OpenGL纹理上.
It appears that once you use FairPlay, the only way to display your protected video content is by using an AVPlayerLayer
. There appears to be no way as of today to retrieve FairPlay protected HLS media from Apple's APIs in order to display it on an OpenGL texture in 3D space for example.
A:copyPixelBufferForItemTime
是唯一的退出点,因为在AVPlayerLayer上调用renderInContext
无效
A: copyPixelBufferForItemTime
being the only exit point since calling renderInContext
on an AVPlayerLayer doesn't work
这篇关于FairPlay流:在AVPlayerItemVideoOutput上调用copyPixelBufferForItemTime返回NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!