1.0.4 • Published 9 months ago

@carchaze/react-native-voice-message-player v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@carchaze/react-native-voice-message-player

GitHub Stars GitHub Forks

Supports iOS Supports Android

\ publish-package License code style: prettier PRs Welcome GitHub Top Language Last Commit

The @carchaze/react-native-voice-message-player is a flexible and feature-rich voice message player tailored for React Native applications. It's designed to provide developers with a seamless solution to integrate voice message playback into their apps with various customization options.

For a detailed list of changes, please refer to the CHANGELOG.md.

Maintainer Required 🤝

This project is currently looking for a maintainer. If you are interested, please reach out! 🚨

Features

  • Theming and Styling: Customize to fit your app's look and feel.
  • Profile Support: Attach user profiles with custom images.
  • Custom Renderers: Fine-tune UI components.
  • Download Progress: Display progress for downloading voice messages from URLs.
  • Audio Playback Controls: Play, pause, and load voice messages with user feedback.

Demo

Installation

npm install @carchaze/react-native-voice-message-player
# or
yarn add @carchaze/react-native-voice-message-player

# On Ios
cd ios && pod install && cd..

Usage

  1. Import the RNVoiceMessagePlayer component into your React Native file:
import RNVoiceMessagePlayer from '@carchaze/react-native-voice-message-player';
  1. Use the RNVoiceMessagePlayer component in your render method:
const localFile = require('./path/to/audio.*')
const localUrl = "file:///path/to/audio.*"
const onlineUrl = "https://example.com/audio.*"

// Load local file
<RNVoiceMessagePlayer source={localFile} />

// Load local url
<RNVoiceMessagePlayer source={localUrl} />
<RNVoiceMessagePlayer source={{uri: localUrl}} />

// Load online url
<RNVoiceMessagePlayer source={onlineUrl} autoDownload={true} />

Props

Below is a detailed list of props you can use with the RNVoiceMessagePlayer:

Main Props

PropDescriptionTypeRequiredDefault Value
sourceSource of the audio, either an object with URI or a require path.{uri: string} \| require()true-
timestampThe timestamp of the voice message.string--
autoDownloadWhether to automatically download audio if given a URL.boolean-false
customThemeCustom theme to override the default theme.Theme--
containerStyleStyle for the main container.ViewStyle--
renderDownloadProgressCustom render function for the download progress.Function--
renderTextCustom render function for the text.Function--
textNotDownloadedText to show when the audio is not downloaded.string-'Download voice message'
textLoadingText to show while loading the audio.string-'Loading...'
textErrorText to show when there's an error.string-'Audio is not playable'
refReference to the component.React.Ref--

Chat Status Props

PropDescriptionTypeRequiredDefault Value
chatStatusProps.isNewWhether the message is new.boolean-false
chatStatusProps.isPlayedWhether the message has been played.boolean-false
chatStatusProps.statusStatus of the chat message.DefaultStatusString-'single-check'

Profile Props

PropDescriptionTypeRequiredDefault Value
profileProps.profilePositionPosition of the profile.('left' \| 'right')-'right'
profileProps.profileImageSourceSource for the profile image.ImageSourcePropType--
profileProps.profileMicSourceSource for the microphone icon.ImageSourcePropType--
profileProps.ProfileImagePressDisabledWhether the profile image press is disabled.boolean--
profileProps.onProfileImagePressCallback when profile image is pressed.Function--
profileProps.renderProfileMicCustom render function for the microphone icon.Function--
profileProps.renderProfileImageCustom render function for the profile image.Function--
profileProps.renderProfileCustom render function for the whole profile.Function--
profileProps.profileContainerStyleStyle for the profile container.ViewStyle--

Bottom Props

PropDescriptionTypeRequiredDefault Value
bottomProps.renderBottomTimestampCustom render function for the bottom timestamp.Function--
bottomProps.renderBottomTimerCustom render function for the bottom timer.Function--
bottomProps.bottomStatusSourcesSources for the bottom status.DefaultStatusSources--
bottomProps.bottomContainerStyleStyle for the bottom container.ViewStyle--
bottomProps.renderBottomCustom render function for the bottom section.Function--

Left Action Props

PropDescriptionTypeRequiredDefault Value
leftActionProps.leftActionSourcesSources for the left action buttons.DefaultActionSources--
leftActionProps.leftActionContainerStyleStyle for the left action container.ViewStyle--
leftActionProps.renderLeftActionCustom render function for the left actions.Function--

Track Props

PropDescriptionTypeRequiredDefault Value
trackProps.renderTrackCustom render function for the audio track.Function--
trackProps.onTrackChangeCallback when the track changes.Function--
trackProps.onTrackChangeCompleteCallback when track change is complete.Function--
trackProps.onTrackChangeStartCallback when track change starts.Function--

Audio Event Callbacks

PropDescriptionTypeRequiredDefault Value
onPlayCallback when the audio starts playing.Function--
onPauseCallback when the audio is paused.Function--
onErrorCallback when there's an error.Function--
onLoadingCallback while the audio is loading.Function--
onDownloadCallback when the audio starts downloading.Function--
onDownloadSuccessCallback when the audio download is successful.Function--
onDownloadSavedCallback when the downloaded audio is saved.Function--
onDownloadFailedCallback when the audio download fails.Function--
onLoadStartCallback when the audio starts loading.Function--
onLoadSuccessCallback when the audio loading is successful.Function--
onLoadFailedCallback when the audio loading fails.Function--

License

This project is licensed under the MIT License.

Contributors

A big thank you to all the contributors who have helped make this project better!

Credits

We'd like to thank the following libraries and resources that have contributed to the development of React Native Voice Message Player:

Contact

If you have any questions or need assistance, feel free to reach out to us:

FAQs

General

1. What is the primary purpose of React Native Voice Message Player?

Answer: The @carchaze/react-native-voice-message-player is designed to provide developers a seamless solution to integrate voice message playback in their React Native apps with various customization options.

2. Is this package free to use?

Answer: Yes, the package is open-source and free to use. We appreciate contributions from the community to improve it further!

Technical

3. Which versions of React Native are supported?

Answer: The package supports React Native versions 0.60 and above. For older versions, you might encounter compatibility issues.

4. How do I customize the theme of the player?

Answer: You can use the customTheme prop to override the default styles and match your app's theme. Refer to the Props section for more details.

5. Are there any known issues with the package?

Answer: All known issues are tracked on our GitHub issues page. If you encounter a problem, please check there first, and if it's a new issue, feel free to report it.

Contributing

6. I found a bug! How can I report it?

Answer: We appreciate your feedback! Please report any bugs or issues on our GitHub repository's issues page.

7. I have a feature request. Where can I submit it?

Answer: Feature requests can be submitted on our GitHub repository. We welcome contributions and suggestions from the community.

8. How can I contribute to the project?

Answer: Please refer to our Contributing Guidelines for detailed steps on how to contribute. We appreciate all forms of contributions, from code to documentation and testing.

Miscellaneous

9. Are there plans for future features or improvements?

Answer: We continuously aim to improve the package and add new features. Keep an eye on our GitHub repository for the latest updates and planned features.

10. How can I support the project?

Answer: Using the package, reporting bugs, suggesting features, and contributing to the codebase are all great ways to support the project. Additionally, giving the repository a star on GitHub helps boost its visibility in the community!

Contributing Guidelines

At CarChaze, we value the power of the community and believe in the open-source spirit. We are thrilled you're considering contributing to the React Native Voice Message Player package. Before you start, please ensure you've read and understood these guidelines.

Reporting Bugs or Suggesting Enhancements

If you come across any issues or have ideas for improvements:

  1. Check the issues page to ensure your problem or suggestion hasn't been reported or addressed already.
  2. If your issue isn't listed, you can create a new one.

Code Contributions

  1. Fork and Clone: Fork the react-native-voice-message-player repository, then clone your fork onto your machine.
  2. Create a New Branch: It's a best practice to create a new branch for each feature or fix you are working on.
  3. Make Necessary Changes: Write your code, ensuring you follow CarChaze's coding standards. Make sure the package functions as intended and doesn't introduce new issues.
  4. Test: Ensure your changes are well-tested. Add or update tests as necessary.
  5. Pull Request: Submit a pull request to the main branch. Provide a comprehensive description of the changes and link the related issues.

Documentation

If you're making changes to features that are already documented, make sure you update the corresponding parts of the documentation. If you introduce a new feature, please add related documentation.

Stay Updated

Ensure you pull changes from the main repository to your fork regularly to stay updated. This helps reduce merge conflicts when submitting a PR.

Community and Behavior

Please remember to adhere to CarChaze's Code of Conduct. We foster an inclusive and respectful community, and we expect contributors to do the same.

Recognition

Every contributor gets recognized! All accepted contributions will see the contributor's name added to the Credits section of our README.

Questions?

If you have any questions about contributing or face issues while setting up, don't hesitate to reach out. Create an issue, and a team member will assist you.

Thank you for being a part of CarChaze's open-source initiatives! Your efforts help make the React Native ecosystem even better.