想让播放器优先使用硬解码,启用了mediacodec,
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
但是有一些机型上会黑屏,请问该怎样设置让它可以自动切换软解码?
求解答。
吃瓜群众路过,你可以在TextureView的onSurfaceTextureUpdated中,通过TextureView.getBitmap()获取到画面,如果好几个画面的bitmap都是rgb 000的黑色,说明一直黑屏,切换为软解 ,有点野路子,刚好看到了就表达下看法,哈哈哈。。。。
@CarGuo 再请教一下,只设置了SurfaceTexture的该怎么获取画面判断是不是黑屏?就是拿到了texture然后传给Unity了
surfaceview上的可以通过
Canvas canvas=holder.lockCanvas();
bitmap=BitmapFactory.xxxx;
canvas.drawBitmap(bitmap, 0, 0, null);
holder.unlockCanvasAndPost(canvas);类似这样,但是SurfaceTexture就不清楚了,没用过呢
@CarGuo 谢谢
Most helpful comment
吃瓜群众路过,你可以在TextureView的onSurfaceTextureUpdated中,通过TextureView.getBitmap()获取到画面,如果好几个画面的bitmap都是rgb 000的黑色,说明一直黑屏,切换为软解 ,有点野路子,刚好看到了就表达下看法,哈哈哈。。。。