Skip to content

Commit

Permalink
android tv hls playback direct play fix (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz authored and nielsvanvelzen committed Feb 5, 2024
1 parent 667325f commit 4214e36
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/src/main/java/org/jellyfin/androidtv/constant/Codec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ object Codec {
const val ASF = "asf"
const val AVI = "avi"
const val DVR_MS = "dvr-ms"
const val HLS = "hls"
const val M2V = "m2v"
const val M4V = "m4v"
const val MKV = "mkv"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/java/org/jellyfin/androidtv/util/DeviceUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ object DeviceUtils {
private const val FIRE_TV_MODEL_GEN_2 = "AFTS"
private const val FIRE_TV_MODEL_GEN_3 = "AFTN"

// Fire TV 4k Models
private const val Toshiba_4K_2022 = "AFTHA004" //Toshiba 4K UHD - Fire TV (2022)
private const val Hisense_4K_2022 = "AFTHA001" //Hisense U6 4K UHD - Fire TV (2022), Toshiba 4K UHD - Fire TV (2021)
private const val Toshiba_4K_2021 = "AFTHA003" //Toshiba 4K Far-field UHD - Fire TV (2021)

// Nvidia Shield TV Model
private const val SHIELD_TV_MODEL = "SHIELD Android TV"
private const val UNKNOWN = "Unknown"
Expand All @@ -33,6 +38,9 @@ object DeviceUtils {

@JvmStatic val isChromecastWithGoogleTV: Boolean get() = getBuildModel() == CHROMECAST_GOOGLE_TV
@JvmStatic val isFireTv: Boolean get() = getBuildModel().startsWith(FIRE_TV_PREFIX)
@JvmStatic val isFireTv4k: Boolean get() = getBuildModel() in listOf(Toshiba_4K_2022,
Hisense_4K_2022,
Toshiba_4K_2021)
@JvmStatic val isFireTvStickGen1: Boolean get() = getBuildModel() == FIRE_STICK_MODEL_GEN_1
@JvmStatic val isFireTvStick4k: Boolean get() = getBuildModel() in listOf(FIRE_STICK_4K_MODEL, FIRE_STICK_4K_MAX_MODEL)
@JvmStatic val isShieldTv: Boolean get() = getBuildModel() == SHIELD_TV_MODEL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class ExoPlayerProfile(
Codec.Container.OGM,
Codec.Container.OGV,
Codec.Container.MP4,
Codec.Container.WEBM
Codec.Container.WEBM,
Codec.Container.TS,
Codec.Container.HLS
).joinToString(",")

videoCodec = arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ object ProfileHelper {
when {
// https://developer.amazon.com/docs/fire-tv/device-specifications.html
DeviceUtils.isFireTvStick4k -> H264_LEVEL_5_2
DeviceUtils.isFireTv4k -> H264_LEVEL_5_2
DeviceUtils.isFireTv -> H264_LEVEL_4_1
DeviceUtils.isShieldTv -> H264_LEVEL_5_2
else -> H264_LEVEL_5_1
Expand Down
8 changes: 8 additions & 0 deletions app/src/test/kotlin/util/DeviceUtilsTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ class DeviceUtilsTests : FunSpec({
}
}

test("DeviceUtils.isFireTv4k() works correctly") {
arrayOf("AFTHA001", "AFTHA004").forEach { input ->
withBuildModel(input) {
DeviceUtils.isFireTv4k shouldBe true
}
}
}

test("DeviceUtils.has4kVideoSupport() works correctly") {
arrayOf("AFTM", "AFTT", "AFTSSS", "AFTSS", "AFTB", "AFTS").forEach { input ->
withBuildModel(input) {
Expand Down

0 comments on commit 4214e36

Please sign in to comment.