YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.upnp.server.media.MediaProjectionHelper Class Reference

Manages MediaProjection for capturing system audio and screen. More...

Collaboration diagram for de.yaacc.upnp.server.media.MediaProjectionHelper:
Collaboration graph

Classes

interface  MediaProjectionStopCallback
 

Static Public Member Functions

static void addStopCallback (MediaProjectionStopCallback callback)
 Add a callback for when MediaProjection stops.
 
static void removeStopCallback (MediaProjectionStopCallback callback)
 Remove a callback added with addStopCallback(MediaProjectionStopCallback).
 
static Intent createPermissionIntent (Context context)
 Create intent to request MediaProjection permission.
 
static boolean handlePermissionResult (Context context, int resultCode, Intent data)
 Handle permission result from activity.
 
static boolean createMediaProjectionFromStored (Context context)
 Create MediaProjection from a foreground service using stored permission.
 
static boolean createMediaProjection (Context context, int resultCode, Intent data)
 Create MediaProjection from a foreground service.
 
static MediaProjection getMediaProjection ()
 Get current MediaProjection instance.
 
static boolean isActive ()
 Check if MediaProjection is active.
 
static boolean hasPermission ()
 Check if we have stored permission (either active or pending).
 
static void clearPermission ()
 Clear stored MediaProjection permission.
 
static void stopMediaProjection ()
 Stop MediaProjection and release resources.
 

Static Public Attributes

static final int REQUEST_CODE_MEDIA_PROJECTION = 2001
 

Detailed Description

Manages MediaProjection for capturing system audio and screen.

Requires Android 10+ (API 29).

Author
Tobias Schoene (tobexyz)

Member Function Documentation

◆ addStopCallback()

static void de.yaacc.upnp.server.media.MediaProjectionHelper.addStopCallback ( MediaProjectionStopCallback callback)
static

Add a callback for when MediaProjection stops.

It is called on the main thread. Adding the same callback twice has no effect. The callback must not capture a Context or View that outlives its owner; remove it with removeStopCallback(MediaProjectionStopCallback).

Referenced by de.yaacc.browser.StreamingPermissionHelper.registerStopCallback().

Here is the caller graph for this function:

◆ createMediaProjection()

static boolean de.yaacc.upnp.server.media.MediaProjectionHelper.createMediaProjection ( Context context,
int resultCode,
Intent data )
static

Create MediaProjection from a foreground service.

Must be called from a service with FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION.

◆ createMediaProjectionFromStored()

static boolean de.yaacc.upnp.server.media.MediaProjectionHelper.createMediaProjectionFromStored ( Context context)
static

Create MediaProjection from a foreground service using stored permission.

Must be called from a service with FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION.

◆ handlePermissionResult()

static boolean de.yaacc.upnp.server.media.MediaProjectionHelper.handlePermissionResult ( Context context,
int resultCode,
Intent data )
static

Handle permission result from activity.

Note: MediaProjection must be created from a foreground service.

Referenced by de.yaacc.browser.StreamingPermissionHelper.onPermissionResult().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: