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

docs(guides): add an Expo guide #2296

Merged
merged 5 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions docs/docs/basics/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,4 @@ You can now use React Native Track Player with Expo.

Please be aware that while many people are using React Native Track Player with Expo successfully, the current maintainers of this project do not use Expo and their ability to resolve issues involving Expo is limited.

To get started, create a [custom development client](https://docs.expo.dev/clients/getting-started/) for your Expo app and then install React Native Track Player.

Here is the configuration required for audio playback in background:

- [iOS: Enable audio playback in background via your app.json](https://docs.expo.dev/versions/latest/sdk/audio/#playing-or-recording-audio-in-background)
- [Android: Stop playback when the app is closed](./background-mode.md/#android)
For more information, see [Developing with Expo](../guides/with-expo.md).
70 changes: 70 additions & 0 deletions docs/docs/guides/with-expo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
sidebar_position: 98
---


# Developing with Expo

Expo is a popular development platform in the react-native ecosystem.
dctalbot marked this conversation as resolved.
Show resolved Hide resolved

Please be aware that while many people are using React Native Track Player with Expo successfully, the current maintainers of this project do not use Expo and their ability to resolve issues involving Expo is limited.


## Development Build

A [Dev Client](https://docs.expo.dev/more/glossary-of-terms/#dev-clients) is required in order to use this package (Expo Go is not supported).

To get started, create a [development build](https://docs.expo.dev/clients/getting-started/) for your Expo app and then install React Native Track Player.


## Custom Entry Point

In order to configure the Playback Service within the [entry point](https://docs.expo.dev/more/glossary-of-terms/#entry-point), you will need to [create a custom entry point](https://docs.expo.dev/guides/monorepos/#change-default-entrypoint) and adjust the `package.json` configuration.

By default, Expo points to an entry point in the `node_modules` folder. The path for this is configured in the `"main"` field of `package.json`. To create a new entry point:

1. Copy the default one

```
cp node_modules/expo/AppEntry.js AppEntry.js
```

2. Update the `"main"` field of `package.json` to reference the new file e.g. `"AppEntry.js"`
3. Edit the new file to have it import your app code, and configure the Playback Service.


## Streaming HTTP

On newer versions of Android, HTTP streaming is disallowed by default (HTTPS is OK). However, it is only disallowed in production builds which can make this issue hard to diagnose.

To allow HTTP, you must first install the [`expo-build-properties` package](https://docs.expo.dev/versions/latest/sdk/build-properties).

```
expo install expo-build-properties
```

Then add this configuration in `app.json`:

```json
...
"plugins": [
[
"expo-build-properties",
{
"android": {
"usesCleartextTraffic": true
}
}
]
]
...
```

## Background Audio

Here is the configuration required for audio playback in background:

- [iOS: Enable audio playback in background via your app.json](https://docs.expo.dev/versions/latest/sdk/audio/#playing-or-recording-audio-in-background)
- [Android: Stop playback when the app is closed](../basics/background-mode.md/#android)


Loading