expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
33.42k stars 5.34k forks source link

[expo speech] Expo speech 11.5.0 no longer works in iOS17 #24804

Closed freshlybakedcode closed 1 year ago

freshlybakedcode commented 1 year ago

Summary

No speech is generated in iOS17 simulator.

The onStart() is triggered, but no speech is output and onDone() is not triggered.

The same app works correctly using earlier versions of iOS. I do not have a physical device running iOS17 so I can't confirm if this is limited to the simulator or not.

What platform(s) does this occur on?

iOS

SDK Version

49.0.9

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.5.2 Shell: 5.9 - /bin/zsh Binaries: Node: 18.17.1 - ~/.asdf/installs/nodejs/18.17.1/bin/node npm: 9.6.7 - ~/.asdf/plugins/nodejs/shims/npm SDKs: iOS SDK: Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0 IDEs: Xcode: 15.0/15A240d - /usr/bin/xcodebuild npmPackages: expo: ~49.0.9 => 49.0.13 react: 18.2.0 => 18.2.0 react-native: 0.72.5 => 0.72.5 npmGlobalPackages: eas-cli: 5.4.0 Expo Workflow: managed

Minimal reproducible example

I'm basing this on the provided snack for expo-speech.

package.json:

...
"dependencies": {
    "expo": "~49.0.9",
    "expo-speech": "~11.5.0",
    "expo-status-bar": "~1.6.0",
    "react": "18.2.0",
    "react-native": "0.72.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
...

app.js:

import * as React from 'react';
import { View, StyleSheet, Button, Text } from 'react-native';
import * as Speech from 'expo-speech';

export default function App() {
  const [speaking, setSpeaking] = React.useState(false);

  const speak = () => {
    const thingToSay = '1';
    Speech.speak(thingToSay, {
      onStart: () => setSpeaking(true),
      onPause: () => setSpeaking(false),
      onResume: () => setSpeaking(true),
      onDone: () => setSpeaking(false),
    });
  };

  return (
    <View style={styles.container}>
      <Text>Speaking: {speaking ? 'true' : 'false'}</Text>
      <Button title="Press to hear some words" onPress={speak} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    backgroundColor: '#ecf0f1',
    padding: 8,
  },
});

Result is that it freezes here with no audio output: image

Running this app (npx expo start) on a simulator with iOS 15.5 works perfectly, it also works on my physical device running iOS 16.6.1

VadymBezsmertnyi commented 1 year ago

I also encountered this issue. Warnings in the terminal:


[TextToSpeech] Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4010
"(null)". Attempting to speak again with fallback identifier:
com.apple.voice.compact.en-US.Samantha
[TextToSpeech] Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain
Code=-3000 "(null)"
[TextToSpeech] Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain
Code=-3000 "(null)"
[TextToSpeech] Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain
Code=-3000 "(null)"
[TextToSpeech] Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain
Code=-3000 "(null)"
[TextToSpeech] Could not instantiate audio unit. Error=Error Domain=NSOSStatusErrorDomain
Code=-3000 "(null)"
[TextToSpeech] Couldn't find audio unit for request SSML Length: 36, Voice:
[AVSpeechSynthesisProviderVoice 0x6000022c08c0] Name: Samantha, Identifier:
com.apple.voice.compact.en-US.Samantha, Supported Languages (
"en-US"
), Age: 0, Gender: 0, Size: 0, Version: (null)
[TextToSpeech] VoiceProvider: Could not start synthesis for request SSML Length: 36, Voice:
[AVSpeechSynthesisProviderVoice 0x6000022c08c0] Name: Samantha, Identifier:
com.apple.voice.compact.en-US.Samantha, Supported Languages (
"en-US"
), Age: 0, Gender: 0, Size: 0, Version: (null), converted from tts request [TTSSpeechRequest
0x60000381cb40] Test system message 2 language: en-US footprint: compact rate: 0.500000 pitch:
1.000000 volume: 1.000000
[TextToSpeech] Failed to speak request with error: Error Domain=TTSErrorDomain Code=-4010
"(null)". Attempting to speak again with fallback identifier:
com.apple.voice.compact.en-US.Samantha

Also, in the console warnings:

Sending Exponent.speakingStarted with no listeners registered expo-speech

freshlybakedcode commented 1 year ago

Also, in the console warnings:

Sending Exponent.speakingStarted with no listeners registered expo-speech

I think that particular issue was actually resolved in version 11.5.0 of expo-speech. Oddly, I don't get any console warnings when I run the above app - does your code work on versions of iOS below 17?

alanjhughes commented 1 year ago

Hi @freshlybakedcode - This seems to be an issue only in the simulator. I've run on my device running iOS 17 and it works as normal.

freshlybakedcode commented 1 year ago

Hi @freshlybakedcode - This seems to be an issue only in the simulator. I've run on my device running iOS 17 and it works as normal.

Ah, thank you @alanjhughes - I'll just run on an earlier version of iOS in the simulator in that case, I wrongly assumed that there would be parity between the simulator and real hardware but I guess things are never that simple! Appreciate you looking into it. 👍

alanjhughes commented 1 year ago

No problem @freshlybakedcode 👍 In the early stages of new OS versions you might get some things like this. Hopefully, they'll be fixed when new versions of Xcode are released.

michaeljamieson10 commented 11 months ago

Does not work for me either, occurred when updating iOS simulators to 17. using version of expo speech 11.5