Skip to content

feat: Migrate from the old exoPlayer to the new Media3#1470

Open
tevincent wants to merge 96 commits into
mainfrom
player-background-rebased
Open

feat: Migrate from the old exoPlayer to the new Media3#1470
tevincent wants to merge 96 commits into
mainfrom
player-background-rebased

Conversation

@tevincent

@tevincent tevincent commented Oct 17, 2024

Copy link
Copy Markdown
Contributor

depends on #1583

  • Add the possibility to play media in the background
  • Handle subtitles if any are present
new_player.mp4

@tevincent tevincent marked this pull request as draft October 17, 2024 05:55
@tevincent tevincent force-pushed the player-background-rebased branch from 81dd46a to 7ef2289 Compare October 21, 2024 07:16
@sonarqubecloud

Copy link
Copy Markdown

@tevincent tevincent force-pushed the player-background-rebased branch from 7ef2289 to bc2786e Compare January 22, 2025 14:32
@tevincent tevincent force-pushed the player-background-rebased branch from b0a38a0 to 4e08fb9 Compare February 6, 2025 09:42
@tevincent tevincent changed the title Migrate from the old exoPlayer to the new Media3 and add the possibility to play media in the background #1367 feat: Migrate from the old exoPlayer to the new Media3 and add the possibility to play media in the background #1367 Feb 7, 2025
@tevincent tevincent marked this pull request as ready for review February 7, 2025 10:31
@tevincent tevincent force-pushed the player-background-rebased branch 2 times, most recently from a7c3e47 to b8cbe3e Compare February 7, 2025 10:35
@tevincent tevincent marked this pull request as draft February 7, 2025 12:18
@tevincent tevincent force-pushed the player-background-rebased branch from e9b974d to a111513 Compare February 25, 2025 12:28
@tevincent tevincent force-pushed the player-background-rebased branch 7 times, most recently from 026d15f to d8d3b47 Compare March 12, 2025 12:00
@tevincent tevincent marked this pull request as ready for review March 13, 2025 07:20
@tevincent tevincent added the rebase Add this label to rebase the PR label Mar 13, 2025
@github-actions github-actions Bot removed the rebase Add this label to rebase the PR label Mar 13, 2025
@tevincent tevincent force-pushed the player-background-rebased branch 3 times, most recently from 68b9f4c to f415a6a Compare March 19, 2025 08:21
@Infomaniak Infomaniak deleted a comment from sonarqubecloud Bot Mar 19, 2025
@tevincent tevincent added the rebase Add this label to rebase the PR label Mar 24, 2025
@github-actions github-actions Bot removed the rebase Add this label to rebase the PR label Mar 24, 2025
@KevinBoulongne KevinBoulongne force-pushed the player-background-rebased branch from f415a6a to 860df34 Compare March 24, 2025 15:49
@tevincent tevincent force-pushed the player-background-rebased branch from 860df34 to f415a6a Compare March 25, 2025 08:48
@sonarqubecloud

sonarqubecloud Bot commented Nov 6, 2025

Copy link
Copy Markdown

# Conflicts:
#	app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewVideoFragment.kt
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates in-app media playback from legacy ExoPlayer (2.x) to AndroidX Media3, introducing a dedicated playback flow that supports background audio (via MediaSessionService) and video playback in a separate PIP-capable activity.

Changes:

  • Replace legacy com.google.android.exoplayer2 dependencies with androidx.media3 modules (ExoPlayer/UI/OkHttp datasource/session).
  • Introduce PreviewPlaybackFragment + PlaybackService/MediaSession infrastructure for background media controls.
  • Add VideoActivity for video playback with Picture-in-Picture support, and route preview video/audio to the new playback fragment.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
gradle/libs.versions.toml Swap legacy ExoPlayer coordinates for Media3 artifacts in version catalog.
app/build.gradle.kts Update app dependencies to Media3 modules (dash/ui/datasource/session).
app/src/main/AndroidManifest.xml Declare PIP VideoActivity, Media3 PlaybackService, and media playback foreground service permission.
app/src/main/res/navigation/main_navigation.xml Add Navigation destination + SafeArgs for VideoActivity with fileId.
app/src/main/res/layout/fragment_preview_playback.xml Replace legacy player view with Media3 PlayerView.
app/src/main/res/layout/activity_video.xml New layout for dedicated video/PIP activity using Media3 PlayerView.
app/src/main/java/com/infomaniak/drive/utils/Extensions.kt Add helper to exclude activities from recents.
app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt Bring VideoActivity to front when returning from PIP.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewSliderAdapter.kt Route VIDEO/AUDIO previews to the new PreviewPlaybackFragment.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewVideoFragment.kt Remove legacy ExoPlayer video preview implementation.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/PreviewMusicFragment.kt Remove legacy audio preview subclass.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/PreviewPlaybackFragment.kt New unified Media3 playback fragment + video handoff to VideoActivity.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/VideoActivity.kt New Media3-based video activity with PIP handling.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/PlaybackUtils.kt Centralize player/session/controller creation, media item creation, and PIP params.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/PlaybackService.kt New MediaSessionService for background playback + notification controls.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/PlaybackViewModel.kt Load file/offline state for VideoActivity playback.
app/src/main/java/com/infomaniak/drive/ui/fileList/preview/playback/PlayerListener.kt Media3 player listener for analytics + error forwarding.
app/src/main/java/com/infomaniak/drive/ui/BasePreviewSliderFragment.kt Track playback positions across swipes and release player resources on destroy.
app/src/main/java/com/infomaniak/drive/MainApplication.kt Track whether VideoActivity is currently in PIP mode.
app/src/main/java/com/infomaniak/drive/data/models/File.kt Add isVideo() helper used by the new playback flow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/java/com/infomaniak/drive/utils/Extensions.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/ui/BasePreviewSliderFragment.kt Outdated
Comment thread app/src/main/java/com/infomaniak/drive/ui/MainActivity.kt
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new functionality is added to the product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants