Skip to content

TypeError: Cannot read property 'prototype' of undefined #2550

@novizarhadisaputra

Description

@novizarhadisaputra

Describe the Bug
A clear and concise description of what the bug is.

Steps To Reproduce
npm install --save react-native-track-player@nightly
cd ios && pod install

Code To Reproduce
import TrackPlayer, { Track } from 'react-native-track-player';

class AudioService {
private isSetup = false;

private async setupPlayer(): Promise {
if (this.isSetup) {
return true;
}
try {
await TrackPlayer.setupPlayer();
this.isSetup = true;
} catch (e) {
console.error('Error setting up track player', e);
return false;
}
return true;
}

public async play(track: Track): Promise {
const isReady = await this.setupPlayer();
if (!isReady) {
return;
}
await TrackPlayer.reset();
await TrackPlayer.add(track);
await TrackPlayer.play();
}

public async pause(): Promise {
await TrackPlayer.pause();
}

public async resume(): Promise {
await TrackPlayer.play();
}

public async stop(): Promise {
await TrackPlayer.stop();
}
}

const audioService = new AudioService();
export default audioService;

Environment Info:
System:
OS: macOS 26.0.1
CPU: (11) arm64 Apple M3 Pro
Memory: 183.83 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.19.5
path: /Users/novizar/.nvm/versions/node/v20.19.5/bin/node
Yarn:
version: 4.9.1
path: /Users/novizar/.nvm/versions/node/v20.19.5/bin/yarn
npm:
version: 10.8.2
path: /Users/novizar/.nvm/versions/node/v20.19.5/bin/npm
Watchman:
version: 2025.09.15.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 25.1
- iOS 26.1
- macOS 26.1
- tvOS 26.1
- visionOS 26.1
- watchOS 26.1
Android SDK:
API Levels:
- "31"
- "33"
- "34"
- "35"
- "36"
Build Tools:
- 33.0.1
- 34.0.0
- 35.0.0
- 36.0.0
- 36.0.0
- 36.0.0
- 36.1.0
System Images:
- android-28 | Google ARM64-V8a Play ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2025.2 AI-252.25557.131.2521.14344949
Xcode:
version: 26.1.1/17B100
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.16
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 20.0.0
wanted: 20.0.0
react:
installed: 19.1.1
wanted: 19.1.1
react-native:
installed: 0.82.1
wanted: ^0.82.1
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true

Image

Metadata

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