Skip to content

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

Open
@Mutalistik

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions