Skip to content

3.0.0

Compare
Choose a tag to compare
@github-actions github-actions released this 19 Nov 08:50
· 52 commits to main since this release
3.0.0
3f6e6e1

New features

Playback monitoring

Pillarbox records various metrics related to playback performance (bitrate, stalls, playback duration, ...).
You can retrieve these values by using the following:

val player = PillarboxExoPlayer(context)
player.getCurrentMetrics() // Get the current PlaybackMetrics
player.currentMetricsAsFlow() // Get PlaybackMetrics as a Flow
player.getPeriodicallyCurrentMetricsAsState() // Get PlaybackMetrics as a Compose State

By default, these metrics are sent to a Pillarbox monitoring service when using PillarboxExoPlayer from pillarbox-core-business, or discarded when using PillarboxExoPlayer from pillarbox-player. You can customize this by doing:

val player = PillarboxExoPlayer(context) {
    // Disable monitoring handling
    disableMonitoring()
    // Output metrics to Logcat
    monitoring(Logcat)
    // Send metrics to a remote server
    monitoring(Remote) {
        config(endpointUrl = "...")
    }
}

Improved block reason support

The BlockReasonException is now a sealed class, possibly containing more information about a specific error.

val error = player.playerError
when (error) {
    is BlockReasonException.GeoBlock -> TODO("This chapter is geo-blocked")
    is BlockReasonException.StartDate -> TODO("This chapter will be available on ${error.instant}")
    is BlockReasonException.EndDate -> TODO("This chapter is no longer available since ${error.instant}")
    // Handle other types...
}

Customize the surface type used by the player

When using PlayerSurface from pillarbox-ui, you can now specify the type of surface you want to use:

PlayerSurface(
    player = player,
    surfaceType = SurfaceType.Surface, // Or `Texture` or `Spherical`
)

See SurfaceType for more information.

Other features

  • Pillarbox API documentation is now available online.
  • Chapters are available in the media item metadata. You can get them using MediaItem.mediaMetadata.chapters.
  • Credits are available in the media item metadata. You can get them using MediaItem.mediaMetadata.credits.
  • MediaItem.tag is no longer reserved for Pillarbox usage.
  • Introduce PillarboxPreloadManager helper for Media3 PreloadManager. Note that these APIs are incubating on Media3 side and will change in future versions.

Breaking changes

Introduce a DSL to create a player

The PillarboxExoPlayer constructor and the DefaultPillarbox have been removed.
Instead, you can use the PillarboxExoPlayer builder function, which comes in two variants:

  • PillarboxExoPlayer from pillarbox-player: closely matches a default ExoPlayer, with Pillarbox monitoring disabled.
  • PillarboxExoPlayer from pillarbox-core-business: suited for the SRG SSR needs, i.e. it can play URN and sends playback metrics to Pillarbox monitoring.
val player = PillarboxExoPlayer(context, Default) // from pillarbox-player
val srgPlayer = PillarboxExoPlayer(context) // from pillarbox-core-business

You can customize the player during creation:

val player = PillarboxExoPlayer(context) {
    addAssetLoader(CustomAssetLoader())
    seekBackwardIncrement(5.seconds)
    seekForwardIncrement(10.seconds)
}

Removal of deprecated symbols

Symbol Replacement Comment
MediaItemUrn SRGMediaItemBuilder
Player.disableTextTrack() Player.disableTextTrack() Use the extension from ch.srgssr.pillarbox.player.tracks instead
Player.setDefaultTextTrack() Player.setAutoTextTrack()
Player.disableAudioTrack() Player.disableAudioTrack() Use the extension from ch.srgssr.pillarbox.player.tracks instead
Player.setDefaultAudioTrack() Player.setAutoAudioTrack()
Tracks.text Tracks.textTracks
Tracks.audio Tracks.audioTracks
Tracks.video Tracks.videoTracks

Others breaking changes

  • Remove DefaultHttpClient. Use PillarboxHttpClient instead.

What's Changed

Full Changelog: 2.3.0...3.0.0