好的和坏的 alpha 空白屏幕截图捕捉
good and bad alpha-blank screenshot catching
我有几个电视盒,在不同的城市点通过 wi-fi 工作 - 显示视频广告。为了检查它们是否正确显示视频,我决定每隔一段时间截取屏幕截图并进行比较。好的,我通过这个命令截图:
adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png
有时我会得到很好的屏幕截图:来自屏幕的图片是这样的
Good screen
但有时我得到这个:
like alpha-channel
图片来自桌面 monitor view
我在办公室测试了一个盒子,它有同样的错误。视频以这种方式播放:
Intent localIntent = new Intent(getBaseContext(), MediaObjectPlayerActivity.class);
localIntent.putExtra("path", localPath);
localIntent.putExtra("name", mCurrentPlay);
localIntent.setFlags(FLAG_ACTIVITY_NEW_TASK);
startActivity(localIntent);
有什么问题吗?什么是异常行为?谢谢
因此,如果您想截取来自 VideoView 的视频截图,您需要使用 MediaMetadataRetriever。这是一个很好的例子 http://android-er.blogspot.ru/2016/04/capture-frames-in-videoview-using.html
我有几个电视盒,在不同的城市点通过 wi-fi 工作 - 显示视频广告。为了检查它们是否正确显示视频,我决定每隔一段时间截取屏幕截图并进行比较。好的,我通过这个命令截图:
adb shell screencap -p /sdcard/screen.png && adb pull /sdcard/screen.png
有时我会得到很好的屏幕截图:来自屏幕的图片是这样的
Good screen
但有时我得到这个:
like alpha-channel
图片来自桌面 monitor view
我在办公室测试了一个盒子,它有同样的错误。视频以这种方式播放:
Intent localIntent = new Intent(getBaseContext(), MediaObjectPlayerActivity.class);
localIntent.putExtra("path", localPath);
localIntent.putExtra("name", mCurrentPlay);
localIntent.setFlags(FLAG_ACTIVITY_NEW_TASK);
startActivity(localIntent);
有什么问题吗?什么是异常行为?谢谢
因此,如果您想截取来自 VideoView 的视频截图,您需要使用 MediaMetadataRetriever。这是一个很好的例子 http://android-er.blogspot.ru/2016/04/capture-frames-in-videoview-using.html