public class ScreenCapturer extends Object implements VideoCapturer
LocalVideoTrack
from a
device's screen. The frames are provided via the MediaProjection
api. This capturer is
only compatible with Build.VERSION_CODES.LOLLIPOP
or higher.
This class represents an implementation of a VideoCapturer
interface. Although public,
these methods are not meant to be invoked directly.
Note: This capturer can be reused, but cannot be shared across multiple LocalVideoTrack
s simultaneously.
Modifier and Type | Class and Description |
---|---|
static interface |
ScreenCapturer.Listener
Interface that provides events and errors related to
ScreenCapturer . |
Constructor and Description |
---|
ScreenCapturer(android.content.Context context,
int screenCaptureIntentResult,
android.content.Intent screenCaptureIntentData,
ScreenCapturer.Listener screenCapturerListener) |
Modifier and Type | Method and Description |
---|---|
List<VideoFormat> |
getSupportedFormats()
Returns a list containing one supported video format derived from the device screen size.
|
boolean |
isScreencast()
Indicates that the screen capturer is a screencast.
|
void |
startCapture(VideoFormat captureFormat,
VideoCapturer.Listener capturerListener)
Starts capturing frames at the specified format.
|
void |
stopCapture()
Stops all frames being captured.
|
public ScreenCapturer(android.content.Context context, int screenCaptureIntentResult, android.content.Intent screenCaptureIntentData, ScreenCapturer.Listener screenCapturerListener)
public List<VideoFormat> getSupportedFormats()
Note: This method can be invoked for informational purposes, but is primarily used internally.
getSupportedFormats
in interface VideoCapturer
public boolean isScreencast()
isScreencast
in interface VideoCapturer
public void startCapture(VideoFormat captureFormat, VideoCapturer.Listener capturerListener)
Note: This method is not meant to be invoked directly.
startCapture
in interface VideoCapturer
captureFormat
- the format in which to capture frames.capturerListener
- consumer of available frames.public void stopCapture()
MediaProjection
should be available for use upon
completion.
Note: This method is not meant to be invoked directly.
stopCapture
in interface VideoCapturer
4.4.0