expo: Audio setOnPlaybackStatusUpdate is not working on ios platform

Summary

Audio setOnPlaybackStatusUpdate is not being called on IOS.

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

42.0.4

Environment

Expo CLI 4.12.1 environment info: System: OS: Linux 5.11 Ubuntu 20.04.3 LTS (Focal Fossa) Shell: 5.8 - /usr/bin/zsh Binaries: Node: 14.18.1 - /usr/bin/node npm: 6.14.15 - /usr/bin/npm npmPackages: expo: ^42.0.4 => 42.0.4 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.12.1 Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

I’m building an application for both android & ios paltforms and I got problem with Expo Audio setOnPlaybackStatusUpdate.

I want to detect when the sound is finished by using this code below

const soundObject = new Audio.Sound();

await Audio.setAudioModeAsync({
  allowsRecordingIOS: false,
  playsInSilentModeIOS: true,
  interruptionModeIOS: Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX,
  shouldDuckAndroid: true,
  interruptionModeAndroid: Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX,
  playThroughEarpieceAndroid: false
});

await soundObject.playAsync()

soundObject.setOnPlaybackStatusUpdate(async (PlayStatus) => {
  if (PlayStatus.didJustFinish === true) {
    // sound has finished I want to do something here
    await soundObject.unloadAsync()
  }
})

The code above work perfectly fine on android plaform but on ios setOnPlaybackStatusUpdate never get called.

How can i fix this issue? I have been googling for almost 2 hours now but still can’t find the solution.

Thanks you

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (2 by maintainers)

Most upvoted comments

setOnPlaybackStatusUpdate it works but you have to disable remote debug