LibreTube/app/src/main/java/com/github/libretube/helpers/DisplayHelper.kt
2023-06-25 05:55:56 +05:30

19 lines
626 B
Kotlin

package com.github.libretube.helpers
import android.content.Context
import android.hardware.display.DisplayManager
import android.os.Build
import android.view.Display
object DisplayHelper {
/**
* Detect whether the device supports HDR as the ExoPlayer doesn't handle it properly
* Returns false on and below SDK 24
*/
fun supportsHdr(context: Context): Boolean {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
context.getSystemService(DisplayManager::class.java).getDisplay(Display.DEFAULT_DISPLAY)
.hdrCapabilities.supportedHdrTypes.isNotEmpty()
}
}