mirror of
https://github.com/samsonjs/media.git
synced 2026-04-21 13:55:47 +00:00
On Sony Bravia devices check for 4k panel.
Documentation: https://developer.sony.com/develop/tvs/android-tv/design-guide/ On API 23 we should also check Display.Mode (where supported). Issue: #800
This commit is contained in:
parent
952bd4e73c
commit
7905506681
1 changed files with 15 additions and 4 deletions
|
|
@ -55,11 +55,9 @@ public final class VideoFormatSelectorUtil {
|
|||
public static int[] selectVideoFormatsForDefaultDisplay(Context context,
|
||||
List<? extends FormatWrapper> formatWrappers, String[] allowedContainerMimeTypes,
|
||||
boolean filterHdFormats) throws DecoderQueryException {
|
||||
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display display = windowManager.getDefaultDisplay();
|
||||
Point displaySize = getDisplaySize(display);
|
||||
Point viewportSize = getViewportSize(context);
|
||||
return selectVideoFormats(formatWrappers, allowedContainerMimeTypes, filterHdFormats, true,
|
||||
displaySize.x, displaySize.y);
|
||||
viewportSize.x, viewportSize.y);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -184,6 +182,19 @@ public final class VideoFormatSelectorUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static Point getViewportSize(Context context) {
|
||||
// Before API 23 the platform Display object does not provide a way to identify Android TVs that
|
||||
// can show 4k resolution in a SurfaceView, so check for supported devices here.
|
||||
// See also https://developer.sony.com/develop/tvs/android-tv/design-guide/.
|
||||
if (Util.MODEL != null && Util.MODEL.startsWith("BRAVIA")
|
||||
&& context.getPackageManager().hasSystemFeature("com.sony.dtv.hardware.panel.qfhd")) {
|
||||
return new Point(3840, 2160);
|
||||
}
|
||||
|
||||
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
return getDisplaySize(windowManager.getDefaultDisplay());
|
||||
}
|
||||
|
||||
private static Point getDisplaySize(Display display) {
|
||||
Point displaySize = new Point();
|
||||
if (Util.SDK_INT >= 17) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue