Skip to content

Commit 89076d5

Browse files
authored
fix: stop replaying audio on expo when seeing to 0 (#3603)
## 🎯 Goal This PR removes a relatively archaic functionality we've had for voice recordings where seeking to 0 would begin audio replay. This is neither according to our new design system, nor does it make specific sense. In fact, it would break the state completely as `replayAsync` does not go through the `requestPlay` lifecycle of our `audio-player` pool, meaning we would not be getting any state updates (and have audio playing). Integrators anyway have access to the pool if they wish to control this themselves. ## 🛠 Implementation details <!-- Provide a description of the implementation --> ## 🎨 UI Changes <!-- Add relevant screenshots --> <details> <summary>iOS</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> <details> <summary>Android</summary> <table> <thead> <tr> <td>Before</td> <td>After</td> </tr> </thead> <tbody> <tr> <td> <!--<img src="" /> --> </td> <td> <!--<img src="" /> --> </td> </tr> </tbody> </table> </details> ## 🧪 Testing <!-- Explain how this change can be tested (or why it can't be tested) --> ## ☑️ Checklist - [ ] I have signed the [Stream CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) (required) - [ ] PR targets the `develop` branch - [ ] Documentation is updated - [ ] New code is tested in main example apps, including all possible scenarios - [ ] SampleApp iOS and Android - [ ] Expo iOS and Android
1 parent bc8eb82 commit 89076d5

2 files changed

Lines changed: 7 additions & 14 deletions

File tree

examples/ExpoMessaging/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6073,10 +6073,10 @@ stream-chat-react-native-core@8.1.0:
60736073
version "0.0.0"
60746074
uid ""
60756075

6076-
stream-chat@^9.42.1:
6077-
version "9.42.1"
6078-
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.42.1.tgz#8b6aa4e3e73a39ed07bb2a4f2a6829ba9354567a"
6079-
integrity sha512-o+9wQO4Ruu1A48T0IrX9ZH8+9F5xPgGLPvflaswaPeLyIZXcy8bsQdcT/HSrPmT7gs0WGD3qcbXaAJU5lMQezQ==
6076+
stream-chat@^9.44.2:
6077+
version "9.44.2"
6078+
resolved "https://registry.yarnpkg.com/stream-chat/-/stream-chat-9.44.2.tgz#97d23ae4ac356b352bb0f20a31a29dc63d3ea6f5"
6079+
integrity sha512-TXALWeHyWnSn1KlGYEF0sltEHB26vFd26l5m1qlE9Q1XHo9RPPSyLb5mfXqTEY8b2FAv57Ei3hrT8nSXVWacDQ==
60806080
dependencies:
60816081
"@types/jsonwebtoken" "^9.0.8"
60826082
"@types/ws" "^8.5.14"

package/src/state-store/audio-player.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,10 @@ export class AudioPlayer {
425425
}
426426
this.position = positionInMillis;
427427
if (this.isExpoCLI) {
428-
if (positionInMillis === 0) {
429-
// If currentTime is 0, we should replay the video from 0th position.
430-
if (this.playerRef?.replayAsync) {
431-
await this.playerRef.replayAsync({});
432-
}
428+
if (this.playerRef?.setPositionAsync) {
429+
await this.playerRef.setPositionAsync(positionInMillis);
433430
} else {
434-
if (this.playerRef?.setPositionAsync) {
435-
await this.playerRef.setPositionAsync(positionInMillis);
436-
} else {
437-
this.notifyError('seek-not-supported');
438-
}
431+
this.notifyError('seek-not-supported');
439432
}
440433
} else {
441434
if (this.playerRef?.seek) {

0 commit comments

Comments
 (0)