[英]Application microphone Access
Sometimes when the app is launched, it requests microphone access but I am not requesting it anywhere in the app.有时在启动应用程序时,它会请求麦克风访问权限,但我并没有在应用程序中的任何位置请求它。 I'm only using AVPlayer and AVNodeplayer to play the mp3 content.我仅使用AVPlayer和AVNodeplayer播放mp3内容。 Any idea why I'm being requested for mic access?知道为什么我被要求进行麦克风访问吗?
var playerNode = AVAudioPlayerNode()
var audioEngine = AVAudioEngine()
var audioEngine = AVAudioEngine()
let timeShift = AVAudioUnitTimePitch()
func setup() {
audioEngine.inputNode.reset()
if playerNode.engine == nil {
audioEngine.attach(playerNode)
audioEngine.attach(timeShift)
}
audioEngine.connect(playerNode, to: timeShift, format: nil)
audioEngine.connect(timeShift, to: audioEngine.mainMixerNode, format: nil)
audioEngine.prepare()
do {
try audioEngine.start()
} catch {
print("Could not start audio engine")
}
}
func seekToPostionSong(value: Float, audioFile: AVAudioFile, duration: Float) {
if audioEngine.isRunning != false{
do {
try audioEngine.start()
} catch let nsErr {
print(nsErr)
}
}
if let nodetime = playerNode.lastRenderTime{
let playerTime: AVAudioTime = playerNode.playerTime(forNodeTime: nodetime) ?? playerNode.lastRenderTime!
let sampleRate = playerNode.outputFormat(forBus: 0).sampleRate
let newsampletime = AVAudioFramePosition(Int(sampleRate * Double(value)))
let length = duration - value
let framestoplay = AVAudioFrameCount(Float(playerTime.sampleRate) * length)
if framestoplay > 1000 {
playerNode.scheduleSegment(audioFile, startingFrame: newsampletime, frameCount: framestoplay, at: nil,completionHandler: nil)
}
}
LocalPlayer_manager.shared.isPaused = true
playerNode.play()
}
Can someone please explain to me how to stop mic access?有人可以向我解释如何停止麦克风访问吗?
Sometimes when the app is launched, it requests microphone access but I am not requesting it anywhere in the app.有时在启动应用程序时,它会请求麦克风访问权限,但我并没有在应用程序中的任何位置请求它。 I'm only using AVPlayer and AVNodeplayer to play the mp3 content.我仅使用AVPlayer和AVNodeplayer播放mp3内容。 Any idea why I'm being requested for mic access?知道为什么我被要求进行麦克风访问吗?
var playerNode = AVAudioPlayerNode()
var audioEngine = AVAudioEngine()
var audioEngine = AVAudioEngine()
let timeShift = AVAudioUnitTimePitch()
func setup() {
audioEngine.inputNode.reset()
if playerNode.engine == nil {
audioEngine.attach(playerNode)
audioEngine.attach(timeShift)
}
audioEngine.connect(playerNode, to: timeShift, format: nil)
audioEngine.connect(timeShift, to: audioEngine.mainMixerNode, format: nil)
audioEngine.prepare()
do {
try audioEngine.start()
} catch {
print("Could not start audio engine")
}
}
func seekToPostionSong(value: Float, audioFile: AVAudioFile, duration: Float) {
if audioEngine.isRunning != false{
do {
try audioEngine.start()
} catch let nsErr {
print(nsErr)
}
}
if let nodetime = playerNode.lastRenderTime{
let playerTime: AVAudioTime = playerNode.playerTime(forNodeTime: nodetime) ?? playerNode.lastRenderTime!
let sampleRate = playerNode.outputFormat(forBus: 0).sampleRate
let newsampletime = AVAudioFramePosition(Int(sampleRate * Double(value)))
let length = duration - value
let framestoplay = AVAudioFrameCount(Float(playerTime.sampleRate) * length)
if framestoplay > 1000 {
playerNode.scheduleSegment(audioFile, startingFrame: newsampletime, frameCount: framestoplay, at: nil,completionHandler: nil)
}
}
LocalPlayer_manager.shared.isPaused = true
playerNode.play()
}
Can someone please explain to me how to stop mic access?有人可以向我解释如何停止麦克风访问吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.