Agora C++ API Reference for All Platforms

Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | List of all members
agora::rtc::IScreenCapturer Class Referenceabstract

`#include <NGIAgoraScreenCapturer.h>`

Inherits agora::RefCountInterface.

Inherited by agora::rtc::IScreenCapturerEx.

## Public Member Functions
virtual int | initWithDisplayId (int64_t displayId, const Rectangle &regionRect)=0
virtual int | initWithScreenRect (const Rectangle &screenRect, const Rectangle &regionRect)=0
virtual int | initWithWindowId (view_t windowId, const Rectangle &regionRect)=0
virtual int | setContentHint (VIDEO_CONTENT_HINT contentHint, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | updateScreenCaptureRegion (const Rectangle &regionRect, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setScreenOrientation (VIDEO_ORIENTATION orientation, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | setFrameRate (int rate, aosl_ref_t ares=AOSL_REF_INVALID)=0
virtual int | initWithMediaProjectionPermissionResultData (void *data, const VideoDimensions &dimensions)=0
Public Member Functions inherited from agora::RefCountInterface
virtual void | AddRef () const =0
virtual RefCountReleaseStatus | Release () const =0
virtual bool | HasOneRef () const =0

## Protected Member Functions
| ~IScreenCapturer ()
Protected Member Functions inherited from agora::RefCountInterface
virtual | ~RefCountInterface ()

## Detailed Description

The IScreenCapturer class, which provides access to the screen capturer.

## Constructor & Destructor Documentation

## ◆ ~IScreenCapturer()

agora::rtc::IScreenCapturer::~IScreenCapturer | ( |  | ) |
| inlineprotected

## Member Function Documentation

## ◆ initWithDisplayId()

virtual int agora::rtc::IScreenCapturer::initWithDisplayId | ( | int64_t | displayId,
|  | const Rectangle & | regionRect )
| pure virtual

Initializes the screen capturer by specifying a display ID.

Note
  This method applies to macOS windows linux.

This method shares a whole or part of a screen specified by the display ID.

Parameters

  displayId | The display ID of the screen to be shared. This parameter specifies which screen you want to share.
  regionRect | The reference to the relative location of the region to the screen: Rectangle. If the specified region overruns the screen, only the region within the screen will be captured. If you set `width` or `height` as 0, the whole screen will be captured. Note that the coordinates of rectangle are relative to the window and follows system specifications.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ initWithScreenRect()

virtual int agora::rtc::IScreenCapturer::initWithScreenRect | ( | const Rectangle & | screenRect,
|  | const Rectangle & | regionRect )
| pure virtual

Initializes the screen capturer by specifying a screen Rect.

Note
  This method applies to Windows only.

This method shares a whole or part of a screen specified by the screen Rect.

Parameters

  screenRect | The reference to the Rect of the screen to be shared. This parameter specifies which screen you want to share.
  regionRect | The reference to the relative location of the region to the screen. See agora::rtc::Rectangle &regionRect "regionRect". If the specified region overruns the screen, only the region within the screen will be captured. If you set `width` or `height` as 0, the whole screen will be captured. Note that the coordinates of rectangle are relative to the window and follows system specifications.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ initWithWindowId()

virtual int agora::rtc::IScreenCapturer::initWithWindowId | ( | view_t | windowId,
|  | const Rectangle & | regionRect )
| pure virtual

Initializes the screen capturer by specifying a window ID.

This method shares a whole or part of a window specified by the window ID.

Note
  This method applies to Windows and macOS only.

Parameters

  windowId | The ID of the window to be shared. This parameter specifies which window you want to share.
  regionRect | The reference to the relative location of the region to the window. See agora::rtc::Rectangle &regionRect "regionRect". If the specified region overruns the window, only the region within the screen will be captured. If you set `width` or `height` as 0, the whole window will be captured. Note that the coordinates of rectangle are relative to the window and follows system specifications.

Returns
  - 0: Success.
  - < 0: Failure.

## ◆ setContentHint()

virtual int agora::rtc::IScreenCapturer::setContentHint | ( | VIDEO_CONTENT_HINT | contentHint,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Sets the content hint for screen sharing.

A content hint suggests the type of the content being shared, so that the SDK applies different optimization algorithms to different types of content.

Parameters

  contentHint | The content hint for screen capture: VIDEO_CONTENT_HINT.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_NOT_READY: No screen or window is being shared.

## ◆ updateScreenCaptureRegion()

virtual int agora::rtc::IScreenCapturer::updateScreenCaptureRegion | ( | const Rectangle & | regionRect,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Updates the screen capture region.

Parameters

  regionRect | The reference to the relative location of the region to the screen or window. See Rectangle. If the specified region overruns the screen or window, the screen capturer captures only the region within it. If you set `width` or `height` as 0, the SDK shares the whole screen or window.

Returns
  - 0: Success.
  - < 0: Failure.
    - No screen or window is being shared.

## ◆ setScreenOrientation()

virtual int agora::rtc::IScreenCapturer::setScreenOrientation | ( | VIDEO_ORIENTATION | orientation,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Set orientation of the captured screen image

Parameters

  VIDEO_ORIENTATION | orientaion of the device 0(by default), 90, 180, 270

## ◆ setFrameRate()

virtual int agora::rtc::IScreenCapturer::setFrameRate | ( | int | rate,
|  | aosl_ref_t | ares = AOSL_REF_INVALID )
| pure virtual

Set frame rate of the screen capture source

Parameters

  rate | frame rate (in fps)

## ◆ initWithMediaProjectionPermissionResultData()

virtual int agora::rtc::IScreenCapturer::initWithMediaProjectionPermissionResultData | ( | void * | data,
|  | const VideoDimensions & | dimensions )
| pure virtual

Initializes the screen capturer by specifying the Intent data obtained from MediaProjection.

This method shares the whole screen.

Note
  This method applies to Android only.

Parameters

  data | The Intent data from `onActivityResult (int requestCode, int resultCode, Intent data)` after you create an Intent from `MediaProjection` and sends the Intent to `startActivityForResult`.
  dimensions | The reference to the captured screen's resolution in terms of width × height. If you set `width` or `height` as 0, the dimensions will be the screen's width × height.

Returns
  - 0: Success.
  - < 0: Failure.
    - ERR_INVALID_ARGUMENT if data is null.