作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在使用以下代码在我的 iOS 应用程序中拍照:
self.stillImageOutput.captureStillImageAsynchronously(from: videoConnection) {
// Do some stuff here
self.captureSession.stopRunning()
// Do some more stuff
}
出于某种原因,在捕获 block 中调用 stopRunning()
会使快门声音断断续续。如果我将其移除,则快门声音非常好。我怎样才能防止这种情况发生?
最佳答案
您不想异步访问 UI。根据您的描述,听起来异步 block 可能是口吃的来源。为了让主队列播放您的声音,您可以尝试两种方法:
// everything is going swimmingly until you play the sound...
// grab the main queue
DispatchQueue.main.async {
// play your sound
}
// and live happily ever after
另一种方法:
// everything is going swimmingly until you play the sound...
// grab the main queue
DispatchQueue.main.suspend()
// play your sound
DispatchQueue.main.resume()
// and live happily ever after
关于ios - 断断续续的快门声,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40086943/
我正在使用 Shutter,我非常喜欢它。我将它安装在我的新笔记本电脑上,但无法正常工作。当我打开快门并尝试截取屏幕截图时,它显示错误消息“打开/home/username/Pictures 时出错”
我是一名优秀的程序员,十分优秀!