Agora Java API Reference for Android
Classes | Public Member Functions | Static Public Member Functions | List of all members
io.agora.streaming.StreamingKit Class Referenceabstract
Inheritance diagram for io.agora.streaming.StreamingKit:
io.agora.streaming.internal.StreamingKitImpl

Classes

interface  LogFilter
 

Public Member Functions

abstract int enableAudioRecording (boolean enabled)
 
abstract int enableVideoCapturing (boolean enabled)
 
abstract int startStreaming (String publishUrl)
 
abstract int stopStreaming ()
 
abstract int muteAudioStream (boolean muted)
 
abstract int muteVideoStream (boolean muted)
 
abstract int switchResolution (int width, int height)
 
abstract int snapshot (SnapshotCallback snapshotCallback)
 
abstract int switchCamera ()
 
abstract boolean addVideoFilter (VideoFilter videoFilter)
 
abstract boolean removeVideoFilter (VideoFilter videoFilter)
 
abstract int adjustRecordingSignalVolume (int volume)
 
abstract AgoraCameraCapturer getCameraCapture ()
 
abstract VideoPreviewRenderer getVideoPreviewRenderer ()
 
abstract int registerAudioFrameObserver (AudioFrameObserver observer)
 
abstract void unregisterAudioFrameObserver (AudioFrameObserver observer)
 
abstract int registerVideoFrameObserver (VideoFrameObserver observer)
 
abstract void unregisterVideoFrameObserver (VideoFrameObserver observer)
 
abstract int setLogFile (String filePath)
 
abstract int setLogFilter (@LogFilter int filter)
 
abstract int setLogFileSize (int fileSizeInKBytes)
 
abstract int startScreenCapture (Intent intent, int width, int height)
 
abstract void stopScreenCapture ()
 

Static Public Member Functions

static synchronized StreamingKit create (StreamingContext streamingContext) throws Exception
 
static synchronized void destroy ()
 
static String getSdkVersion ()
 

Detailed Description

Main interface class of the Agora Streaming Kit.

Call the methods of this class to use all the functionality of the kit. Agora recommends calling the AgoraStreamingKit API methods in the same thread instead of in multiple threads.

Member Function Documentation

◆ create()

static synchronized StreamingKit io.agora.streaming.StreamingKit.create ( StreamingContext  streamingContext) throws Exception
static

Creates an AgoraStreamingKit instance.

The Agora Streaming Kit only supports one AgoraStreamingKit instance at a time, therefore the app should create one AgoraStreamingKit object only.

Parameters
streamingContextStreamingContext
Returns
An AgoraService object.
Exceptions
ExceptionFails to create an AgoraService instance.

◆ destroy()

static synchronized void io.agora.streaming.StreamingKit.destroy ( )
static

Releases all the resources used by the Agora Streaming Kit.

◆ enableAudioRecording()

abstract int io.agora.streaming.StreamingKit.enableAudioRecording ( boolean  enabled)
abstract

Enables or disables audio recording.

Parameters
enabledDetermines whether to disable or re-enable audio recording:
  • true: (Default) Re-enable audio recording.
  • false: Disable audio recording.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ enableVideoCapturing()

abstract int io.agora.streaming.StreamingKit.enableVideoCapturing ( boolean  enabled)
abstract

Enables or disables video capturing.

Parameters
enabledDetermines whether to disable or re-enable video capturing:
  • true: (Default) Re-enable video capturing.
  • false: Disable video capturing.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ startStreaming()

abstract int io.agora.streaming.StreamingKit.startStreaming ( String  publishUrl)
abstract

Start media streaming

Parameters
publishUrlThe CDN streaming URL in the RTMP format. The maximum length of this parameter is 1024 bytes. The URL address must not contain special characters, such as Chinese language characters.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ stopStreaming()

abstract int io.agora.streaming.StreamingKit.stopStreaming ( )
abstract

stop media streaming

Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ muteAudioStream()

abstract int io.agora.streaming.StreamingKit.muteAudioStream ( boolean  muted)
abstract

Stops or resumes publishing the audio stream.

Parameters
mutedDetermines whether to publish or stop publishing the audio stream:
  • true: Stop publishing the audio stream.
  • false: (Default) Publish the audio stream.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ muteVideoStream()

abstract int io.agora.streaming.StreamingKit.muteVideoStream ( boolean  muted)
abstract

Stops or resumes publishing the video stream.

Parameters
mutedDetermines whether to publish or stop publishing the video stream:
  • true: Stop publishing the video stream.
  • false: (Default) Publish the video stream.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ switchResolution()

abstract int io.agora.streaming.StreamingKit.switchResolution ( int  width,
int  height 
)
abstract

Sets the audio stream configuration.

Each configuration corresponds to a set of audio parameters, including the audio sample rate, bytes per sample, number of channels, and bitrate.

Parameters
configThe audio stream configuration: AudioStreamConfiguration.
Returns
  • 0: Success.
  • < 0: Failure. Sets the video stream configuration.

Each configuration corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.

Parameters
configThe video stream configuration: VideoStreamConfiguration.
Returns
  • 0: Success.
  • < 0: Failure. Switches video resolution when pushing stream.

Minimum resolution support 64*64 Maximum resolution support 1920*1080

Parameters
widthThe width of video stream
heightThe height of video stream
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ snapshot()

abstract int io.agora.streaming.StreamingKit.snapshot ( SnapshotCallback  snapshotCallback)
abstract

snapshot a video frame when pushing stream.

@notes This method just callback onSnapshot of bitmap once.

Parameters
snapshotCallbackThe width of video stream
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ switchCamera()

abstract int io.agora.streaming.StreamingKit.switchCamera ( )
abstract

Switches between front and rear cameras.

Note
This method applies to Android and iOS only.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ addVideoFilter()

abstract boolean io.agora.streaming.StreamingKit.addVideoFilter ( VideoFilter  videoFilter)
abstract

Adds a video filter to the video track.

Parameters
videoFilterThe video filter that you want to add to the video track: VideoFilter.
Returns
  • true: The video filter is added successfully.
  • false: The video filter fails to be added.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ removeVideoFilter()

abstract boolean io.agora.streaming.StreamingKit.removeVideoFilter ( VideoFilter  videoFilter)
abstract

Removes the video filter added by addVideoFilter() from the video track.

Parameters
videoFilterThe video filter that you want to remove.
Returns
  • true: The video filter is removed successfully.
  • false: The video filter fails to be removed.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ adjustRecordingSignalVolume()

abstract int io.agora.streaming.StreamingKit.adjustRecordingSignalVolume ( int  volume)
abstract

Adjusts the recording volume.

Parameters
volumeThe recording volume, which ranges from 0 to 400:
  • 0: Mute the recoridng volume.
  • 100: The Original volume.
  • 400: (Maximum) Four times the original volume with signal clipping protection.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ getCameraCapture()

abstract AgoraCameraCapturer io.agora.streaming.StreamingKit.getCameraCapture ( )
abstract

Get the camera capturer

Returns
  • Returns an CameraCapturer object (single instance) that provides the method to manger the camera capturer when the call succeeds.
  • Returns null when the call fails.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ getVideoPreviewRenderer()

abstract VideoPreviewRenderer io.agora.streaming.StreamingKit.getVideoPreviewRenderer ( )
abstract

Get the video preview renderer

Returns
  • Returns an VideoPreviewRenderer object (single instance) that provides the method to manger the video preview rendering when the call succeeds.
  • Returns null when the call fails.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ registerAudioFrameObserver()

abstract int io.agora.streaming.StreamingKit.registerAudioFrameObserver ( AudioFrameObserver  observer)
abstract

Registers an audio frame observer object.

Parameters
observerAn AudioFrameObserver object.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ unregisterAudioFrameObserver()

abstract void io.agora.streaming.StreamingKit.unregisterAudioFrameObserver ( AudioFrameObserver  observer)
abstract

Unregisters an audio frame observer object.

Parameters
observerAn AudioFrameObserver object.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ registerVideoFrameObserver()

abstract int io.agora.streaming.StreamingKit.registerVideoFrameObserver ( VideoFrameObserver  observer)
abstract

Registers a video frame observer object.

Parameters
observerA VideoFrameObserver object.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ unregisterVideoFrameObserver()

abstract void io.agora.streaming.StreamingKit.unregisterVideoFrameObserver ( VideoFrameObserver  observer)
abstract

Unregisters a video frame observer object.

Parameters
observerA VideoFrameObserver object.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ setLogFile()

abstract int io.agora.streaming.StreamingKit.setLogFile ( String  filePath)
abstract

Specifies an output log file for the streaming kit.

The log file records all log data for the kit's operation. Ensure that the directory for the log file exists and is writable.

Note
Ensure that you call this method immediately after create, or the output log may not be complete.
Parameters
filePathFile path of the log file.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ setLogFilter()

abstract int io.agora.streaming.StreamingKit.setLogFilter ( @LogFilter int  filter)
abstract

Sets the output log level of the kit.

You can use one or a combination of the filters. The log level follows the sequence of OFF, CRITICAL, ERROR, WARNING, INFO, and DEBUG. Choose a level and you will see logs preceding that level. For example, if you set the log level to WARNING, you see the logs within levels CRITICAL, ERROR, and WARNING.

Parameters
filterSets the log filter level:
  • LOG_FILTER_DEBUG: Output all API logs. Set your log filter as DEBUG if you want to get the most complete log file.
  • LOG_FILTER_INFO: Output logs of the CRITICAL, ERROR, WARNING, and INFO level. We recommend setting your log filter as this level.
  • LOG_FILTER_WARNING: Output logs of the CRITICAL, ERROR, and WARNING level.
  • LOG_FILTER_ERROR: Output logs of the CRITICAL and ERROR level.
  • LOG_FILTER_CRITICAL: Output logs of the CRITICAL level.
  • LOG_FILTER_OFF: Do not output any log.
Returns
  • 0: Success.
  • < 0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ setLogFileSize()

abstract int io.agora.streaming.StreamingKit.setLogFileSize ( int  fileSizeInKBytes)
abstract

Sets the log file size (KB).

The SDK has two log files, each with a default size of 512 KB. If you set fileSizeInBytes as 1024 KB, the SDK outputs log files with a total maximum size of 2 MB. If the total size of the log files exceed the set value, the new output log files overwrite the old output log files.

Parameters
fileSizeInKBytesThe SDK log file size (KB).
Returns
  • 0: Success.
  • <0: Failure.

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ getSdkVersion()

static String io.agora.streaming.StreamingKit.getSdkVersion ( )
static

Gets the SDK version.

Returns
The version of the current SDK in the string format.

◆ startScreenCapture()

abstract int io.agora.streaming.StreamingKit.startScreenCapture ( Intent  intent,
int  width,
int  height 
)
abstract

start screen capture for android

Parameters
Intentandroid screen share system serverice Intent
intscreen dimension witch
intscreen dimension height
Returns
int < 0 FAILED 0 SUCCESS

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.

◆ stopScreenCapture()

abstract void io.agora.streaming.StreamingKit.stopScreenCapture ( )
abstract

stop screen capture for android

Parameters
none
Returns
none

Reimplemented in io.agora.streaming.internal.StreamingKitImpl.