1.2.1 • Published 1 year ago

@gauch_99/react-native-audio-files v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-audio-files

This package provides functionality to retrieve all audio files stored on an Android device. With this module, you can easily access and manage audio files within your React Native application.

Installation

npm install react-native-audio-files

Usage

import { fetchAudioFiles } from 'react-native-audio-files';

const audioFiles = await fetchAudioFiles();

Or Follow Basic Example:

import { fetchAudioFiles } from 'react-native-audio-files';

const [audioFiles, setAudioFiles] = useState([]);

useEffect(() => {
  const getAudioFiles = async () => {
    return await fetchAudioFiles();
  };
  getAudioFiles().then((result) => {
    setAudioFiles(result);
  });
}, []);

return (
  <View>
    {audioFiles?.map((element, index) => {
      return (
        <View key={index}>
          <Text>{element?.title}</Text>
        </View>
      );
    })}
  </View>
);

List of keys available:

KeyDescriptionType
addedDateAdded Date Time of the Audio FileString
albumAlbum of the Audio FileString
artistArtist of the Audio FileString
audioUrlPath of the Audio FileString
durationDuration of the Audio FileInteger
idUnique Id of the Audio FileString
imageUrlImage of the Audio FileString
sizeSize of the Audio FileString
titleTitle of the Audio FileString

Note:

  1. addedDate is of type UNIX Timestamp, to convert it into the required time format of YYYY-MM-DD HH:MM:SS
const formattedDateTime = new Date(addedDate * 1000).toISOString().slice(0, 19).replace('T', ' ');
  1. Make sure you have permissions granted from User for Reading Storage according to the Android Versions or you wont be able to fetch files.
Example: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

1.2.1

1 year ago

1.2.0

1 year ago

1.1.15

1 year ago

1.1.14

1 year ago

1.1.13

1 year ago

1.1.12

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago