Audio Pause issue


i have read the docs about playing sounds and audio and it work good
but i want to be able to play/pause the sound like toggle click
when first click performed the sound should be played
when click another one it could pause
and so on

here is my code for doing this but its work just for play

   playSound = async () => {
        const source = {
            uri: ';stream.mp3'
          const sound = new Audio.Sound();
          await Audio.setIsEnabledAsync(true);
          await sound.loadAsync(source);
        if (this.state.playing === true) {
            try {
                await sound.pauseAsync();
                this.setState({ playing: false });
              } catch (error) {
        } else {
            try {
                await sound.playAsync(); 
                this.setState({ playing: true });
              } catch (error) {


which sdk version are you using? (see in app.json)

cc @sjchmiela


“sdkVersion”: “23.0.0”


please update to sdk25 to see if it resolves your issue

closed #5

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