Skip to content

Examples

lovegaoshi edited this page Nov 19, 2025 · 5 revisions

Native android example (KotlinAudio):

  • run yarn; yarn build; cd example; yarn; cd android; ./gradlew generateCodegenArtifactsFromSchema --rerun-tasks --info

  • open RNTP/android with android studio

Native apple example (SwiftAudioEx): open RNTP/ios/Example/example.xcodej with xcode

RN example: open RNTP/example/android with android studio or RNTP/example/ios with xcode

  • run yarn; yarn build; cd example; yarn; cd ios; pod install; cd ..; yarn start

use APM for development:

"react-native-track-player": "link:../react-native-track-player",

react-native-track-player should NOT have npm_modules installed. if does you have to exclude them in metro.config.js like:

/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
const { withSentryConfig } = require('@sentry/react-native/metro');
const path = require('path');

const RNTPPath = path.resolve(__dirname, '../react-native-track-player');
const pak = require(`${RNTPPath}/package.json`);
const modules = Object.keys({
  ...pak.peerDependencies,
});
/** build the blockList **/
const blockList = modules.map(
  m => new RegExp(`^${escape(path.join(RNTPPath, 'node_modules', m))}\\/.*$`),
);

/** build extraNodeModules **/
const extraNodeModules = modules.reduce((acc, name) => {
  acc[name] = path.join(__dirname, 'node_modules', name);
  return acc;
}, {});

const config = getDefaultConfig(__dirname);
config.resolver.sourceExts.push('sql');

const customConfig = {
  watchFolders: [
    __dirname,
    path.resolve(__dirname, '../react-native-track-player'),
  ],
  resolver: {
    blockList,
    extraNodeModules,
    nodeModulesPaths: [path.resolve(__dirname, 'node_modules')],
    // HACK: only enables this if some module is only commonJS
    // unstable_enablePackageExports: false,
  },
};

module.exports = withSentryConfig(mergeConfig(config, customConfig));

why is this installed anyways for example to run?

Clone this wiki locally