[iOS]AVPlayerItemVideoOutput.hasNewPixelBufferForItemTime doesn't work correctly

后端 未结 3 1818
轮回少年
轮回少年 2021-02-08 05:16

It\'s my first question here, so don\'t be severe.

I\'m playing video from the net using AVPlayer. I output the current frame using AVPlayerItemVideoOutput

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-08 06:06

    Make sure that AVPlayerItem.status equals AVPlayerItemStatusReadyToPlay before calling - (void)addOutput:(AVPlayerItemOutput *)output method on AVPlayerItem

    Reference:Renaud's reply on this page

    I got the same problem with my implementation. After trying the solutions proposed here, I think I finally found the relable way to do things

    The AVPlayerItemVideoOutput must be created AFTER the AVPlayerItem status is ready to play.

    So

    1. Create player & player item, dispatch queue and display link

    2. Register observer for AVPlayerItem status key

    3. On status AVPlayerStatusReadyToPlay, create AVPlayerItemVideoOutput and start display link

    Thanks to all for the inspiration

    Renaud

提交回复
热议问题