react-universal-audio

1.1.5 • Public • Published

react-universal-audio

html Audio class polyfill for react-native. You can use Audio for android,ios without modification to browser code.

Usage

import Audio from 'react-universal-audio'
 
const sound = new Audio('./test.mp3')
sound.play()

Install

npm install react-universal-audio

Add it to your project

react-native link

Coverage

functions

  • addTextTrack()
  • canPlayType()
  • load()
  • play()
  • pause()

properties

  • audioTracks
  • autoplay
  • buffered // only android
  • controller
  • controls
  • crossOrigin
  • currentSrc
  • currentTime
  • defaultMuted
  • defaultPlaybackRate
  • duration
  • ended
  • error
  • loop
  • mediaGroup
  • muted
  • networkState
  • paused
  • playbackRate
  • played
  • preload
  • readyState
  • seekable
  • seeking
  • src
  • startDate
  • textTracks
  • videoTracks
  • volume

event

  • abort
  • canplay
  • canplaythrough
  • durationchange
  • emptied
  • ended
  • error
  • loadeddata
  • loadedmetadata
  • loadstart
  • pause
  • play
  • playing
  • progress // only android
  • ratechange
  • seeked
  • seeking
  • stalled
  • suspend
  • timeupdate
  • volumechange
  • waiting

TODO

  • canPlayType support.
  • Create audio component with controls=true.
  • Buffering progress for ios.

License

MIT

Package Sidebar

Install

npm i react-universal-audio

Weekly Downloads

13

Version

1.1.5

License

MIT

Last publish

Collaborators

  • yusukeshibata