Skip to content
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

Refactor media loading #475

Merged
merged 30 commits into from
Mar 19, 2024
Merged

Refactor media loading #475

merged 30 commits into from
Mar 19, 2024

Conversation

StaehliJ
Copy link
Contributor

Pull request

Description

The goal of this PR is to improve customizability when loading content with Pillarbox. This PR make also more clear where trackers data can be set or not. AssetLoader replace MediaItemSource, integrators have more control of how creating MediaSource, setting up MediaMetadata and trackers data.

Loading SRG content

val mediaItem = SRGMediaItemBuilder(urn).build()
pillarboxPlayer.addItem(mediaItem)

Loading Non SRG content

val mediaItem = MediaItem.fromUri(mediaUri).build()
pillarboxPlayer.addItem(mediaItem)

Custom content

For custom content, there is only one rule, MediaItem.Builder.setUri have to be called.

For example it could be:

val mediaItem = MediaItem.Builder()
    .setUri("custom:id:1234")
    .setMediaId("1234")
.build()
pillarboxPlayer.addItem(mediaItem)

Changes made

  • Remove MediaItemSource replaced by AssetLoader.
  • Tracker data can't be updated during playback.
  • MediaItem.tag is removed when passed to PillarboxPlayer as it is use for internally by trackers.

Checklist

  • Your branch has been rebased onto the main branch.
  • 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).
  • All pull request status checks pass.

@StaehliJ StaehliJ linked an issue Mar 18, 2024 that may be closed by this pull request
3 tasks
Copy link

github-actions bot commented Mar 18, 2024

Code Coverage

Overall Project 55.25% -1.18% 🟢
Files changed 90.63% 🟢

Module Coverage
:pillarbox-core-business 84.74% -1.91% 🟢
:pillarbox-player 73.15% -1.99% 🟢
Files
Module File Coverage
:pillarbox-core-business HttpMediaCompositionService.kt 100% 🟢
SRGEventLoggerTracker.kt 100% 🟢
MediaUrn.kt 100% 🟢
ImageScalingService.kt 100% 🟢
ResourceSelector.kt 100% 🟢
AkamaiTokenDataSource.kt 100% 🟢
DefaultMediaMetaDataProvider.kt 98.84% -1.16% 🟢
SRGMediaItemBuilder.kt 97.78% -2.22% 🟢
CommandersActTracker.kt 97.1% 🟢
SRGAssetLoader.kt 87.04% -12.96% 🟢
ComScoreTracker.kt 81.31% 🟢
DefaultPillarbox.kt 57.84% -8.82% 🟢
:pillarbox-player AssetLoader.kt 100% 🟢
Asset.kt 100% 🟢
MediaItemTracker.kt 100% 🟢
CurrentMediaItemTracker.kt 95.51% -2.47% 🟢
MediaItemTrackerData.kt 94.26% 🟢
UrlAssetLoader.kt 92.41% -7.59% 🟢
PillarboxMediaSource.kt 90.94% -0.67% 🟢
PillarboxPlayer.kt 68.89% -0.83% 🟢
PillarboxMediaSourceFactory.kt 53.46% -46.54% 🟢

Copy link
Member

@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.

I've pushed some documentation/naming changes, otherwise, it looks good 👍🏻

@StaehliJ StaehliJ added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 21b35c7 Mar 19, 2024
10 checks passed
@StaehliJ StaehliJ deleted the improve-media-source branch March 19, 2024 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring SRG content loading
2 participants