SDK 23 this.sound.setCallback

Just upgraded to newest expo sdk and

 this.sound.setCallback(status => {
          if (status.didJustFinish) this.sound.stopAsync()
        })

seems to break. Logging the this.sound I see there methods

Sound {
  "_errorCallback": [Function anonymous],
  "_internalStatusUpdateCallback": [Function anonymous],
  "_key": 0,
  "_loaded": true,
  "_loading": false,
  "_onPlaybackStatusUpdate": null,
  "getStatusAsync": [Function _callee],
}

what should I look to replace it with getStatusAsync ?

The API changed a few versions ago, the method you are referencing is no longer supported. :open_mouth:

[edit]: Use this instead: setOnPlaybackStatusUpdate

Thank you kindly will investigate this newer method. We pulled the (old) code from the docs (github example) on SDK 22

setCallback appears to be deprecated since v21 in the docs

2 Likes