Skip to content

[android][audio] Introduce audio playlist support#42937

Merged
alanjhughes merged 1 commit intomainfrom
alanhughes/audio/android-playlist
Feb 19, 2026
Merged

[android][audio] Introduce audio playlist support#42937
alanjhughes merged 1 commit intomainfrom
alanhughes/audio/android-playlist

Conversation

@alanjhughes
Copy link
Copy Markdown
Collaborator

@alanjhughes alanjhughes commented Feb 6, 2026

Why

Adds support for creating audio playlists on android

How

Introduce a new shared object type AudioPlaylist. Exoplayer already has good support for playlists we just need to use the relevant methods.

Test Plan

Bare expo

Copy link
Copy Markdown
Collaborator Author

alanjhughes commented Feb 6, 2026

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Feb 6, 2026
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch 2 times, most recently from 30c2bd7 to 91101cf Compare February 6, 2026 16:07
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch from 32ae329 to 30a187e Compare February 6, 2026 16:07
@expo-bot
Copy link
Copy Markdown
Collaborator

expo-bot commented Feb 6, 2026

The Pull Request introduced fingerprint changes against the base commit: 4b407a7

Fingerprint diff
[
  {
    "op": "changed",
    "beforeSource": {
      "type": "dir",
      "filePath": "../../packages/expo-audio/android",
      "reasons": [
        "expoAutolinkingAndroid"
      ],
      "hash": "f7f53d2eb5fbdbc351ffb6c3cb1dd8273bbb509a"
    },
    "afterSource": {
      "type": "dir",
      "filePath": "../../packages/expo-audio/android",
      "reasons": [
        "expoAutolinkingAndroid"
      ],
      "hash": "b78b71e75b5f288dcb3392b0fcd9780f445b24d6"
    }
  }
]

Generated by PR labeler 🤖

@alanjhughes alanjhughes marked this pull request as ready for review February 10, 2026 12:47
@github-actions
Copy link
Copy Markdown
Contributor

Subscribed to pull request

File Patterns Mentions
packages/expo-audio/** @behenate

Generated by CodeMention

Copy link
Copy Markdown

@unblocked unblocked bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found.

About Unblocked

Unblocked has been set up to automatically review your team's pull requests to identify genuine bugs and issues.

📖 Documentation — Learn more in our docs.

💬 Ask questions — Mention @unblocked to request a review or summary, or ask follow-up questions about your code.

👍 Give feedback — React to comments with 👍 or 👎 to help us improve.

⚙️ Customize — Adjust settings in your preferences.

Comment on lines +348 to +354
override fun sharedObjectDidRelease() {
super.sharedObjectDidRelease()
appContext?.mainQueue?.launch {
playerScope.cancel()
ref.release()
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Player.Listener added in addPlayerListeners() (line 122) is never removed before calling ref.release(). This creates a memory leak because the listener holds a reference to the AudioPlaylist instance, preventing garbage collection.

The same pattern in expo-video (VideoPlayer.kt:360) explicitly stores and removes the listener:

player.removeListener(playerListener)
player.release()

To fix this, store the listener as a property and remove it before release:

private var playerListener: Player.Listener? = null

private fun addPlayerListeners() {
  val listener = object : Player.Listener {
    // ... existing listener implementation ...
  }
  playerListener = listener
  ref.addListener(listener)
}

override fun sharedObjectDidRelease() {
  super.sharedObjectDidRelease()
  appContext?.mainQueue?.launch {
    playerListener?.let { ref.removeListener(it) }
    playerScope.cancel()
    ref.release()
  }
}

@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch from 30a187e to 0865a65 Compare February 10, 2026 16:40
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch from 91101cf to 06d773d Compare February 10, 2026 16:40
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch from 0865a65 to 5d5cd55 Compare February 11, 2026 15:00
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch 2 times, most recently from d9000d9 to 95bb19b Compare February 12, 2026 10:29
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch 2 times, most recently from 015d662 to 0fa113f Compare February 12, 2026 10:37
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch from 95bb19b to 0301384 Compare February 12, 2026 10:37
@psnet
Copy link
Copy Markdown
Contributor

psnet commented Feb 13, 2026

Holy cow! I need this right now!

@alanjhughes

Can playlist's audio files be randomly played? And looped (forever)?

@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch from 0fa113f to 8d7add3 Compare February 16, 2026 14:38
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch 2 times, most recently from 27dd489 to 2810cb8 Compare February 16, 2026 15:35
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch 2 times, most recently from b050c86 to b21c687 Compare February 16, 2026 15:47
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch 2 times, most recently from 57537c2 to a50f495 Compare February 16, 2026 16:41
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch 2 times, most recently from 894341b to 1462a92 Compare February 17, 2026 11:47
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch from a50f495 to d53e5a0 Compare February 17, 2026 11:47
@alanjhughes alanjhughes force-pushed the alanhughes/audio/ios-playlist branch from 1462a92 to 4296b2c Compare February 19, 2026 08:10
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch from d53e5a0 to 27a60de Compare February 19, 2026 08:10
Copy link
Copy Markdown
Collaborator Author

alanjhughes commented Feb 19, 2026

Merge activity

  • Feb 19, 9:41 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 19, 9:44 AM UTC: Graphite rebased this pull request as part of a merge.
  • Feb 19, 9:45 AM UTC: @alanjhughes merged this pull request with Graphite.

@alanjhughes alanjhughes changed the base branch from alanhughes/audio/ios-playlist to graphite-base/42937 February 19, 2026 09:42
@alanjhughes alanjhughes changed the base branch from graphite-base/42937 to main February 19, 2026 09:42
@alanjhughes alanjhughes force-pushed the alanhughes/audio/android-playlist branch from 27a60de to 66a70e7 Compare February 19, 2026 09:43
@expo-bot
Copy link
Copy Markdown
Collaborator

Hi there! 👋 I'm a bot whose goal is to ensure your contributions meet our guidelines.

I've found some issues in your pull request that should be addressed (click on them for more details) 👇

⚠️ Suggestion: Missing changelog entries


Your changes should be noted in the changelog, e.g.:
- [audio] Introduce audio playlist support ([#42937](https://github.com/expo/expo/pull/42937) by [@alanjhughes](https://github.com/alanjhughes))
Read Updating Changelogs guide and consider adding an appropriate entry to the following changelogs:


Generated by ExpoBot 🤖 against 66a70e7

@alanjhughes alanjhughes merged commit cecd645 into main Feb 19, 2026
11 checks passed
@alanjhughes alanjhughes deleted the alanhughes/audio/android-playlist branch February 19, 2026 09:45
benjaminkomen pushed a commit to benjaminkomen/expo that referenced this pull request Feb 25, 2026
# Why
Adds support for creating audio playlists on android

# How
Introduce a new shared object type `AudioPlaylist`. Exoplayer already has good support for playlists we just need to use the relevant methods.

# Test Plan
Bare expo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants