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