Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[expo-av] Recording status not reset when paused before stopping #21747

Closed
FrenchMajesty opened this issue Mar 17, 2023 · 8 comments · Fixed by #23816
Closed

[expo-av] Recording status not reset when paused before stopping #21747

FrenchMajesty opened this issue Mar 17, 2023 · 8 comments · Fixed by #23816
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@FrenchMajesty
Copy link

FrenchMajesty commented Mar 17, 2023

Minimal reproducible example

https://snack.expo.dev/@frenchmajesty1/cannot-pause-before-ending-recording-on-ios

Summary

Must reproduce on iOS device. This behavior works well on the Web.

[ When it works ]

  • User starts a recording
  • Talk for 3sec
  • User hits end recording
  • (Timer resets to 0)
  • User starts recording again
  • (Timer starts going up from 0)

[ When it doesn't work ]

  • User starts a recording
  • Talk for 3sec
  • User hit pause
  • User ends the recording
  • (Timer resets to 0)
  • User starts recording again
  • (Timer continues to record from 4sec)

It seems like when a user pauses a recording and then stops it, the status value doesn't get reset

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.3
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
Watchman: 2022.08.29.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
IDEs:
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
npmPackages:
expo: ~48.0.5 => 48.0.5
react: 18.2.0 => 18.2.0
react-native: 0.71.3 => 0.71.3
npmGlobalPackages:
expo-cli: 6.3.2
Expo Workflow: managed

@FrenchMajesty FrenchMajesty added the needs validation Issue needs to be validated label Mar 17, 2023
@FrenchMajesty FrenchMajesty changed the title Audio Recording cannot be paused before stopping Audio Recording status not reset when paused before stopping Mar 17, 2023
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Mar 17, 2023
@FrenchMajesty FrenchMajesty changed the title Audio Recording status not reset when paused before stopping [expo-av] Recording status not reset when paused before stopping Mar 17, 2023
@maticzav
Copy link

This is also an issue for us and I'd love to help in any way possible 🙂

@FrenchMajesty
Copy link
Author

@maticzav I found a way to "hack" into working by sneakily triggering a resume right before the final call to stopRecording() so that the recording doesn't get ended while it's in the paused state.

Obviously that's not the desired behavior but that's at least a work-around

@vijaystroup
Copy link

@maticzav I found a way to "hack" into working by sneakily triggering a resume right before the final call to stopRecording() so that the recording doesn't get ended while it's in the paused state.

Can you elaborate or show the example in the expo snack you provided where you are doing this?
Are you calling recordingObj.startAsync() right before recordingObj.stopAndUnloadAsync()?

@FrenchMajesty
Copy link
Author

Sure. @vijaystroup

  const stopRecording = async () => {
    await recording.startAsync(); // Recording must be in "playing" state to stop
    console.log('Stopping recording..');
    setRecording(undefined);
    await recording.stopAndUnloadAsync();
    await Audio.setAudioModeAsync({
      allowsRecordingIOS: false,
    });
    const uri = await recording.getURI();
    setStatus(undefined);
    console.log('Audio processed into a file');
    return uri;
  };

@tsapeta
Copy link
Member

tsapeta commented Aug 4, 2023

Probably it's been fixed in #23816
I'll release a new version of expo-av for SDK 49 in a few days

@tsapeta tsapeta closed this as completed Aug 4, 2023
@karthik-hr
Copy link

Expo SDK 49 allow to install only expo-av v13.4.1.
Is new release happened? If so whats the latest version that supports SDK 49?

@tsapeta
Copy link
Member

tsapeta commented Jan 12, 2024

It was first released in 13.6.0. You can try to use it, there is a chance it will work fine with SDK 49 (not in Expo Go though).

@Emmanueldmlr
Copy link

I still have this issue with SDK 49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants
@tsapeta @maticzav @FrenchMajesty @expo-bot @vijaystroup @karthik-hr @Emmanueldmlr and others