mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-15 23:00:31 +05:30
19 lines
626 B
Kotlin
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()
|
|
}
|
|
}
|