Agora C++ API Reference for All Platforms
Public Member Functions | Protected Member Functions | List of all members
agora::rtc::IScreenCapturer2 Class Referenceabstract

Inherits agora::RefCountInterface.

Inherited by agora::rtc::IScreenCapturerEx2.

Public Member Functions

virtual int setScreenCaptureDimensions (const VideoDimensions &dimensions, aosl_ref_t ares=AOSL_REF_INVALID)=0
 
virtual int updateScreenCaptureRegion (const Rectangle &regionRect, aosl_ref_t ares=AOSL_REF_INVALID)=0
 
virtual int setFrameRate (int rate, aosl_ref_t ares=AOSL_REF_INVALID)=0
 
virtual int setAudioRecordConfig (int channels, int sampleRate, aosl_ref_t ares=AOSL_REF_INVALID)=0
 
virtual int setAudioVolume (uint32_t volume, aosl_ref_t ares=AOSL_REF_INVALID)=0
 
virtual int setExternalMediaProjection (void *mediaProjection)=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

virtual ~IScreenCapturer2 ()
 
- Protected Member Functions inherited from agora::RefCountInterface
virtual ~RefCountInterface ()
 

Constructor & Destructor Documentation

◆ ~IScreenCapturer2()

virtual agora::rtc::IScreenCapturer2::~IScreenCapturer2 ( )
inlineprotectedvirtual

Member Function Documentation

◆ setScreenCaptureDimensions()

virtual int agora::rtc::IScreenCapturer2::setScreenCaptureDimensions ( const VideoDimensions dimensions,
aosl_ref_t  ares = AOSL_REF_INVALID 
)
pure virtual

Screen capture's resolution.

Parameters
dimensionsThe 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.

◆ updateScreenCaptureRegion()

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

Updates the screen capture region.

Parameters
regionRectThe 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.

◆ setFrameRate()

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

Set frame rate of the screen capture source

Parameters
rateframe rate (in fps)

◆ setAudioRecordConfig()

virtual int agora::rtc::IScreenCapturer2::setAudioRecordConfig ( int  channels,
int  sampleRate,
aosl_ref_t  ares = AOSL_REF_INVALID 
)
pure virtual

Set channels and sample rate of screen audio capturing

Parameters
channelschannels of system audio capture
sampleRatesample rate of system audio capture
Returns
  • 0: Sucess.
  • < 0: Failure

◆ setAudioVolume()

virtual int agora::rtc::IScreenCapturer2::setAudioVolume ( uint32_t  volume,
aosl_ref_t  ares = AOSL_REF_INVALID 
)
pure virtual

Set volume of screen audio capturing

Parameters
volumevolume of system audio capture
Returns
  • 0: Sucess.
  • < 0: Failure

◆ setExternalMediaProjection()

virtual int agora::rtc::IScreenCapturer2::setExternalMediaProjection ( void *  mediaProjection)
pure virtual

Sets screen sharing using the Android native class MediaProjection.

When screen capture stopped, the SDK will automatically release the MediaProjection internally.

Parameters
mediaProjectionMediaProjection is an Android class that provides access to screen capture and recording capabiliies.
Note
Additional MediaProjection is primarily used for specific scenarios, such as IOT custom devices or subprocess screen sharing.
Returns
  • 0: Success.
  • < 0: Failure. @technical preview