Comments (14)
@cinder92
com.facebook.react.bridge.WritableArray.size()
returns 1 all the time, adding a separate counter for JsonArray
size at com.cinder92.musicfiles.RNReactNativeGetMusicFilesModule.getSongs
should solve this issue.
will make a pull request as soon as the docs are finalized.
from react-native-get-music-files.
@eff-society
workaround would be to use RNAndroidAudioStore.getAll
:p
as I mentioned earlier, the problem seems to be the return value of com.facebook.react.bridge.WritableArray.size()
@ com.cinder92.musicfiles.RNReactNativeGetMusicFilesModule.getSongs
.
from react-native-get-music-files.
@renganatha10 how many songs do you have on your device? maybe is a stupid question, but in this way we ca check what is happening, and what are the specs of your device? simulator? real one?
from react-native-get-music-files.
from react-native-get-music-files.
@renganatha10 could you please try to install the module again from this github repo instead of npm, and test again please?
from react-native-get-music-files.
I'm having the same issue, console.log(params.batch.length);
shows 5000+. It only shows 1
when I set batchNumber: 1
Also, i'm trying to log the result of getAll
but it never gets to the log:
async componentDidMount(): Promise<void> {
try {
const tracks: any = await MusicFiles.getAll({
id: true,
blured: false,
artist: true,
duration: true,
cover: false,
title: true,
batchNumber: 5,
minimumSongDuration: 10000,
fields: ['title', 'artist', 'duration'],
});
console.log('number of tracks: ', tracks.length);
} catch (err) {
console.log('Error while getting music files: ', err);
}
}
from react-native-get-music-files.
@clems36
Does the logcat show any errors?
from react-native-get-music-files.
@cinder92 I am installing directly from GitHub FYI I am Using Android 8.1
Screen Shot of JS console which returns the result in Batch
Screen Shot of Android Logcat
from react-native-get-music-files.
@Drazail Yes:
I don't understand why i'm getting this error though, why is it trying to save images ?
from react-native-get-music-files.
@clems36 MusicFiles.getAll()
extracts meta data directly from the file, saves the cover image and sends the path over the bridge to the JS thread, the other option is to send the image itself which would block the bridge and can cause crashes.
this is currently the only way ( and a very slow one at that) of retrieving thumbnails i can think of as ALBUM_ART
constant of MediaStore.Audio.AlbumColumns
was deprecated in API level Q.
from react-native-get-music-files.
I'm not sure I understood everything you said but basically do you have a way to avoid this error ?
from react-native-get-music-files.
There's a snippet from the example app, its a function which asks for read/write permissions recursively :
requestPermission = async () => {
try {
const granted = await PermissionsAndroid.requestMultiple(
[
PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE,
PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
],
{
title: "Permission",
message: "Storage access is requiered",
buttonPositive: "OK"
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
alert("You can use the package");
} else {
requestPermission();
}
} catch (err) {
console.warn(err);
}
};
This should fix the permission issues.
from react-native-get-music-files.
Experiencing the same issue. Is there a workaround for it yet?
from react-native-get-music-files.
closing this in favor of #108
from react-native-get-music-files.
Related Issues (20)
- App crashes when using function of this package REACT NATIVE HOT 4
- Add TypeScript definitions HOT 1
- invalid column genre HOT 2
- pod install not working HOT 1
- Sorting Features and Duration HOT 5
- Get files from specific folder HOT 12
- The `RNReactNativeGetMusicFiles` pod failed to validate due to 1 error: HOT 5
- TypeError: null is not an object (evaluating 'RNReactNativeGetMusicFiles.getAll') HOT 8
- Android X | RN 0.60+ Support HOT 33
- RNAndroidAudioStore TypeError: Cannot read property 'getSongs' of undefined HOT 2
- Covers are null on React Native 0.63.2 HOT 7
- ackage android.support.annotation does not exist HOT 2
- Something get wrong with musicCursor HOT 2
- TypeError: null is not an object (evaluating 'RNReactNativeGetMusicFiles.getAll') HOT 1
- assetUrl key not in track response HOT 3
- followed all steps, but when opening the app in device in crashed, but in emulator works HOT 1
- app in device automatically closes when using method MusicFiles.getAll HOT 3
- added cover: true but not getting the cover in the version for android X HOT 1
- App getting crashed HOT 5
- error [Error: 404: Either the cursor is null or there are no results for this query] HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-get-music-files.