expo: callback for setOnPlaybackStatusUpdate() doesn't fire as sound plays on iOS

Summary

Expected behavior: Callback passed to playbackObject.sound.setOnPlaybackStatusUpdate() is fired repeatedly as sound is played. This way, a UI can monitor the playback progress of sound, update components, etc.

Actual behavior: Callback fires once for play, and once for pause, but doesn’t fire while audio file is playing. Status updates are therefore not received and UI can’t update accordingly.

Works correctly on Android and web

What platform(s) does this occur on?

iOS

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 12.4 Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.17.0 - /usr/local/opt/node@16/bin/node npm: 8.15.0 - /usr/local/opt/node@16/bin/npm Watchman: 2022.09.05.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8609683 Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild npmPackages: expo: ~46.0.9 => 46.0.10 react: 18.0.0 => 18.0.0 react-native: 0.69.5 => 0.69.5 npmGlobalPackages: eas-cli: 0.60.0 expo-cli: 6.0.5 Expo Workflow: managed

Minimal reproducible example

https://github.com/OneHatRepo/TestAudio

npm run start

Press “Play” button

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 24 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Same issue for me, remote debugger on ios simulator causes the playback callback not to fire

This doesn’t work for me, whether I’m using remote debugging or not.

I have worked around this issue by simply implementing my own interval in my custom sound player class. I start it up whenever sounds play, and call clearInterval whenever the sounds stop.

startInterval = () => {
    this.interval = setInterval(async () => {
      const status = await this.sound.getStatusAsync();
      //  do your logic here with the status object
    }, 1000);
  };

I opened a duplicate (now closed) issue. I’d like to note a few things I learned

  1. Happens both on physical and simulator iOS
  2. Only happens with remote debugging turned on but did not happen when remote debugging was off

Here’s the link for my repro if that’s helpful at all https://github.com/b-steel/expo-av-repro