[expo-av] Audio Playing on Web but not Android

I am using expo-av to play .wav files in my react native for web application.

It is working in web but in android I am getting this error:

Error: com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors could read the stream.

This is my code:

const soundObject = new Audio.Sound();
soundObject.setOnPlaybackStatusUpdate(this.onPlaybackStatusUpdate);
await soundObject.unloadAsync();
await soundObject.loadAsync(Platform.OS === 'web' ? { uri: sound } : sound);
const { isLoaded } = await soundObject.playAsync();

When I pass in the {uri: sound} format I’m using for web I receive this error: Error: Cannot load an AV asset from a null playback source

This is package.json:

{
  "name": "nameeeee",
  "version": "0.0.66",
  "description": "descriptionnnnn",
  "author": "teammmmmmm",
  "license": "ISC",
  "readmeFilename": "README.md",
  "main": "dist/index.js",
  "files": [
    "dist/**/**/*",
    "assets/**/*",
    "*.md"
  ],
  "scripts": {
    "start:dev": "tsc -w",
    "prepare": "npm run clean && npm run build",
    "clean": "rm -rf ./dist",
    "assets": "cp ./src/tones/*.wav ./dist/tones",
    "build": "tsc --build tsconfig.json && npm run assets",
    "format": "prettier --write 'src/**/*.ts'",
    "lint": "eslint --fix 'src/**/*.ts'",
    "test": "jest"
  },
  "keywords": [
    "typescript",
    "npm module"
  ],
  "publishConfig": {
    "access": "private",
    "registry": "blahblah"
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "bugs": "",
  "peerDependencies": {
    "react": "^16.13.1",
    "react-native": "^0.62.2",
    "react-native-unimodules": "^0.9.1",
    "expo-av": "^8.1.0"
  },
  "dependencies": {
    "@babel/preset-typescript": "^7.10.4",
    "@types/jest": "^26.0.14",
    "@types/node": "^14.11.2",
    "@types/react-native": "^0.63.25",
    "expo-av": "^8.0.0",
    "jest-expo": "^39.0.0",
    "react": "^16.13.1",
    "react-native": "^0.63.3"
  },
  "devDependencies": {
    "@babel/core": "^7.11.6",
    "@babel/preset-env": "^7.9.6",
    "@babel/preset-react": "^7.9.4",
    "@typescript-eslint/eslint-plugin": "^2.17.0",
    "@typescript-eslint/parser": "^2.17.0",
    "babel-loader": "^8.1.0",
    "clean-webpack-plugin": "^3.0.0",
    "eslint": "^5.16.0",
    "eslint-config-airbnb-base": "^14.0.0",
    "eslint-config-prettier": "^6.9.0",
    "eslint-plugin-import": "^2.20.0",
    "eslint-plugin-jest": "^23.8.2",
    "eslint-plugin-prettier": "^3.1.2",
    "expo-av": "^8.1.0",
    "jest": "24.9.0",
    "prettier": "^1.19.1",
    "react-native": "^0.62.2",
    "react-native-unimodules": "^0.9.1",
    "typescript": "3.7.5"
  },
  "jest": {
    "preset": "jest-expo",
    "rootDir": "src",
    "collectCoverageFrom": [
      "**/*.{ts}"
    ],
    "transformIgnorePatterns": [
      "node_modules/(?!(jest-)?react-native|react-clone-referenced-element|@react-native-community|expo(nent)?|@expo(nent)?/.*|react-navigation|@react-navigation/.*|@unimodules/.*|unimodules|sentry-expo|native-base|@sentry/.*)"
    ]
  }
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.