美文网首页
iOS 16语音播放问题 AVSpeechSynthesizer

iOS 16语音播放问题 AVSpeechSynthesizer

作者: 罐罐金 | 来源:发表于2023-04-26 11:41 被阅读0次

之前用OC一直不能播放声音,改为用swift就可以播放声音啦

   let utterance =AVSpeechUtterance(string: text)

   utterance.voice = AVSpeechSynthesisVoice(language: AVSpeechSynthesisVoice.currentLanguageCode())

   utterance.rate=0.5

  utterance.volume=0.8

   utterance.pitchMultiplier=0.1

  self.synthesizer.speak(utterance)

相关文章

网友评论

      本文标题:iOS 16语音播放问题 AVSpeechSynthesizer

      本文链接:https://www.haomeiwen.com/subject/hhjvjdtx.html