Skip to content

Conversation

@StaehliJ
Copy link
Contributor

@StaehliJ StaehliJ commented Nov 1, 2024

Pull request

Description

The goal of this PR is to introduce "thumbnail" seeking to Pillarbox. DASH stream may have image track to display Bitmap image in a [ImageOutput] set on the player [player.setImageOutput].

CoreBusiness also provide SpriteSheet within Chapter. The idea here is to have exactly the same behavior with external sprite sheet than it was inside a dash stream.

Integrators can customize the way Bitmap are loaded from a SpriteSheet, for example with Coil:

val player = PillarboxExoPlayer(application) {
        srgAssetLoader(application) {
            spriteSheetLoader { spriteSheet, onComplete ->
                val request = ImageRequest.Builder(application)
                    .data(spriteSheet.url)
                    .scale(Scale.FILL) // FILL to have the source image size!
                    .allowConversionToBitmap(enable = true)
                    .target { result ->
                        val bitmap = (result as BitmapDrawable).bitmap
                        onComplete(bitmap)
                    }
                    .build()
                imageLoader.enqueue(request)
            }
        }
    }

Changes made

  • Add [ImageOutpt] to the [SmoothSeekingState].
  • Add a demo illustrating how to use thumbnails.
  • CoreBusiness parse Chapter SpriteSheets and set them to the player.

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 Nov 1, 2024

Code Coverage

Overall Project 48.11% -1.08% 🟢
Files changed 56.45% 🟢

Module Coverage
:pillarbox-core-business 81.28% -4.23% 🟢
:pillarbox-player 55.55% -0.02% 🟢
:pillarbox-ui 0.2% -1.04% 🟢
Files
Module File Coverage
:pillarbox-core-business SpriteSheetLoader.kt 100% 🟢
SpriteSheetMediaSource.kt 96.61% -3.39% 🟢
SRGAssetLoader.kt 89.44% 🟢
SRGAssetLoaderConfig.kt 83.33% -2.27% 🟢
SpriteSheet.kt 78.95% -21.05% 🟢
Chapter.kt 59.32% 🟢
SpriteSheetMediaPeriod.kt 39.24% -60.76% 🟢
:pillarbox-player Tracks.kt 93.67% -3.8% 🟢
:pillarbox-ui SmoothProgressTrackerState.kt 0% -38.12% 🟢

@StaehliJ StaehliJ requested a review from MGaetan89 November 20, 2024 10:44
@MGaetan89 MGaetan89 linked an issue Nov 20, 2024 that may be closed by this pull request
Copy link
Contributor

@MGaetan89 MGaetan89 left a comment

Choose a reason for hiding this comment

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

Looks good!

The tests were failing because of a timeout caused by the loading of the sprite sheet. I've added a way to disable it. Please have a look before merging: 13e2846

@StaehliJ StaehliJ added this pull request to the merge queue Nov 22, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 22, 2024
@MGaetan89 MGaetan89 added this pull request to the merge queue Nov 22, 2024
Merged via the queue into main with commit 19f9f03 Nov 22, 2024
9 checks passed
@MGaetan89 MGaetan89 deleted the sprite-sheet branch November 22, 2024 16:29
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.

SpriteSheet

2 participants