diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 8f16c47c1..3c3e2a88d 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -5,8 +5,7 @@ androidx-activity = "1.9.0"
androidx-annotation = "1.8.0"
androidx-compose = "2024.06.00"
androidx-core = "1.13.1"
-androidx-fragment = "1.8.1"
-androidx-leanback = "1.0.0"
+androidx-fragment = "1.8.2"
androidx-lifecycle = "2.8.3"
androidx-media3 = "1.4.0"
androidx-navigation = "2.7.7"
@@ -99,7 +98,6 @@ androidx-media3-common = { group = "androidx.media3", name = "media3-common", ve
androidx-media3-datasource = { group = "androidx.media3", name = "media3-datasource", version.ref = "androidx-media3" }
androidx-media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "androidx-media3" }
androidx-media3-ui = { group = "androidx.media3", name = "media3-ui", version.ref = "androidx-media3" }
-androidx-media3-ui-leanback = { group = "androidx.media3", name = "media3-ui-leanback", version.ref = "androidx-media3" }
androidx-media3-dash = { group = "androidx.media3", name = "media3-exoplayer-dash", version.ref = "androidx-media3" }
androidx-media3-hls = { group = "androidx.media3", name = "media3-exoplayer-hls", version.ref = "androidx-media3" }
androidx-media3-session = { group = "androidx.media3", name = "media3-session", version.ref = "androidx-media3" }
@@ -129,7 +127,6 @@ androidx-compose-material-icons-core = { module = "androidx.compose.material:mat
androidx-compose-material-icons-extended = { module = "androidx.compose.material:material-icons-extended" }
androidx-compose-runtime = { module = "androidx.compose.runtime:runtime" }
androidx-compose-runtime-saveable = { module = "androidx.compose.runtime:runtime-saveable" }
-leanback = { group = "androidx.leanback", name = "leanback", version.ref = "androidx-leanback" }
androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" }
diff --git a/pillarbox-demo-tv/build.gradle.kts b/pillarbox-demo-tv/build.gradle.kts
index 83f124995..e627994eb 100644
--- a/pillarbox-demo-tv/build.gradle.kts
+++ b/pillarbox-demo-tv/build.gradle.kts
@@ -30,14 +30,10 @@ dependencies {
implementation(libs.androidx.compose.ui.unit)
implementation(libs.androidx.compose.ui.util)
implementation(libs.androidx.core)
- implementation(libs.androidx.fragment)
- implementation(libs.androidx.lifecycle.common)
implementation(libs.androidx.lifecycle.runtime)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.media3.common)
- implementation(libs.androidx.media3.exoplayer)
- implementation(libs.androidx.media3.ui.leanback)
implementation(libs.androidx.navigation.common)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.navigation.runtime)
@@ -49,7 +45,6 @@ dependencies {
implementation(libs.coil.base)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.core)
- implementation(libs.leanback)
implementation(libs.srg.data)
implementation(libs.srg.dataprovider.retrofit)
diff --git a/pillarbox-demo-tv/src/main/AndroidManifest.xml b/pillarbox-demo-tv/src/main/AndroidManifest.xml
index d937ec405..40291e0f5 100644
--- a/pillarbox-demo-tv/src/main/AndroidManifest.xml
+++ b/pillarbox-demo-tv/src/main/AndroidManifest.xml
@@ -26,9 +26,7 @@
-
+
diff --git a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/PlayerActivity.kt b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/PlayerActivity.kt
index 676d5563c..b12940979 100644
--- a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/PlayerActivity.kt
+++ b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/PlayerActivity.kt
@@ -74,7 +74,7 @@ class PlayerActivity : ComponentActivity() {
private const val ARG_ITEM = "demo_item"
/**
- * Start player with Leanback fragment.
+ * Start player.
*
* @param context
* @param demoItem The item to play.
diff --git a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerActivity.kt b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerActivity.kt
deleted file mode 100644
index 5a81df361..000000000
--- a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerActivity.kt
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) SRG SSR. All rights reserved.
- * License information is available from the LICENSE file.
- */
-package ch.srgssr.pillarbox.demo.tv.ui.player.leanback
-
-import android.app.Activity
-import android.content.Intent
-import android.os.Bundle
-import androidx.core.content.IntentCompat
-import androidx.fragment.app.FragmentActivity
-import ch.srgssr.pillarbox.demo.shared.data.DemoItem
-import ch.srgssr.pillarbox.demo.tv.R
-
-/**
- * Player activity using Android Leanback.
- *
- * Leanback is no more update by google and very complicated to implement.
- * This demo just show how to integrate Leanback with Pillarbox.
- */
-class LeanbackPlayerActivity : FragmentActivity() {
-
- private lateinit var leanbackPlayerFragment: LeanbackPlayerFragment
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- setContentView(R.layout.activity_leanback_player)
- leanbackPlayerFragment = supportFragmentManager.findFragmentById(R.id.fragment_container) as LeanbackPlayerFragment
- val demoItem = IntentCompat.getSerializableExtra(intent, ARG_ITEM, DemoItem::class.java)
- demoItem?.let {
- leanbackPlayerFragment.setDemoItem(it)
- }
- }
-
- companion object {
- private const val ARG_ITEM = "demo_item"
-
- /**
- * Start player with Leanback fragment.
- *
- * @param context
- * @param demoItem The item to play.
- */
- fun startPlayer(context: Activity, demoItem: DemoItem) {
- val intent = Intent(context, LeanbackPlayerActivity::class.java)
- intent.putExtra(ARG_ITEM, demoItem)
- context.startActivity(intent)
- }
- }
-}
diff --git a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerFragment.kt b/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerFragment.kt
deleted file mode 100644
index 93702e646..000000000
--- a/pillarbox-demo-tv/src/main/java/ch/srgssr/pillarbox/demo/tv/ui/player/leanback/LeanbackPlayerFragment.kt
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) SRG SSR. All rights reserved.
- * License information is available from the LICENSE file.
- */
-package ch.srgssr.pillarbox.demo.tv.ui.player.leanback
-
-import android.os.Bundle
-import androidx.leanback.app.VideoSupportFragment
-import androidx.leanback.app.VideoSupportFragmentGlueHost
-import androidx.leanback.media.PlaybackGlue
-import androidx.leanback.media.PlaybackTransportControlGlue
-import androidx.leanback.widget.PlaybackSeekDataProvider
-import androidx.lifecycle.Lifecycle
-import androidx.lifecycle.flowWithLifecycle
-import androidx.lifecycle.lifecycleScope
-import androidx.lifecycle.repeatOnLifecycle
-import androidx.media3.common.Player
-import androidx.media3.ui.leanback.LeanbackPlayerAdapter
-import ch.srgssr.pillarbox.core.business.SRGErrorMessageProvider
-import ch.srgssr.pillarbox.demo.shared.data.DemoItem
-import ch.srgssr.pillarbox.demo.shared.di.PlayerModule
-import ch.srgssr.pillarbox.player.PillarboxExoPlayer
-import ch.srgssr.pillarbox.player.currentMediaMetadataAsFlow
-import ch.srgssr.pillarbox.player.extension.setHandleAudioFocus
-import kotlinx.coroutines.flow.collectLatest
-import kotlinx.coroutines.launch
-
-private const val UpdateInterval = 1_000
-
-/**
- * Leanback player fragment
- *
- * A simple leanback player sample.
- * Lot of work is still needed to have a good player experience.
- */
-class LeanbackPlayerFragment : VideoSupportFragment() {
- private lateinit var player: PillarboxExoPlayer
-
- /**
- * Set demo item to [PillarboxExoPlayer]
- *
- * @param demoItem
- */
- fun setDemoItem(demoItem: DemoItem) {
- player.setMediaItem(demoItem.toMediaItem())
- }
-
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
- player = PlayerModule.provideDefaultPlayer(requireContext()).apply {
- prepare()
- setHandleAudioFocus(true)
- }
- val playerGlue = PlaybackTransportControlGlue(
- requireActivity(),
- LeanbackPlayerAdapter(
- requireActivity(),
- player,
- UpdateInterval
- ).apply {
- setErrorMessageProvider(SRGErrorMessageProvider(requireContext()))
- }
- )
- playerGlue.host = VideoSupportFragmentGlueHost(this)
- playerGlue.addPlayerCallback(object : PlaybackGlue.PlayerCallback() {
- override fun onPreparedStateChanged(glue: PlaybackGlue) {
- if (glue.isPrepared) {
- playerGlue.seekProvider = PlaybackSeekDataProvider()
- playerGlue.play()
- }
- }
- })
- lifecycleScope.launch {
- lifecycle.repeatOnLifecycle(Lifecycle.State.CREATED) {
- player.currentMediaMetadataAsFlow().flowWithLifecycle(lifecycle).collectLatest {
- playerGlue.subtitle = it.title
- playerGlue.title = it.subtitle
- }
- }
- }
- }
-
- override fun onResume() {
- super.onResume()
- if (player.playerError == null || player.playbackState == Player.STATE_ENDED) {
- player.seekToDefaultPosition()
- player.prepare()
- }
- player.play()
- }
-
- override fun onPause() {
- super.onPause()
- player.pause()
- }
-
- override fun onDestroy() {
- super.onDestroy()
- player.release()
- }
-}
diff --git a/pillarbox-demo-tv/src/main/res/layout/activity_leanback_player.xml b/pillarbox-demo-tv/src/main/res/layout/activity_leanback_player.xml
deleted file mode 100644
index ea9125ddb..000000000
--- a/pillarbox-demo-tv/src/main/res/layout/activity_leanback_player.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
diff --git a/pillarbox-demo-tv/src/main/res/values/themes.xml b/pillarbox-demo-tv/src/main/res/values/themes.xml
index 38f0c1eda..43651076a 100644
--- a/pillarbox-demo-tv/src/main/res/values/themes.xml
+++ b/pillarbox-demo-tv/src/main/res/values/themes.xml
@@ -4,5 +4,5 @@
-->
-
+