public final class MediaProjection
extends Object
| java.lang.Object | |
| android.media.projection.MediaProjection | |
令牌应用程序能够捕捉屏幕内容和/或录制系统音频。 授予的确切功能取决于MediaProjection的类型。
屏幕捕获会话可以通过createScreenCaptureIntent()开始。 这赋予了捕捉屏幕内容但不捕获系统音频的能力。
Nested classes |
|
|---|---|
class |
MediaProjection.Callback 预测会话的回调。 |
公共方法(Public methods) |
|
|---|---|
VirtualDisplay |
createVirtualDisplay(String name, int width, int height, int dpi, int flags, Surface surface, VirtualDisplay.Callback callback, Handler handler) 创建一个 |
void |
registerCallback(MediaProjection.Callback callback, Handler handler) 注册侦听器以接收有关 |
void |
stop() 停止投影。 |
void |
unregisterCallback(MediaProjection.Callback callback) 取消注册MediaProjection侦听器。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
VirtualDisplay createVirtualDisplay (String name, int width, int height, int dpi, int flags, Surface surface, VirtualDisplay.Callback callback, Handler handler)
创建 VirtualDisplay以捕获屏幕的内容。
| 参数(Parameters) | |
|---|---|
name |
String: The name of the virtual display, must be non-empty. |
width |
int: The width of the virtual display in pixels. Must be greater than 0. |
height |
int: The height of the virtual display in pixels. Must be greater than 0. |
dpi |
int: The density of the virtual display in dpi. Must be greater than 0. |
flags |
int: A combination of virtual display flags. See DisplayManager for the full list of flags. |
surface |
Surface: The surface to which the content of the virtual display should be rendered, or null if there is none initially. |
callback |
VirtualDisplay.Callback: Callback to call when the virtual display's state changes, or null if none. |
handler |
Handler: The Handler on which the callback should be invoked, or null if the callback should be invoked on the calling thread's main Looper. |
| 返回(Returns) | |
|---|---|
VirtualDisplay |
|
也可以看看:
void registerCallback (MediaProjection.Callback callback, Handler handler)
注册侦听器以接收有关 MediaProjection更改状态的通知。
| 参数(Parameters) | |
|---|---|
callback |
MediaProjection.Callback: The callback to call. |
handler |
Handler: The handler on which the callback should be invoked, or null if the callback should be invoked on the calling thread's looper. |
void unregisterCallback (MediaProjection.Callback callback)
取消注册MediaProjection侦听器。
| 参数(Parameters) | |
|---|---|
callback |
MediaProjection.Callback: The callback to unregister. |