Skip to content

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. The API 34 workaround still have to be done to work well.

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 = {
            PlayerSubtitle(
                player = player, videoSizeDp = videoSizeDp, videoContentScale = contentScale,
            )
        }) {
        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.96% -6.27% 🟢
Files changed 0.35% 🟢

Module Coverage
:pillarbox-player 56.22% -0.05% 🟢
:pillarbox-ui 2.6% -33.95% 🟢
Files
Module File Coverage
:pillarbox-player PillarboxExoPlayer.kt 75.83% -1.06% 🟢
:pillarbox-ui PlayerSurface.kt 1.63% 🟢
PillarboxPlayerSurface.kt 1.26% -98.74% 🟢
PlayerFrame.kt 0% 🟢
SurfaceType.kt 0% 🟢
PlayerSubtitle.kt 0% 🟢
SurfaceViewWithApi34WorkAround.kt 0% 🟢
AndroidPlayerSurfaceView.kt 0% -0.92% 🟢
DebugPlayerView.kt 0% 🟢
ExoplayerSubtitleView.kt 0% -3.47% 🟢

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

Labels

None yet

Projects

Status: 📋 Backlog

Development

Successfully merging this pull request may close these issues.

1 participant