{"library":"react-native-web-sound","title":"react-native-web-sound","description":"A drop-in replacement for react-native-sound that works with react-native-web. Version 0.2.1 is the current stable release. It allows playing audio in web browsers by aliasing the react-native-sound package to this web implementation. The library mirrors the original API exactly, so no code changes are needed beyond the webpack alias configuration. It has low maintenance cadence but remains functional for basic audio playback needs. Alternatives include react-native-sound directly (native only) or web-specific libraries like Howler.js, but this package minimizes migration effort for existing react-native-sound users.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install react-native-web-sound"],"cli":null},"imports":["import Sound from 'react-native-sound'","const Sound = require('react-native-sound').default","import Sound from 'react-native-web-sound'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// webpack.config.js\nresolve: {\n  alias: {\n    'react-native': 'react-native-web',\n    'react-native-sound': 'react-native-web-sound',\n  }\n}\n\n// App.js\nimport React from 'react';\nimport { Button } from 'react-native';\nimport Sound from 'react-native-sound';\n\nconst App = () => {\n  const playSound = () => {\n    const sound = new Sound('https://example.com/audio.mp3', null, (error) => {\n      if (error) {\n        console.error('Failed to load sound', error);\n        return;\n      }\n      sound.play(() => sound.release());\n    });\n  };\n\n  return <Button title=\"Play\" onPress={playSound} />;\n};\n\nexport default App;","lang":"javascript","description":"Demonstrates how to configure webpack alias and use the Sound API to play remote audio in a React Native Web app.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}