-
Notifications
You must be signed in to change notification settings - Fork 13
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
Support Media Controls #554
Merged
123mpozzi
merged 76 commits into
development
from
feature/base-enable-lock-screen-controls
Nov 7, 2024
Merged
Support Media Controls #554
123mpozzi
merged 76 commits into
development
from
feature/base-enable-lock-screen-controls
Nov 7, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As I'll use a base branch and 2 separate PRs instead
To implement lock-screen controls, a player instance must be 'kept alive', so that the player is not garbage-collected or destroyed by the system when the view is destroyed. There are 2 ways to do this: - init the player on the service itself (like in the Android SDK sample) - init the player as usual, and somehow pass it to the service, to store an additional reference This first version implements the second option. The app has 1 strong reference, and the service has 1 strong reference to the player. So that whenever the app dies, the background playback still goes on. Current Issues: - Whenever the app gets back, the player instance should get fetched back as well! - Another limitation with this implementation is that we're calling `setupMediaSession` on `player.ts`'s `inizitalize()`. But when changing sources (e.g. playback view, click back, playback view), the source in the media session does not get overridden with the source from the new view.
Via native by using player module Note: The actual media session module can just be a native one (like offline module) as it is just called via native (player module)
This module will be Android-only.
The old player was not getting destroyed when a new one is being put in charge of the media session
This has to be handled via the activity lifecycle. Took `BackgroundPlaybackScreen` from Android SDK samples as the example Also fix `playerEventRelay` being null in some conditions
As modules represent something native that can be re-used from the JS side, but this is not the case here
Limitation section will need an update once the lock-screen implementation into Android SDK is finished
- NowPlaying info for iOS - MediaSessions for Android
Pair-programming session w Mario Improve general player view and player management Fix: - Restore the correct player from media session - Media Session not getting destroyed as the `@ReactMethod onDestroy()` in `PlayerModule.kt` was nullifying the media session manager inside the promise block. However, the main thread was already killed from JS, so that code was unreached Spot and comment a bug in `PlayerView` creation in Android SDK side
As this config is not existing on Native, we have to set a default value directly here Because it may not be there in the Json
…rols iOS: support Media Controls
…een-controls Android: support Media Controls
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Introduce Media Controls support to control and display the currently-playing media information.
The info is shown in different areas of the system: in the lock-screen, within control-center, and in notifications.
Feature Overview
iOS
Android
How to Configure
Currently it is only possible to enable/disable the feature, and there is no way to customize the widget.
Look at
MediaControlConfig
's documentation for more info.Important
Note that the feature is enabled by default
Changes
Contains:
Checklist
CHANGELOG
entry