ios avplayer trigger streaming is out of buffer

后端 未结 4 1391
甜味超标
甜味超标 2020-12-07 14:47

I want to reconnect to the server when the streaming buffer is empty.

How can I trigger a method when the AVPlayer or AVPlayerItem buffer i

4条回答
  •  爱一瞬间的悲伤
    2020-12-07 15:38

    You will need to drop down into Core Audio and CFReadStream to do this. WIth CFReadStream, you can provide a callback that gets called on certain stream events like end encountered, read error, etc. From there you can trigger a reconnect to the server. If you're consuming an HTTP stream, you can add the range header to the HTTP request so you can tell the server to send the stream from a point you specify (which would be the last byte you received before + 1).

提交回复
热议问题