Closed yanjunhui2014 closed 9 months ago
我解决啦
/**
@param mPlayerView */
public static void compatExoPlayerSurface(PlayerView mPlayerView){ try { //反射获取surfaceView Class<?> clazz = mPlayerView.getClass(); Field field = clazz.getDeclaredField("surfaceView"); field.setAccessible(true); Object surfaceView = field.get(mPlayerView); if (surfaceView != null && surfaceView instanceof SurfaceView) { //将SurfaceView背景设置透明 setSurfaceViewTransparent((SurfaceView) surfaceView); } } catch (Exception e) { e.printStackTrace(); } }
private static void setSurfaceViewTransparent(SurfaceView surfaceView) { surfaceView.setZOrderOnTop(false); surfaceView.setBackgroundColor(Color.TRANSPARENT); surfaceView.getHolder().setFormat(PixelFormat.TRANSPARENT); }
PlayerView.setUseController(true)设置播放控制器失效,界面上看不到。 而且任何在PlayerView上的组件,都被覆盖了看不见。