{"_id":"@ayoelutilo/react-native-apple-music","_rev":"4-575e2e6d4109eefe0b38edee342d9690","time":{"created":"2024-05-20T16:31:36.311Z","1.0.0":"2024-05-20T16:10:52.352Z","modified":"2024-05-20T19:49:36.683Z","1.0.1":"2024-05-20T16:31:36.633Z","1.0.2":"2024-05-20T19:39:36.589Z","1.0.3":"2024-05-20T19:49:36.506Z"},"name":"@ayoelutilo/react-native-apple-music","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.1":{"name":"@ayoelutilo/react-native-apple-music","version":"1.0.1","description":"Apple MusicKit for React-Native","main":"index.js","type":"module","keywords":["js","react-native","ios","music-kit","apple","native"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/MarshmallowStudios/react-native-apple-music.git"},"bugs":{"url":"https://github.com/MarshmallowStudios/react-native-apple-music/issues"},"homepage":"https://github.com/MarshmallowStudios/react-native-apple-music#readme","author":{"name":"Marshmallow Studio"},"license":"Apache-2.0","scripts":{"build":"rollup -c","release":"npm run build && cd lib && npm publish","lint:check":"eslint --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","lint:format":"eslint --fix --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","ts:check":"tsc --project ./tsconfig.json --skipLibCheck --noemit","prepare":"husky install"},"devDependencies":{"@babel/core":"^7.23.6","@babel/preset-react":"^7.23.3","@babel/runtime":"^7.23.6","@commitlint/config-conventional":"^17.0.2","@lomray/eslint-config":"^3.0.0","@lomray/prettier-config":"^1.2.0","@react-native/eslint-config":"^0.72.2","@rollup/plugin-json":"^6.1.0","@types/jest":"^28.1.2","@types/react":"~17.0.21","@types/react-native":"0.70.0","commitlint":"^17.0.2","eslint":"^8.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-jsx-a11y":"^6.8.0","eslint-plugin-prettier":"^4.0.0","husky":"^8.0.3","jest":"^28.1.1","pod-install":"^0.1.0","prettier":"^2.8.8","react":"18.2.0","react-native":"0.71.7","rollup":"^4.9.1","rollup-plugin-copy":"^3.5.0","rollup-plugin-folder-input":"^1.0.1","rollup-plugin-ts":"^3.4.5","semantic-release":"^21.1.2","typescript":"^5.0.2"},"resolutions":{"@types/react":"17.0.21"},"peerDependencies":{"react":"*","react-native":">=0.61"},"workspaces":["example"],"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"directories":{"example":"example"},"_id":"@ayoelutilo/react-native-apple-music@1.0.1","types":"./index.d.ts","_nodeVersion":"18.19.0","_npmVersion":"9.9.3","dist":{"integrity":"sha512-+9uTLUIYpsv5o9eyvhAONjblcnXsLuycZFh7VdWrBkuBiU/FDdki3ssklJ9gtcTmPyLs5UyV45JXfVX6+atMAg==","shasum":"9a481d6a6b0a6a6e17bd33081f59cf58b91ecced","tarball":"https://registry.npmjs.org/@ayoelutilo/react-native-apple-music/-/react-native-apple-music-1.0.1.tgz","fileCount":54,"unpackedSize":68014,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAwNtw+34QRwHSW6GD1F7lyj3mXsIHybDgT4/RaeDlF4AiEAvWsofQSpxrH1V4I/0AnDyFcg7jOg+K8ELeRd0Ft4pbk="}]},"_npmUser":{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"},"maintainers":[{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-apple-music_1.0.1_1716222696472_0.741708585243553"},"_hasShrinkwrap":false},"1.0.2":{"name":"@ayoelutilo/react-native-apple-music","version":"1.0.2","description":"Apple MusicKit for React-Native","main":"index.js","type":"module","keywords":["js","react-native","ios","music-kit","apple","native"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/MarshmallowStudios/react-native-apple-music.git"},"bugs":{"url":"https://github.com/MarshmallowStudios/react-native-apple-music/issues"},"homepage":"https://github.com/MarshmallowStudios/react-native-apple-music#readme","author":{"name":"Marshmallow Studio"},"license":"Apache-2.0","scripts":{"build":"rollup -c","release":"npm run build && cd lib && npm publish","lint:check":"eslint --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","lint:format":"eslint --fix --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","ts:check":"tsc --project ./tsconfig.json --skipLibCheck --noemit","prepare":"husky install"},"devDependencies":{"@babel/core":"^7.23.6","@babel/preset-react":"^7.23.3","@babel/runtime":"^7.23.6","@commitlint/config-conventional":"^17.0.2","@lomray/eslint-config":"^3.0.0","@lomray/prettier-config":"^1.2.0","@react-native/eslint-config":"^0.72.2","@rollup/plugin-json":"^6.1.0","@types/jest":"^28.1.2","@types/react":"~17.0.21","@types/react-native":"0.70.0","commitlint":"^17.0.2","eslint":"^8.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-jsx-a11y":"^6.8.0","eslint-plugin-prettier":"^4.0.0","husky":"^8.0.3","jest":"^28.1.1","pod-install":"^0.1.0","prettier":"^2.8.8","react":"18.2.0","react-native":"0.71.7","rollup":"^4.9.1","rollup-plugin-copy":"^3.5.0","rollup-plugin-folder-input":"^1.0.1","rollup-plugin-ts":"^3.4.5","semantic-release":"^21.1.2","typescript":"^5.0.2"},"resolutions":{"@types/react":"17.0.21"},"peerDependencies":{"react":"*","react-native":">=0.61"},"workspaces":["example"],"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"directories":{"example":"example"},"_id":"@ayoelutilo/react-native-apple-music@1.0.2","types":"./index.d.ts","_nodeVersion":"18.19.0","_npmVersion":"9.9.3","dist":{"integrity":"sha512-44TAeRpjatMxZiycMYr0bJqbiaRGCFsjA7k+mUwpALGJBOiYlOg6Gugkcv+uRXmaXiBTt4KSgomBlUjXD2NacQ==","shasum":"2b0888f6243bbe2bf2d83fc1be491374a9c149d2","tarball":"https://registry.npmjs.org/@ayoelutilo/react-native-apple-music/-/react-native-apple-music-1.0.2.tgz","fileCount":54,"unpackedSize":67987,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDDFyDbQhD15MYMvXWMnk3hutdLcAe9m89XdkZ/7eZTQQIhAJP6LRiBEuyEg2hOWSfm0nBneYpMH3MpFJiRStgtcYsP"}]},"_npmUser":{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"},"maintainers":[{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-apple-music_1.0.2_1716233976408_0.06838192105482843"},"_hasShrinkwrap":false},"1.0.3":{"name":"@ayoelutilo/react-native-apple-music","version":"1.0.3","description":"Apple MusicKit for React-Native","main":"index.js","type":"module","keywords":["js","react-native","ios","music-kit","apple","native"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/MarshmallowStudios/react-native-apple-music.git"},"bugs":{"url":"https://github.com/MarshmallowStudios/react-native-apple-music/issues"},"homepage":"https://github.com/MarshmallowStudios/react-native-apple-music#readme","author":{"name":"Marshmallow Studio"},"license":"Apache-2.0","scripts":{"build":"rollup -c","release":"npm run build && cd lib && npm publish","lint:check":"eslint --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","lint:format":"eslint --fix --ext \".ts,.tsx\" \"src/**/*.{ts,tsx,*.ts,*tsx}\"","ts:check":"tsc --project ./tsconfig.json --skipLibCheck --noemit","prepare":"husky install"},"devDependencies":{"@babel/core":"^7.23.6","@babel/preset-react":"^7.23.3","@babel/runtime":"^7.23.6","@commitlint/config-conventional":"^17.0.2","@lomray/eslint-config":"^3.0.0","@lomray/prettier-config":"^1.2.0","@react-native/eslint-config":"^0.72.2","@rollup/plugin-json":"^6.1.0","@types/jest":"^28.1.2","@types/react":"~17.0.21","@types/react-native":"0.70.0","commitlint":"^17.0.2","eslint":"^8.4.1","eslint-config-prettier":"^8.5.0","eslint-plugin-jsx-a11y":"^6.8.0","eslint-plugin-prettier":"^4.0.0","husky":"^8.0.3","jest":"^28.1.1","pod-install":"^0.1.0","prettier":"^2.8.8","react":"18.2.0","react-native":"0.71.7","rollup":"^4.9.1","rollup-plugin-copy":"^3.5.0","rollup-plugin-folder-input":"^1.0.1","rollup-plugin-ts":"^3.4.5","semantic-release":"^21.1.2","typescript":"^5.0.2"},"resolutions":{"@types/react":"17.0.21"},"peerDependencies":{"react":"*","react-native":">=0.61"},"workspaces":["example"],"jest":{"preset":"react-native","modulePathIgnorePatterns":["<rootDir>/example/node_modules","<rootDir>/lib/"]},"directories":{"example":"example"},"_id":"@ayoelutilo/react-native-apple-music@1.0.3","types":"./index.d.ts","_nodeVersion":"18.19.0","_npmVersion":"9.9.3","dist":{"integrity":"sha512-Vi8Xcos5ttcLhn6vazw/E9+sG65iHMXktAvRFe0StG9lSO2uJAZ4COVLwqKGsffJhkPro88+q+CHfHzzPBXlOg==","shasum":"072d2b8f87cbf36072544d84eaf8c5999130dc1c","tarball":"https://registry.npmjs.org/@ayoelutilo/react-native-apple-music/-/react-native-apple-music-1.0.3.tgz","fileCount":54,"unpackedSize":67936,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBtb+8mtKB5bPK8YSvAsioBwZKZDiKtfTuR5UjPon2gjAiAO9G+7VDPvkhvdv7Uqsjzkz9SX9KGpyQpE7OGGo+w0aw=="}]},"_npmUser":{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"},"maintainers":[{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-apple-music_1.0.3_1716234576297_0.5283299158833066"},"_hasShrinkwrap":false}},"maintainers":[{"name":"ayoelutilo","email":"ayoelutilo@gmail.com"}],"description":"Apple MusicKit for React-Native","homepage":"https://github.com/MarshmallowStudios/react-native-apple-music#readme","keywords":["js","react-native","ios","music-kit","apple","native"],"repository":{"type":"git","url":"git+https://github.com/MarshmallowStudios/react-native-apple-music.git"},"author":{"name":"Marshmallow Studio"},"bugs":{"url":"https://github.com/MarshmallowStudios/react-native-apple-music/issues"},"license":"Apache-2.0","readme":"This is a fork of\n\n@lomray/react-native-apple-music\n---\n\n# Apple MusicKit for React Native\n\nA react native module for the Apple MusicKit ( [iOS](https://developer.apple.com/musickit/) )\n\n## Supported Features\n\nAn [Example](./example) project was developed to exercise and test all functionality within this library. If you are curious about how to use something, or need to compare your application setup to something that works, check there first.\n\n## Features\n\nThe following table shows the platform support for various Apple Music functionality within this library.\n\n| Feature                | iOS |\n|:-----------------------| :-: |\n| **Auth**               |\n| `authorize`            | ✅  |\n| `checkSubscription`    | ✅  |\n| **Player**             |\n| `play`                 | ✅  |\n| `pause`                | ✅  |\n| `togglePlayerState`    | ✅  |\n| `skipToNextEntry`      | ✅  |\n| `getCurrentState`      | ✅  |\n| `addListener`          | ✅  |\n| `removeListener`       | ✅  |\n| **MusicKit**           |\n| `catalogSearch`        | ✅  |\n| `getTracksFromLibrary` | ✅  |\n| `setPlaybackQueue`     | ✅  |\n\n## Installation\n\n```sh\nnpm install @lomray/react-native-apple-music\n```\n- In your Podfile, set minimum IOS target for Pod installation:\n```sh\nplatform :ios, 15.0\n```\n```sh\nnpx pod-install\n```\n\n### iOS Requirements\n- Ensure your iOS deployment target is 15.0 or higher, as this library relies on the Apple MusicKit, which requires iOS 15.0+.\n- Add the following line to your info.plist file to include a description for the Media Library usage permission:\n```\n<key>NSAppleMusicUsageDescription</key>\n<string>Allow to continue</string>\n```\n- Ensure that your Apple Developer account has the MusicKit entitlement enabled and the appropriate MusicKit capabilities are set in your app's bundle identifier.\n- It's highly recommended to set a minimum deployment target of your application to 16.0 and above, because MusicKit requires it to perform a catalog search and some convertation methods.\n\n## Linking\n\nAs of React Native `> 0.61`, auto linking should work for iOS. There shouldn't be any modifications necessary and it _Should_ work out of the box.\n\n## Usage\nThe `@lomray/react-native-apple-music` package provides a set of tools to interact with Apple MusicKit in your React Native application. Here's how to get started:\n### Importing the Module\nFirst, import the necessary modules from the package:\n```javascript\nimport {\n  Auth,\n  Player,\n  MusicKit,\n  useCurrentSong,\n  useIsPlaying,\n} from '@lomray/react-native-apple-music';\n```\n\n### Authentication\nBefore accessing Apple Music data, you need to authenticate the user and obtain permissions:\n\n```javascript\nasync function authenticate() {\n  try {\n    const authStatus = await Auth.authorize();\n    console.log('Authorization Status:', authStatus);\n  } catch (error) {\n    console.error('Authorization failed:', error);\n  }\n}\n```\n\n### Checking Subscription\nCheck if the user has an active Apple Music subscription:\n\n```javascript\nasync function checkSubscription() {\n  const subscriptionStatus = await Auth.checkSubscription();\n  console.log('Subscription Status:', subscriptionStatus);\n}\n```\n\n### Playing Music\nControl playback using the Player module:\n\n```javascript\n// Play music\nPlayer.play();\n\n// Pause music\nPlayer.pause();\n\n// Toggle between play and pause\nPlayer.togglePlayerState();\n\n// Skip to the next song\nPlayer.skipToNextEntry();\n```\n\n### Retrieving Playback State\nGet the current playback state and listen for changes:\n\n```javascript\nPlayer.getCurrentState().then(state => {\n  console.log('Current Playback State:', state);\n});\n\n// Listen for playback state changes\nconst playbackListener = Player.addListener('onPlaybackStateChange', state => {\n  console.log('New Playback State:', state);\n});\n\n// Don't forget to remove the listener when it's no longer needed\nplaybackListener.remove();\n```\n\n### Managing Event Listeners\nTo maintain optimal performance and prevent memory leaks, it's important to manage your event listeners effectively. Here's how you can add and remove listeners using the `Player` class.\n```javascript\nconst playbackListener = Player.addListener('onPlaybackStateChange', state => {\n  console.log('New Playback State:', state);\n});\n```\n```javascript\n// This will remove all listeners for 'onPlaybackStateChange' event\nPlayer.removeAllListeners('onPlaybackStateChange');\n```\n\n\n### Searching the Catalog\nSearch the Apple Music catalog:\n\n```javascript\nasync function searchCatalog(query) {\n  try {\n    const types = ['songs', 'albums', 'playlists']; // Define the types of items you're searching for. The result will contain items among songs/albums/playlists\n    const results = await MusicKit.catalogSearch(query, types);\n    console.log('Search Results:', results);\n  } catch (error) {\n    console.error('Search failed:', error);\n  }\n}\n```\n\n\n### Getting user's recently played songs, playlists or albums\nGet a list of recently played items:\n\n```javascript\nasync function getTracksFromLibrary() {\n  try {\n    const results = await MusicKit.getTracksFromLibrary();\n    \n    console.log('User`s library Results:', results);\n  } catch (error) {\n    console.error('Getting user tracks failed:', error);\n  }\n}\n```\n\n\n\n### Set a playback Queue\nLoad a system Player with Song, Album, Playlist or Station, using their ID:\n\n```javascript\nasync function setPlaybackQueue() {\n  try {\n    await MusicKit.setPlaybackQueue(\"123456\", \"album\");\n  } catch (error) {\n    console.error('Setting playback queue:', error);\n  }\n}\n```\n\n### Using Hooks\nThe package provides hooks for reactive states in your components:\n\n```javascript\nimport React from 'react';\nimport { View } from 'react-native';\nimport { useCurrentSong, useIsPlaying } from '@lomray/react-native-apple-music';\n\nfunction MusicPlayerComponent() {\n  const { song } = useCurrentSong();\n  const { isPlaying } = useIsPlaying();\n\n  return (\n    <View>\n      {isPlaying ? 'Playing' : 'Paused'} - {currentSong?.title || 'No song playing'}\n    </View>\n  );\n}\n```\n\n## Bugs and feature requests\n\nBug or a feature request, [please open a new issue](https://github.com/Lomray-Software/react-native-apple-music/issues/new).\n\n## License\nMade with 💚\n\nPublished under [Apache License](./LICENSE).\n","readmeFilename":"README.md"}