#include <IAgoraStreamingKit.h>
The IStreamingKit class.
This class provides the main methods that can be invoked by your app.
Creating an IStreamingKit object and then calling the methods of this object enables you to use Agora SDK's live streaming functionality.
◆ initialize()
virtual int agora::streaming::IStreamingKit::initialize |
( |
const StreamingContext & |
context | ) |
|
|
pure virtual |
Initializes the Agora streaming kit.
In this method, you need to enter the issued Agora App ID to start initialization. After creating an IStreamingKit object, call this method to initialize the kit before calling any other methods.
- Parameters
-
context | The StreamingContext object. |
audioTrack | The local audio track. Must not be NULL if audio streaming is enabled. |
videoTrack | The local video track. Must not be NULL if video streaming is enabled. |
- Returns
- 0: Success.
- < 0: Failure.
◆ release()
virtual void agora::streaming::IStreamingKit::release |
( |
bool |
sync = false | ) |
|
|
pure virtual |
Releases the IStreamingKit object.
- Parameters
-
sync | Determines whether this method is a synchronous call.
- true: This method is a synchronous call, which means that the result of this method call returns after the IStreamingKit object resources are released. Do not call this method in any callback generated by the streaming kit, or it may result in a deadlock.
- false: This method is an asynchronous call. The result returns immediately even when the IStreamingKit object resources are not released.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ startStreaming()
virtual int agora::streaming::IStreamingKit::startStreaming |
( |
const char * |
publishUrl | ) |
|
|
pure virtual |
Start media streaming
- Parameters
-
publishUrl | The 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.
◆ stopStreaming()
virtual int agora::streaming::IStreamingKit::stopStreaming |
( |
| ) |
|
|
pure virtual |
stop media streaming
- Returns
- 0: Success.
- < 0: Failure.
◆ enableAudioRecording()
virtual int agora::streaming::IStreamingKit::enableAudioRecording |
( |
bool |
enabled | ) |
|
|
pure virtual |
Enables or disables audio recording.
- Parameters
-
enabled | Determines whether to disable or re-enable audio recording:
- true: (Default) Re-enable audio recording.
- false: Disable audio recording.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ enableVideoCapturing()
virtual int agora::streaming::IStreamingKit::enableVideoCapturing |
( |
bool |
enabled | ) |
|
|
pure virtual |
Enables or disables video capturing.
- Parameters
-
enabled | Determines whether to disable or re-enable video capturing:
- true: (Default) Re-enable video capturing.
- false: Disable video capturing.
|
- Returns
- 0: Success.
- < 0: Failure.
◆ muteAudioStream()
virtual int agora::streaming::IStreamingKit::muteAudioStream |
( |
bool |
muted | ) |
|
|
pure virtual |
Stops or resumes publishing the audio stream.
- Parameters
-
muted | Determines 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.
◆ muteVideoStream()
virtual int agora::streaming::IStreamingKit::muteVideoStream |
( |
bool |
muted | ) |
|
|
pure virtual |
Stops or resumes publishing the video stream.
- Parameters
-
muted | Determines 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.
◆ setAudioStreamConfiguration()
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
-
- Returns
- 0: Success.
- < 0: Failure.
◆ setVideoStreamConfiguration()
Sets the video stream configuration.
Each configuration corresponds to a set of video parameters, including the resolution, frame rate, and bitrate.
- Parameters
-
- Returns
- 0: Success.
- < 0: Failure.
◆ switchResolution()
virtual int agora::streaming::IStreamingKit::switchResolution |
( |
int |
width, |
|
|
int |
height |
|
) |
| |
|
pure virtual |
switch the video resolution on preview.
Minimum resolution support 64*64 Maximum resolution support 1920*1080
- Parameters
-
width | The width of video. |
height | The height of video. |
- Returns
- 0: Success.
- < 0: Failure.
◆ snapshot()
snapshot a picture on pushing.
- Parameters
-
callback | callback a bitmap |
- Returns
- 0: Success.
- < 0: Failure.
◆ adjustRecordingSignalVolume()
virtual int agora::streaming::IStreamingKit::adjustRecordingSignalVolume |
( |
int |
volume | ) |
|
|
pure virtual |
Adjusts the recording volume.
- Parameters
-
volume | The 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.
◆ setExternalAudioSource()
virtual int agora::streaming::IStreamingKit::setExternalAudioSource |
( |
bool |
enable | ) |
|
|
pure virtual |
Enables the external audio source.
Call this method before push streaming.
- Parameters
-
enable | Determines whether to enable the external audio source. |
- Returns
- 0: Success. < 0: Failure.
◆ setExternalVideoSource()
virtual int agora::streaming::IStreamingKit::setExternalVideoSource |
( |
bool |
enable | ) |
|
|
pure virtual |
Enables the external video source.
Call this method before push streaming.
- Parameters
-
enable | Determines whether to enable the external video source. |
- Returns
- 0: Success. < 0: Failure.
◆ pushExternalVideoFrame()
virtual int agora::streaming::IStreamingKit::pushExternalVideoFrame |
( |
const media::IVideoFrameObserver::VideoFrame & |
Frame | ) |
|
|
pure virtual |
Pushes the external video frame to the app.
- Parameters
-
frame | The video buffer data. |
- Returns
- 0: Success.
- < 0: Failure.
◆ pushExternalAudioFrame()
virtual int agora::streaming::IStreamingKit::pushExternalAudioFrame |
( |
const media::IAudioFrameObserver::AudioFrame & |
frame | ) |
|
|
pure virtual |
Pushes the external audio data to the app.
- Parameters
-
frame | The audio buffer data. |
- Returns
- 0: Success.
- < 0: Failure.
◆ getAudioDeviceManager()
Get the audio device manager
- Returns
- Returns an IAudioDeviceManager object that provides the method to manage the audio devices when the call succeeds.
- Returns NULL when the call fails (for example, custom audio input is used).
◆ getVideoDeviceManager()
Get the video device manager
- Returns
- Returns an IVideoDeviceManager object that provides the method to manage the video devices when the call succeeds.
- Returns NULL when the call fails (for example, custom video input is used).
◆ getVideoPreviewRenderer()
Get the video preview renderer
- Returns
- Returns an IVideoPreviewRenderer object that provides the method to manger the video preview rendering when the call succeeds.
- Returns NULL when the call fails.
◆ registerAudioFrameObserver()
virtual int agora::streaming::IStreamingKit::registerAudioFrameObserver |
( |
media::base::IAudioFrameObserver * |
observer | ) |
|
|
pure virtual |
Registers an audio frame observer object.
- Parameters
-
observer | A pointer to the audio frame observer object: IAudioFrameObserver. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unregisterAudioFrameObserver()
virtual void agora::streaming::IStreamingKit::unregisterAudioFrameObserver |
( |
media::base::IAudioFrameObserver * |
observer | ) |
|
|
pure virtual |
Unregisters an audio frame observer object.
- Parameters
-
observer | A pointer to the audio frame observer object: IAudioFrameObserver. |
◆ registerVideoFrameObserver()
virtual int agora::streaming::IStreamingKit::registerVideoFrameObserver |
( |
media::base::IVideoFrameObserver * |
observer | ) |
|
|
pure virtual |
Registers a video frame observer object.
- Parameters
-
observer | A pointer to the video frame observer: IVideoFrameObserver. |
- Returns
- 0: Success.
- < 0: Failure.
◆ unregisterVideoFrameObserver()
virtual void agora::streaming::IStreamingKit::unregisterVideoFrameObserver |
( |
media::base::IVideoFrameObserver * |
observer | ) |
|
|
pure virtual |
Unregisters a video frame observer object.
- Parameters
-
observer | A pointer to the video frame observer: IVideoFrameObserver. |
◆ setLogFile()
virtual int agora::streaming::IStreamingKit::setLogFile |
( |
const char * |
filePath | ) |
|
|
pure virtual |
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 initialize, or the output log may not be complete.
- Parameters
-
filePath | File path of the log file. The string of the log file is in UTF-8. |
- Returns
- 0: Success.
- < 0: Failure.
◆ setLogFilter()
virtual int agora::streaming::IStreamingKit::setLogFilter |
( |
unsigned int |
filter | ) |
|
|
pure virtual |
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
-
filter | Sets 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.
◆ setLogFileSize()
virtual int agora::streaming::IStreamingKit::setLogFileSize |
( |
unsigned int |
fileSizeInKBytes | ) |
|
|
pure virtual |
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
-
fileSizeInKBytes | The SDK log file size (KB). |
- Returns
-