react-native-simple-audio
Install
yarn add react-native-simple-audio
iOS
cd ios && pod install && cd .. # CocoaPods on iOS needs this extra step
Run
react-native run-ios
or build manually:
xed -b ios
- Run project in Xcode
NOTE ABOUT iOS USAGE
Currently, there are two other changes that need to take place before the app will properly build.
- This package has a minimum requirement of iOS 10.0. So if you are building an application for anything lower than 10.0, you need to go into
<YOUR PROJECT>/ios/Podfile
and change the first line toplatform :ios, '10.0'
. - There's a strange build issue that seems to sometimes occur with Swift based custom modules: https://stackoverflow.com/questions/52536380/why-linker-link-static-libraries-with-errors-ios/54586937#54586937 Following these steps fixes the issue. I will work on either automating this or hopefully a future version of RN will eliminate the need.
Android
COMING SOON
Example usage
; ; const Player = { const player error = ; if error // handle error console; return <View> playerstatusloading && !playerstatusready ? <ActivityIndicator size="large" /> : <> <Button title=`` color="#f194ff" onPress=playertoggleAudio /> <Button title="Back 20 seconds" color="#f194ff" onPress= player /> <Button title="Forward 20 seconds" color="#f194ff" onPress= player /> <Text> playerstatuscurrentTimeformatted - playerstatusdurationformatted </Text> </> </View> }; // Player component usage with remote url<Player url="www.site.com/foo.mp3" />
TODO
- Add full example
- Add Android functionality