安卓uts插件报错:Error: method not found:[uts.sdk.modules.utsMicrosoftTts.IndexKt-msttsSpeakByJs]
speakFile(lang : string, text : string, callBack : (result : string) => void) : SpeechSynthesizer {
let musicDir = UTSAndroid.getAppContext()!.getExternalFilesDir(null)
let wavFile : File = new File(musicDir, `${sort}.wav`)
let filesDirPath : string = wavFile.getAbsolutePath()
console.log('---保存地址---', filesDirPath)
this.speechConfig.setSpeechSynthesisVoiceName(lang)
let audioConfig : AudioConfig = AudioConfig.fromWavFileOutput(filesDirPath)
let synthesizer : SpeechSynthesizer = new SpeechSynthesizer(this.speechConfig, audioConfig)
synthesizer.SynthesisCompleted.addEventListener((s, e) => {
// let obj : UTSJSONObject = {
// 'filePath': filesDirPath,
// 'sort': `${sort}`
// }
// callBack(filesDirPath)
sort = sort + 1
console.log('----合成结束---')
})
synthesizer.SpeakTextAsync(text)
return synthesizer
}
使用这个方法就会报这个错误
阿乐呀 (作者)
感谢回复,我把代码删了重新写一遍就好了
2025-05-23 15:52