Expo Audio plays only one song and one time only!

we are trying to build an app with a player that will work perfectly.
it has a pause button and play.
I have now two problem with my player:

  1. It plays the sound file I send through the props only one time!
  2. it ignors other sound files I send it.
    I tried to solve it with the AV - Expo Documantation (initialStatuse, ect…) but didnt succeed with the codes gives there.

My code:

const playing = false;

render() {
  return (
      <Card wrapperStyle={{ width: 346, height: 180 }}>
        <View style={{ flexDirection: "row" }}>
          <Text style={styles.resultsContainer}>
            {this.state.song.Song_Name}{" "}
            source={{ uri: this.state.song.Image }}
        <View style={styles.buttonRow}>
            onPress={async () => {
              try {
                if (!playing) {
                  await playerObject.loadAsync({
                    uri: this.state.song.Song_File 
                await playerObject.playAsync();
              } catch (error) {}
          <View style={{ flex: 0.1 }}> </View>
            onPress={async () => {
              playing = true;
              try {
                  await playerObject.pauseAsync();
              } catch (error) {}

          {/* )} */}

Glad if you can help,

Use setTimeout out for updating state

It won’t work. each song has it one time,
And I if press the play button again (not after pausing it ) I want it to start all over again.

I’ve heard Expo Audio doesn’t work in the background, I use a WebView to play audios instead it.

<audio id="player"></audio>
// Add some listeners, use postMessage() to send to the app
function onLoad() {
  _player = document.getElementById('player');
  _player.addEventListener('timeupdate', _handleOnTimeUpdate);
  _player.addEventListener('canplaythrough', _handleOnCanPlayThrough);
  _player.addEventListener('ended', _handleOnEnded);
  _player.addEventListener('error', _handleOnError);

// Play a file
_player.src = 'blah blah blah';

@expertlate Does Expo Audio works in the background?

No it doesn’t work in the background but yes in silence mode, and I don’t know how to work with WebView to play audio files.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.