question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

🐛 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!

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
WazzaJBcommented, Jun 16, 2020

Thanks @byCedric.

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

2reactions
WazzaJBcommented, Jun 16, 2020

No pressure, I’m going to use patch-package to keep my project moving 😄

Thanks ✌️

Read more comments on GitHub >

github_iconTop Results From Across the Web

Audio - Expo Documentation
expo -av allows you to implement audio playback and recording in your app. Note that audio automatically stops if headphones / bluetooth audio...
Read more >
expo/av doesn't support audio recording on web #8721 - GitHub
The documentation claims full support for this library on the web, however the recording aspect is missing. src/ExponentAV.web.ts has empty ...
Read more >
React native, expo-av, audio recording on web, metering is ...
Im working on an app that records audio using expo and makes use of the metering value. I was using version 10, and...
Read more >
How to Record Audio using React Native Expo
Open the expo app and scan the QR code. After you press the start recording then a screen will pop up for permission....
Read more >
Audio Recording and Playback for Expo React Native Apps
Hi everyone,Today I will show you how to use expo av to record audio in an Expo React Native app and then play...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found