Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

录音过短时没有readyStopRecord #45

Open
Beyond-Chao opened this issue Jul 25, 2018 · 3 comments
Open

录音过短时没有readyStopRecord #45

Beyond-Chao opened this issue Jul 25, 2018 · 3 comments

Comments

@Beyond-Chao
Copy link

录音过短时没有stop recorder, 录音一直在录制,当超过60s时会回调stopRecord
if self.audioTimeInterval.int32Value > 60 { self.stopRecord() }
导致还会录音成功。

虽然在stopRecord里面调用了 self.operationQueue.cancelAllOperations() 如果录音时长小于0.5s时,但是子线程的while循环一直在跑,因为recorder.isRecording 是true
cancelAllOperations() 的文档是这样描述:
For operations that are already executing, the operation object itself must check for cancellation and stop what it is doing so that it can move to the finished state.

@hilen
Copy link
Owner

hilen commented Jul 26, 2018

后续我会统一跟踪下类似的问题

@Beyond-Chao
Copy link
Author

期待

@Beyond-Chao
Copy link
Author

还有个优化点:请求权限的方法 open func requestRecordPermission(_ response: @escaping AVFoundation.PermissionBlock) 这个block可能在异步线程调用, Note that the block may be called in a different thread context. 所以UI操作最好用dispatch_async_safely_to_main_queue() 包一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants