Skip to content

2.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 07 May 15:19
· 181 commits to main since this release
dd8531e

Player

  • Improved system integration and background playback through custom MediaController and MediaSession classes. Check the documentation for more information.
  • Added a new Player.isAtLiveEdge(Long, Window) method to know if the media is at live edge.
  • New way to load a media from a custom source by providing a custom AssetLoader implementation:
val player = PillarboxExoPlayer(
    context = context,
    mediaSourceFactory = PillarboxMediaSourceFactory(context).apply {
        addAssetLoader(SRGAssetLoader(context)) // Provided by pillarbox-core-business to handled URNs
        addAssetLoader(MyCustomAssetLoader())
    },
)
  • Added new methods to easily manage tracks:
val player: Player = ...
val currentTracks: Tracks = player.currentTracks

val tracks: List<Track> = currentTracks.tracks // Get all the supported tracks
val audioTracks: List<AudioTrack> = currentTracks.audioTracks // Get all the supported audio tracks
val textTracks: List<TextTrack> = currentTracks.textTracks // Get all the supported text tracks
val videoTracks: List<VideoTrack> = currentTracks.videoTracks // Get all the supported video tracks

player.selectTrack(Track) // Select a single track
player.enable<Audio|Text|Video>Track() // Enable a specific type of track
player.disable<Audio|Text|Video>Track() // Disable a specific type of track
player.setAuto<Audio|Text|Video>Track() // Restore the default track of a specific type
  • Added support for blocked segments.
  • Added support for chapters. You can use the following methods to access the corresponding information:
Player.getCurrentChapters(): List<Chapter> // Get all the chapters for the current media
Player.getChapterAtPosition(Long): Chapter? // Get the chapter at the provided position
Player.getCurrentChapterAsFlow(): Flow<Chapter?> // Observe the chapter currently playing as Flow
Player.getCurrentChapterAsState(): State<Chapter?> // Observe the chapter currently playing as State
  • Added support for time intervals (intro/credits). You can use the following methods to access the corresponding information:
Player.getCurrentCredits(): List<Credit> // Get all the credits for the current media (opening credits, closing credits)
Player.getCreditAtPosition(Long): Credit? // Get the credit at the provided position
Player.getCurrentCreditAsFlow(): Flow<Credit?> // Observe the credit currently active as Flow
Player.getCurrentCreditAsState(): State<Credit?> // Observe the credit currently active as State

Core business

  • Extract information about blocked segments, chapters and credits.

Demo

  • The multi-player showcase has been improved to only have one player playing audio at a given time.
  • Added a showcase to toggle repeat mode and to pause the media item when it ends.
  • Added a showcase to display chapters.
  • Added a showcase with a blocked segment.

Breaking changes

  • The mediaItemSource and dataSourceFactory arguments of the DefaultPillarbox constructor have been removed. Please provide a MediaCompositionService directly. The MediaCompositionMediaItemSource class and its related classes have been removed.
  • PillarboxExoPlayer is now a concrete class, while PillarboxPlayer has become an interface. Simply replace your usages of PillarboxPlayer by PillarboxExoPlayer, and PillarboxExoPlayer by PillarboxPlayer:
// Pillarbox 1.0.0
val player: PillarboxExoPlayer = PillarboxPlayer(...)

// Pillarbox 2.0.0
val player: PillarboxPlayer = PillarboxExoPlayer(...)

Note

Following a change in AndroidX Media3 1.3.0, you should setup Java 8 APIs desugaring, by following this guide.
This is new requirement should be reverted in an upcoming version of AndroidX Media3 (see androidx/media#1312 (comment) for more information).
This should be done even if your min SDK version is 24+.

What's Changed

New Contributors

Full Changelog: 1.0.0...2.0.0