expo: @expo/av doesn't support audio recording on web

πŸ› Bug Report

Summary of Issue (just a few sentences)

The documentation claims full support for this library on the web, however the recording aspect is missing.

src/ExponentAV.web.ts has empty methods for recording at the bottom:

/* Recording */
  //   async setUnloadedCallbackForAndroidRecording() {},
  async getAudioRecordingStatus() {},
  async prepareAudioRecorder() {},
  async startAudioRecording() {},
  async pauseAudioRecording() {},
  async stopAudioRecording() {},
  async unloadAudioRecorder() {},

Environment - output of expo diagnostics & the platform(s) you’re targeting

    System:
      OS: macOS Mojave 10.14.3
      Shell: 5.3 - /bin/zsh
    Binaries:
      Node: 14.2.0 - /usr/local/bin/node
      Yarn: 1.22.4 - ~/.yarn/bin/yarn
      npm: 6.14.5 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5791312
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~37.0.3 => 37.0.12 
      react: ~16.9.0 => 16.9.0 
      react-dom: ~16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz => 0.61.4 
      react-native-web: ~0.11.7 => 0.11.7 
    npmGlobalPackages:
      expo-cli: 3.21.3

Reproducible Demo

Add expo-av to a project, and call:

 const recording = new Audio.Recording();

    try {
      await recording.prepareToRecordAsync(
        Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY
      );
      await recording.startAsync();
      // You are now recording!
    } catch (error) {
      // An error occurred!
      console.log(error);
    }

On web, this will throw:

TypeError: Cannot read property 'uri' of undefined

I’m going to have a go at creating a PR for this, which may at least lay out the bones of it for someone to pick up? But thought it best to create an issue first.

Thanks for everything that Expo brings to React Native!

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 15 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @byCedric.

Can confirm this PR works (have it working in my app) and the audio plays.

No pressure, I’m going to use patch-package to keep my project moving πŸ˜„

Thanks ✌️

Would the audio playback feature (web based) be release with SDK 43?

Thanks so much for your awesome work!