expo: Expo-speech not working on iOS devices with Silent Mode on
đ Bug Report
Iâm using expo-speech in my project but the text is not read out in some iOS devices. From getting my friends to test it the results I have are:
Does Work: iPhone X. 13.3.1 iPhone 10. iPhone X. 13.3.1 iPhone 8 Plus. 13.3.1 iPhone 7+. 13.1.2
Is not working: iPhone Xs. 13.3.1 iPhone 8. 13.4.1 - This is my testing phone so I know that the sound works fine on YouTube.
It also works fine in every iOS simulator that Ive tried when developing locally.
Ive created a very simple repo (link below) to test it out with this code:
import React from 'react';
import * as Speech from "expo-speech";
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
setInterval(()=>{
Speech.speak(`I am a test`);
}, 2000);
return (
<View style={styles.container}>
<Text>Open up App.tsx to start working on your app!</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
Using the Expo app to test it on an iPhone 8 13.4.1 itâs also not working.
Environment
Expo CLI 3.20.3 environment info: System: OS: macOS 10.15.4 Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.2.0 - ~/.nvm/versions/node/v12.2.0/bin/node Yarn: 1.13.0 - /usr/local/bin/yarn npm: 6.14.4 - ~/.nvm/versions/node/v12.2.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman IDEs: Android Studio: 3.6 AI-192.7142.36.36.6392135 Xcode: 11.4.1/11E503a - /usr/bin/xcodebuild npmPackages: expo: ~37.0.3 => 37.0.9 react: ~16.9.0 => 16.9.0 react-dom: ~16.9.0 => 16.9.0 react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 react-native-web: ~0.11.7 => 0.11.7 npmGlobalPackages: expo-cli: 3.20.3
This is a bug on iOS. Ive not tested extensively on Android yet so Iâm not sure if this is just an iOS issue.
Steps to Reproduce
Run my repo or snack on some iOS devices.
Expected Behavior
It should be read out âI am a testâ
Actual Behavior
On some devices nothing is read out.
Reproducible Demo
https://github.com/jameschetwood/expo-sound-test
https://snack.expo.io/@jamesweblondon/sound-test
Here is my live app: https://apps.apple.com/us/app/love-hiit/id1511764271?ls=1
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 3
- Comments: 24 (10 by maintainers)
@brentvatne
Audio.setAudioModeAsync({ playsInSilentModeIOS: true })we have to use this but we also have to play empty sound (Hack) to make it work otherwise it will not work in silent mode. you can see my full answer here: https://stackoverflow.com/a/62331403/8079868Still is an issue and not updated.
@nikki93 hey, I built an app that mainly using
expo-speech. From my perspective I would prefer it be an option ofSpeech.speak()and would expect the defaultplaysInSilentModeIOSvaluefalse, just to make sure developer is in control of making the speech work on silent mode.for now workout suggested by @nomi9995 works fine.
to clarify - this means the switch on the side of your phone is in the position such that it will say âSilent mode: offâ when itâs toggled to that position
i am able to repro this same thing if i have âSilent mode: onâ but it works with âSilent mode: offâ
Commenting since this is still currently an issue. We ran into this with our production users. Youtube and the vast majority of apps still play their sound when iOS is on silent mode so we thought we had a bug. Our users expected silencing their phone to mute notifications but not in-app sounds when theyâre actively using the application.
@jameschetwood turn off silent in iOS works. Please change the title of this issue; âExpo-speech not working on iOS devices with Silent Mode onâ
@brentvatne is there any way for me to implement a work around for even monkey patch this as a short term fix?
I tried this but no joy:
Working for me! Iâll message my friends who it didnât work for and get them to confirm.
I agree that ideally it should still play when iOS silent mode is on as this did seem to confuse a number of people.
I think what we need to do here is ensure that audio mode configured by expo-av is used by expo-speech, such that
Audio.setAudioModeAsync({ playsInSilentModeIOS: true })will result in theSpeech.speakbeing audible when ios silent mode is enabled@jameschetwood - is your ringer muted?
Im not sure exactly when it works and doest, but my actual app is live and a lot of people are reporting that itâs not working. So Im confident this is a real issue.