GÜNCELLEME: Bu ExoPlayer 1.5.1 itibariyle giderildi (bkz https://github.com/google/ExoPlayer/commit/79055066813123c939c29e5a5e223a5ff043b91e)
Ben ExoPlayer en geliştiriciler ile takip ve cevap buldu:
güvenilir 4K cihazları tespit etmenin tek yolu sadece api 23+ seviyesinde bulunan Device.Mode
kullanıyor. burada olan Android M'nin nota bakın:
https://developer.android.com/preview/api-overview.html#4K-display
Ve burada sınıfın belgelerine:
geçerli sürümü itibariyle, bu kodu uygulamıyor gibi ExoPlayer
için https://developer.android.com/reference/android/view/Display.Mode.html#getPhysicalWidth()
(1.4.2) ama bu muhtemelen değişecek. Bkz:
/**
* Used to check if the connected device support UHD (3840x2160)
*
* Note that this call will fail to identify UHD devices on api level bellow 23 (M)
*
* @return 1 if device is UHD, 0 otherwise
*/
public int isUHD(){
Display display = getActivity().getWindowManager().getDefaultDisplay();
Point displaySize = getDisplaySize(display);
return (displaySize.x >= 3840 && displaySize.y >= 2160) ? 1 : 0;
}
/**
* Convenience function that forks to the different ways to obatin the Display size across Android versions
*
* @param display Display instance to obtain information from
*
* @return Point a Point describing the Display size
*/
private static Point getDisplaySize(Display display) {
Point displaySize = new Point();
if(Util.SDK_INT >= 23){
getDisplaySizeV23(display, displaySize);
}else if(Util.SDK_INT >= 17) {
getDisplaySizeV17(display, displaySize);
} else if(Util.SDK_INT >= 16) {
getDisplaySizeV16(display, displaySize);
} else {
getDisplaySizeV9(display, displaySize);
}
return displaySize;
}
@TargetApi(23)
private static void getDisplaySizeV23(Display display, Point outSize){
Display.Mode[] modes = display.getSupportedModes();
if(modes.length > 0){
Display.Mode mode = modes[0];
outSize.x = mode.getPhysicalWidth();
outSize.y = mode.getPhysicalHeight();
}
}
@TargetApi(17)
private static void getDisplaySizeV17(Display display, Point outSize) {
display.getRealSize(outSize);
}
@TargetApi(16)
private static void getDisplaySizeV16(Display display, Point outSize) {
display.getSize(outSize);
}
private static void getDisplaySizeV9(Display display, Point outSize) {
outSize.x = display.getWidth();
outSize.y = display.getHeight();
}
23.
daha az API yanlış sonuçlar verecektir: nihayet
https://github.com/google/ExoPlayer/issues/800
Ve soruyu cevaplamak için, şu anda 4K algılamak için doğru yolu böyle bir şeydir
Bu http://stackoverflow.com/a/3166582/1944049'u denediniz mi? –
Shield TV'de bu kod, xhdpi ve 320 dpi yoğunluğunu bildirir. Xxxhdpi ve 640 dpi bildiriyor olmalı. – Cobar
Sony X83C için de aynı durum .. Android TV'de 4K'yı algılamanın güvenilir bir yolu yok mu? –