Audio will be silently on playAsync() immediately after stopAsync()
See original GitHub issueEnvironment
in iOS target.
Environment: OS: macOS Sierra 10.12.6 Node: 8.2.1 Yarn: 0.27.5 npm: 5.3.0 Watchman: 4.7.0 Xcode: Xcode 9.2 Build version 9C40b Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) expo: ^25.0.0 => 25.0.0 react: 16.2.0 => 16.2.0 react-native: https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz => 0.52.0
Steps to Reproduce
- Audio.setAudioModeAsync() on componentDidMount()
Audio.setAudioModeAsync({
allowsRecordingIOS: false,
interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
playsInSilentModeIOS: true,
shouldDuckAndroid: true,
interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
});
- Press play button
- if not loaded audio, load from uri
playbackObject.loadAsync({uri:xxx})
- play audio
playbackObject.playAsync()
- One more press the play button
- stop audio
playbackObject.stopAsync()
- play audio
playbackObject.playAsync()
Expected Behavior
Sound also appears in silent mode
Actual Behavior
It is silently.
But, below is ok.
- Audio.setAudioModeAsync() on componentDidMount()
- Press play button
- Press stop button
- Press play button
or
- Audio.setAudioModeAsync() on componentDidMount()
- Press play button1
- Press play button2
Reproducible Demo
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
AV - Expo Documentation
A boolean describing if the media just played to completion at the time that this status was received. When the media plays to...
Read more >expo - could not stop the previous audio when playing another ...
useRef(new Audio.Sound());. Audio stop function. const stop = async () => { await sound.current.stopAsync(); await sound.current.
Read more >react-native-audio-fexoplayer - npm
React Native module for playing sound clips on Android using Google ExoPlayer. Latest version: 1.0.1, last published: 4 years ago.
Read more >How To Create An Audio/Video Recording App With React ...
After reading this article, you should have all the necessary knowledge to create video/audio recording functionality with React Native.
Read more >npm - Snyk
To help you get started, we've selected a few expo-av.Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS examples ... _applyMode = async () => { try { await Audio.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thank you for trying all that!
From what you wrote I suspect the problem occurs due to resetting of the Audio Mode. Working on a fix for that!
Hi @terribleben ,I try
setPositionAsync(0)
beforeplayAsync
, sounds appear! Thanks!But
stopAsync()
should be equivalent tosetStatusAsync({ shouldPlay: false, positionMillis: 0 })
, why needssetPositionAsync(0)
?