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

Android: support Background Playback #541

Closed
wants to merge 10 commits into from

Conversation

123mpozzi
Copy link
Contributor

@123mpozzi 123mpozzi commented Oct 23, 2024

Description

Support background playback on Android as well

Changes

  • Use a service to keep the player alive via a strong reference when the app goes into background
    • Update app lifecycle as well, to prevent the playback to automatically pause
    • Update Android's manifest to allow the service to run
  • Support playerConfig.playbackConfig.isBackgroundEnabled on Android as well
  • Introduce a new sample: Background Playback

Testing

Please, if possible, do some manual testing on a physical device 🙏

Things to look for

Background Playback (use the new sample)

  • minimizing the app does not stop the playback
    • when re-opening the app, the player data is synced (e.g. current playback time)

Note: the "Background Playback" sample will destroy the player instance (hence stopping background playback) when going back to the homepage. That is expected, a more complex sample could be published later on.

Activity lifecycle

  • basic samples have no background playback
    • by default
    • after running the new "Background Playback" sample
  • basic samples' playerview works correctly after running the new "Background Playback" sample

Checklist

  • 🗒 CHANGELOG entry

@123mpozzi 123mpozzi self-assigned this Oct 23, 2024
Comment on lines -57 to -62
* {
* playbackConfig: {
* isBackgroundPlaybackEnabled: true,
* }
* })
* },
* });
* ```
* @platform iOS, tvOS
Copy link
Contributor Author

@123mpozzi 123mpozzi Oct 23, 2024

Choose a reason for hiding this comment

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

playbackConfig was missing from here

Comment on lines -50 to +54
* On tvOS, background playback is only supported for audio-only content.
*
* Default is `false`.
*
* @note
* On tvOS, background playback is only supported for audio-only content.
*
Copy link
Contributor Author

@123mpozzi 123mpozzi Oct 23, 2024

Choose a reason for hiding this comment

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

Moved the tvOS-specific paragraph into a note

@123mpozzi
Copy link
Contributor Author

Closing as this is part of #539

@123mpozzi 123mpozzi closed this Oct 25, 2024
@rolandkakonyi rolandkakonyi deleted the feature/android-background-playback branch November 28, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant