API's for Android 4.4 screen recording?

谁说我不能喝 提交于 2019-12-03 01:53:41

The screenrecord utility uses private APIs, so you can't do exactly what it does.

The way it works is to create a virtual display, route the virtual display to a video encoder, and then save the output to a file. You can do essentially the same thing, but because you're not running as the "shell" user you'd only be able to see the layers you created. The relevant APIs are designed around creating a Presentation, which may not be exactly what you want.

See the source code for a CTS test with a trivial example (just uses an ImageView).

Of course, if you happen to be a GLES application, you can just record the output directly (see e.g. EncodeAndMuxTest and the "Record GL app" activity in Grafika).

Well, AFAIK, i don't see an API support equivalent to capturing what's going on the screen.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!