An issue with AVSpeechSynthesizer, Any workarounds?

后端 未结 5 739
广开言路
广开言路 2020-12-30 11:38

I am using AVSpeechSynthesizer to play text. I have an array of utterances to play.

    NSMutableArray *utterances = [[NSMutableArray alloc] init];
    for          


        
5条回答
  •  既然无缘
    2020-12-30 12:28

    All answers here failed, and what I came up with is stopping the synthesizer and then re-instantiate it:

    - (void)stopSpeech
    {
        if([_speechSynthesizer isSpeaking]) {
            [_speechSynthesizer stopSpeakingAtBoundary:AVSpeechBoundaryImmediate];
            _speechSynthesizer = [AVSpeechSynthesizer new];
            _speechSynthesizer.delegate = self;
        }
    }
    

提交回复
热议问题