Skip to content

Use media3 surface#1168

Merged
StaehliJ merged 29 commits intomainfrom
use-media3-surface
Jan 16, 2026
Merged

Use media3 surface#1168
StaehliJ merged 29 commits intomainfrom
use-media3-surface

Conversation

@StaehliJ
Copy link
Contributor

@StaehliJ StaehliJ commented Sep 19, 2025

Description

The goal of this PR is to use the composable PlayerSurface provided by Media3.

Sample

@Composable
fun PlayerView(player: PillarboxPlayer?) {
    PlayerFrame(
        contentScale = ContentScale.Fit,
        player = player, 
        modifier = Modifier
            .fillMaxSize()
            .background(color = Color.Black),
        surface = {
            // Draw on top of the video
            Box(modifier = Modifier.fillMaxSize().background(color = Color.Black.copy(alpha = 0.5f)))
        },
        shutter = {
            // Draw when no video is playing or when the player is loading.
            Box(modifier = Modifier.fillMaxSize().background(color = Color.Black)){
                Artwork(...)   
            }
        },
        subtitle = {
           if(this.contentScale == SubtitleContentScale.Fill) {
               // ...
           }
            PlayerSubtitle(
                player = player,
            )
        }) {
        PlayerControls(player = player, modifier = Modifier
            .fillMaxSize()
            .align(Alignment.Center))
    }
}

Changes made

  • Add PlayerFrame to improve player implementation experience
  • Improve subtitles handling with a new composable function PlayerSubtitle
  • Mark depreciated old views PlayerSurface and ExoPlayerSubtitleView

Checklist

  • APIs have been properly documented (if relevant).
  • The documentation has been updated (if relevant).
  • New unit tests have been written (if relevant).
  • The demo has been updated (if relevant).

@github-actions
Copy link

github-actions bot commented Sep 19, 2025

Code Coverage

Overall Project 44.66% -4.88% 🟢
Files changed 4.59% 🟢

Module Coverage
:pillarbox-player 57.57% -0.16% 🟢
:pillarbox-ui 2.59% -28.32% 🟢
Files
Module File Coverage
:pillarbox-player PillarboxMediaDescriptionAdapter.kt 92.89% 🟢
PillarboxExoPlayer.kt 88.1% -0.53% 🟢
PillarboxPreloadManager.kt 86.67% 🟢
PillarboxBuilder.kt 82.85% 🟢
PillarboxLoadControl.kt 80% -3.78% 🟢
PlayerCallbackFlow.kt 65.59% 🟢
PillarboxMediaController.kt 0% -0.91% 🟢
:pillarbox-ui PlayerSurface.kt 0.5% 🟢
PillarboxPlayerSurface.kt 0% 🟢
PlayerFrame.kt 0% 🟢
SurfaceType.kt 0% 🟢
PlayerSubtitle.kt 0% 🟢
AndroidPlayerSurfaceView.kt 0% -0.92% 🟢
DebugPlayerView.kt 0% 🟢
ImageProgressTrackerState.kt 0% -1.75% 🟢
ExoplayerSubtitleView.kt 0% -3.47% 🟢

@StaehliJ StaehliJ requested a review from waliid December 1, 2025 13:52
@StaehliJ StaehliJ enabled auto-merge January 16, 2026 07:13
@StaehliJ StaehliJ added this pull request to the merge queue Jan 16, 2026
Merged via the queue into main with commit 1efc6f3 Jan 16, 2026
20 of 21 checks passed
@StaehliJ StaehliJ deleted the use-media3-surface branch January 16, 2026 07:33
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Pillarbox Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants