mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
Merge pull request #4096 from Isira-Seneviratne/DisplayHelper
Improve DisplayHelper
This commit is contained in:
commit
e59b490ad9
@ -11,12 +11,8 @@ object DisplayHelper {
|
||||
* Returns false on and below SDK 24
|
||||
*/
|
||||
fun supportsHdr(context: Context): Boolean {
|
||||
val displayManager = context.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
||||
val display = displayManager.getDisplay(Display.DEFAULT_DISPLAY)
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
display.hdrCapabilities.supportedHdrTypes.isNotEmpty()
|
||||
} else {
|
||||
false
|
||||
}
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N &&
|
||||
context.getSystemService(DisplayManager::class.java).getDisplay(Display.DEFAULT_DISPLAY)
|
||||
.hdrCapabilities.supportedHdrTypes.isNotEmpty()
|
||||
}
|
||||
}
|
||||
|
@ -59,11 +59,8 @@ object PlayerHelper {
|
||||
* Create a base64 encoded DASH stream manifest
|
||||
*/
|
||||
fun createDashSource(streams: Streams, context: Context, audioOnly: Boolean = false): Uri {
|
||||
val manifest = DashHelper.createManifest(
|
||||
streams,
|
||||
DisplayHelper.supportsHdr(context),
|
||||
audioOnly
|
||||
)
|
||||
val supportsHdr = DisplayHelper.supportsHdr(context)
|
||||
val manifest = DashHelper.createManifest(streams, supportsHdr, audioOnly)
|
||||
|
||||
// encode to base64
|
||||
val encoded = Base64.encodeToString(manifest.toByteArray(), Base64.DEFAULT)
|
||||
|
Loading…
x
Reference in New Issue
Block a user