copyNextSampleBuffer后,应用程序返回从背景上的iPhone [英] copyNextSampleBuffer after application returns from background on iPhone

查看:714
本文介绍了copyNextSampleBuffer后,应用程序返回从背景上的iPhone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用读取视频文件:

CMSampleBufferRef sampleBuffer = [asset_reader_output copyNextSampleBuffer];

其中, asset_reader_output AVAssetReaderTrackOutput 类的一个实例。

这工作得很好,但如果应用程序转到后台,然后返回(例如,如果收到一个电话),然后返回到应用程序之后,copyNextSampleBuffer总是返回零。

this works well, but if the application goes to the background and then returns (for instance, if a phone call was received), then after returning to the application, copyNextSampleBuffer always return nil.

为什么它返回nil,而不是实际的数据?我该如何解决这个问题?

why is it returning nil and not the actual data? how can i solve this problem?

推荐答案

尝试跟踪当前样本缓冲区。然后,在你addDelegate类,你有回调方法applicationDidEnterBackground和applicationWillEnterForeground。只是设定在正确的地方目前森普尔缓冲标记调用copyNextSampleBuffer之前

try to track on current sample buffer. Then, in your addDelegate class, you have callback methods applicationDidEnterBackground and applicationWillEnterForeground. just set current semple buffer marker at right place before calling copyNextSampleBuffer

这篇关于copyNextSampleBuffer后,应用程序返回从背景上的iPhone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆