Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Rendering Error (Node.js) factory(...) is not a function #2416

Open
Mutalistik opened this issue Dec 9, 2024 · 0 comments
Open

Static Rendering Error (Node.js) factory(...) is not a function #2416

Mutalistik opened this issue Dec 9, 2024 · 0 comments
Labels

Comments

@Mutalistik
Copy link

Mutalistik commented Dec 9, 2024

Describe the Bug
There is an error on react-native-track-player/lib/src/trackPlayer.js:44:18

export function registerPlaybackService(factory) {
    if (Platform.OS === 'android') {
       // Registers the headless task
        AppRegistry.registerHeadlessTask('TrackPlayer', factory);
   }
   else if (Platform.OS === 'web') {
       factory()(); //   <--- HERE there is an extra ()
    }
    else {
        // Initializes and runs the service in the next tick
        setImmediate(factory());
    }
}

image

Code To Reproduce
I have the error using...

          const chunkBuffer = audioContext.createBuffer(1, chunk.length, audioContext.sampleRate);
          chunkBuffer.copyToChannel(chunk, 0);

           const source = audioContext.createBufferSource();
          source.buffer = chunkBuffer;
           source.connect(audioContext.destination);

           source.start(); 

Environment Info:

I'm using Expo react web with react-native-track-player version 4.1.1

I removed on my node modules the extra '()' and it work as expected.

Regards

@Mutalistik Mutalistik added the Bug label Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant