Giter VIP home page Giter VIP logo

Comments (14)

Drazail avatar Drazail commented on September 13, 2024 1

@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.

Drazail avatar Drazail commented on September 13, 2024 1

@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.

cinder92 avatar cinder92 commented on September 13, 2024

@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.

renganatha10 avatar renganatha10 commented on September 13, 2024

from react-native-get-music-files.

cinder92 avatar cinder92 commented on September 13, 2024

@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.

clems36 avatar clems36 commented on September 13, 2024

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.

Drazail avatar Drazail commented on September 13, 2024

@clems36
Does the logcat show any errors?

from react-native-get-music-files.

renganatha10 avatar renganatha10 commented on September 13, 2024

@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

Screenshot 2019-03-18 at 4 32 47 PM

Screen Shot of Android Logcat

Screenshot 2019-03-18 at 4 34 29 PM

from react-native-get-music-files.

clems36 avatar clems36 commented on September 13, 2024

@Drazail Yes:
ConEmu64_2019-03-24_18-01-33
I don't understand why i'm getting this error though, why is it trying to save images ?

from react-native-get-music-files.

Drazail avatar Drazail commented on September 13, 2024

@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.

clems36 avatar clems36 commented on September 13, 2024

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.

Drazail avatar Drazail commented on September 13, 2024

@clems36

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.

farshed avatar farshed commented on September 13, 2024

Experiencing the same issue. Is there a workaround for it yet?

from react-native-get-music-files.

cinder92 avatar cinder92 commented on September 13, 2024

closing this in favor of #108

from react-native-get-music-files.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.