Functional APIs

API List

  • ThunderEngine

FunctionFunction Name
instancetype _NonnullcreateEngine:sceneId:delegate:
voiddestroyEngine
NSStringgetVersion
voidsetSceneId:
voidsetThunderEventDelegate:
intsetArea:
intjoinRoom:roomName:uid:
intleaveRoom
intupdateToken:
intsetLogFilePath:
intsetLogCallback:
intsetLogLevel:
intaddPublishOriginStreamUrl
intremovePublishOriginStreamUrl:
intsetLiveTranscodingTask:transcoding:
intaddPublishTranscodingStreamUrl:url:
intremovePublishTranscodingStreamUrl:url:
intremoveLiveTranscodingTask:
intaddSubscribe:uid:
intremoveSubscribe:uid:
intsetMediaMode:
intsetRoomMode:
intenableWebSdkCompatibility:
intsetVideoEncoderConfig:
intsetLocalVideoCanvas:
intsetRemotePlayType:
intsetMultiVideoViewLayout:
intsetRemoteVideoCanvas:
intsetLocalCanvasScaleMode:
intsetRemoteCanvasScaleMode:mode:
intstartVideoPreview
intstopVideoPreview
intenableLocalVideoCapture:
intstopLocalVideoStream:
intstopAllRemoteVideoStreams:
intstopRemoteVideoStream:stopped:
intsetCustomVideoSource:
intsetVideoWatermark:
intregisterVideoDecodeFrameObserver:uid:
intregisterVideoCaptureFrameObserver:
intswitchFrontCamera:
intsetVideoCaptureOrientation:
intsetLocalVideoMirrorMode:
intenableLoudspeaker:
BOOLisLoudspeakerEnabled
intsetAudioConfig:commutMode:scenarioMode:
intsetAudioVolumeIndication:moreThanThd:lessThanThd:smooth:
intenableCaptureVolumeIndication:moreThanThd:lessThanThd:smooth:
intstopLocalAudioStream:
intstopAllRemoteAudioStreams:
intstopRemoteAudioStream:stopped:
intsetLoudSpeakerVolume:
intsetMicVolume:
intsetPlayVolume:volume:
nullable ThunderAudioFilePlayer*createAudioFilePlayer
voiddestroyAudioFilePlayer:
intsetEnableInEarMonitor:
intsetEnableEqualizer:
intsetEqGains:
intsetEnableReverb:
intsetReverbParam:
intsetEnableCompressor:
intsetCompressorParam:
intsetEnableLimiter:
intsetLimiterParam:
voidsetAudioSourceType:
voidenableAudioPlaySpectrum:
voidsetAudioPlaySpectrumInfo:notifyIntervalMS:
intsendUserAppMsgData:
intsendMediaExtraInfo:
intsetMediaExtraInfoDelegate:
intenableMixVideoExtraInfo:
BOOLstartAudioSaver:saverMode:fileMode:
BOOLstopAudioSaver
voidsetSoundEffect:
voidsetVoiceChanger:
intsetRecordingAudioFrameParameters:channel:mode:samplesPerCall:
intsetPlaybackAudioFrameParameters:channel:mode:samplesPerCall:
voidenableCustomAudioSource:channelsPerFrame:
voiddisableCustomAudioSource
BOOLpushCustomAudioRawData:samples:timestamp:
BOOLpushCustomAudioSampleBuffer:
intenableVoicePosition:
intsetRemoteUidVoicePosition:azimuth:gain:
ThunderVideoEncodeParam * _NonnullgetVideoEncoderParam:
ThunderConnectionStatusgetConnectionStatus:
intenableHowlingDetector:
intenableEchoDetector:
intsetVoicePitch:
BOOLisCameraManualFocusPositionSupported:
BOOLisCameraManualExposurePositionSupported:
CGFloatsetCameraZoomFactor:
intsetCameraFocusPosition:
intsetCameraExposurePosition:
intsetMixedAudioFrameParameters:
  • ThunderVideoFrameConsumer

FunctionFunction Name
voidconsumePixelBuffer:withTimestamp:rotation:
voidconsumeRawData:withTimestamp:format:size:rotation:
voidconsumeCMSampleBuffer:
  • ThunderAudioFilePlayer

FunctionFunction Name
voidsetPlayerDelegate:
voidopen:
voidclose
voidplay
voidStop
voidpause
voidresume
voidseek:
uint32_tgetTotalPlayTimeMS
uint32_tgetCurrentPlayTimeMS
voidsetPlayVolume:
intsetPlayerLocalVolume
intsetPlayerPublishVolume
intgetPlayerLocalVolume
intgetPlayerPublishVolume
voidsetSemitone:
intsetLooping:
intselectAudioTrack:
voidsetTempo:
voidsetPosition:
intgetAudioTrackCount
voidenablePublish:
voidenableSpectrum:
voidenableVolumeIndication:interval:
voidsetMixStandard:
BOOLisMixStandard
intgetCurrentSpectrum:len:
  • IMediaEngine

FunctionFunction Name
boolregisterAudioFrameObserver

API Details

ThunderEngine

ThunderEngine::createEngine:sceneId:delegate:

+ (instancetype _Nonnull)createEngine:(NSString * _Nonnull)appId
                              sceneId:(NSInteger)sceneId
                             delegate:(id<ThunderEventDelegate> _Nullable)delegate;

Create a ThunderEngine instance and initialize it.

Notes:

  • Currently, the SDK only supports one ThunderEngine instance, meaning that each application can only create one ThunderEngine object.
  • Unless otherwise specified, all API functions of ThunderEngine are asynchronously called, and the API is called in the same thread.
  • Users with the same AppId can communicate with one another.
  • SceneId is used to differentiate between a service's scenarios, assisting scenario-specific data analysis.
Parameters
ParameterDescription
appIdApplication ID issued for application developers
sceneIdDeveloper-customized scenario ID used for subdividing service scenarios; if unnecessary, fill 0
delegateCallback. See details in ThunderEventDelegate.
Return
  • ThunderEngine instance object

ThunderEngine::destroyEngine

+ (void)destroyEngine;

Destroy a ThunderEngine instance

Notes:

  • Releases all resources used by the SDK.
  • Call this API for applications in which users occasionally make audio or video calls. When users do not make calls, you can free up resources for other operations.
  • Once destroyEngine is called, the user cannot call or call back other APIs in the SDK.
  • To re-enable real-time communication, call createEngine again to create a new ThunderEngine instance.
  • The created file player object ThunderAudioFilePlayer will also be released.

ThunderEngine::getVersion

+ (NSString * _Nonnull)getVersion;

Get SDK version number.

Notes:

  • This API returns the SDK’s version number string.
Return
  • SDK version number string

ThunderEngine::setSceneId:

- (void)setSceneId:(NSInteger)sceneId;

Set scenario ID.

Parameters
ParameterDescription
sceneIdDeveloper-customized scenario ID used for subdividing service scenarios; if unnecessary, fill 0

ThunderEngine::setThunderEventDelegate:

- (void)setThunderEventDelegate:(id<ThunderEventDelegate> _Nullable)delegate;

Set a proxy API.

Parameters
ParameterDescription
delegateSee proxy APIs in ThunderEventDelegate.

ThunderEngine::setArea:

- (int)setArea:(ThunderRtcAreaType)area

Set a user's country/region.

To accommodate differing laws and regulations, Jocloud has central systems each for domestic (default) and international users. Set area as follows:

  • If applications are mainly conducted overseas, set the area to abroad via this API.
  • Users in one central system (domestic or abroad) cannot communicate with ones in the other, so you must be sure that users in the same room are also in the same system.
  • The two systems are deployed globally, supporting global access.

Notes:

  • This API should be called before joinRoom, and it is required for international users.
  • The available parameters are listed in ThunderRtcAreaType.
  • This API can only be reset by calling destroyEngine.
ParameterDescription
areaThe default region setting is domestic. See details in ThunderRtcAreaType.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::joinRoom:roomName:uid:

-(int)joinRoom:(NSString * _Nullable)token
      roomName:(NSString * _Nonnull)roomName
           uid:(NSString * _Nonnull)uid;

Join a room.

  • You can call this API to join a (audio/video) call room. Users in the same room can communicate with each other. When several users join a room, they can group chat.
  • You must call leaveRoom to the current call before joining another room.

Notes:

-Users with different AppIDs cannot call each other. -Successful function return only indicates that the request has executed successfully. Successful joining of a room is indicated by the callback onJoinRoomSuccess.

  • When background is set to appid mode, token value is null.
Parameters
ParameterDescription
tokenToken for authentication, see detailed operations in User Authentication.
roomNameRoom name (unique to each application ID), which only supports a combination of characters such as [A,Z],[a,z],[0,9],-,_ , and cannot exceed 64 bytes.
uidUser ID, which only supports a combination of characters such as [A,Z],[a,z],[0,9],-,_, and cannot exceed 64 bytes.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::leaveRoom

- (int)leaveRoom;

Exit a room to end a call.

Notes:

  • Once joinRoom is called, you have to call leaveRoom to end the call before joining another one.
  • Whether you are in a call or not, leaveRoom can be called to end the call and release all related resources.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::updateToken:

- (int)updateToken:(NSString * _Nonnull)token;

This method is used to update Token and authenticate service.

Notes:

uint16uint32uint64uint64uint32uint16nBytes20 Bytes
TokenLenAppIduidTimeStamp(ms)ValidTime(s)BizExtInfoLenBizExtInfoDataDigitalSignature
  1. The multi-byte integer uses network byte order, generally big endian.
  2. TokenLen: the length of the whole token includes its 2 bytes and abstract.
  3. Token expiration time=Timestamp+ValidTime*1000, the UTC time in millisecond since 1970.
  4. BizExtInfoData: service authentication extension information should be customized by the service personnel.
  5. DigitalSignature: digital signature adopts the hmac-sha1 algorithm to calculate all data before DigitalSignature to get the [TokenLen,BizExtInfoData]. AppSecret distributed in application of appId is used as the key.
  6. Token has to be transmitted by HTTP, so the entire Token must be encoded by URL base64. Note that URL encoding is not performed for the whole base64.
Parameters
ParameterDescription
tokenToken for authentication, see details in User Authentication.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLogFilePath:

- (int)setLogFilePath:(NSString * _Nonnull)filePath;

Set directory for SDK to output log files. A directory with write permissions must be specified.

Notes:

-One of two ways to output SDK logs. The application specifies the output directory and ensures its writability, and the SDK will output logs to this directory.

  • Set log callback. Once log callback is set, setLogFilePath is invalid.
Parameters
ParameterDescription
filePathComplete list of log files
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLogCallback:

- (int)setLogCallback:(nullable id<ThunderRtcLogDelegate>)delegate

Set log callback output.

Notes:

  • One of two ways to output SDK logs. The SDK calls back log messages to the application for writing.
  • After log callback is set, setLogFilePath will be invalid.
Parameters
ParameterDescription
delegateSee details in ThunderRtcLogDelegate for log protocol.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLogLevel:

- (int)setLogLevel:(ThunderRtcLogLevel)level;

Set level for filtering log output.

Notes:

  • Set log output filtering level, which is to be invoked before setLogFilePath or setLogCallback. Without calling this API, the default log level THUNDER_LOG_LEVEL_INFO will be used.
Parameters
ParameterDescription
levelSee details in ThunderRtcLogLevel for log level.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::addPublishOriginStreamUrl:

- (int)addPublishOriginStreamUrl:(NSString* _Nonnull)url;

Add source stream pushing address.

Notes:

  • After this API is called, the anchor's current audio/video stream will be pushed to the specified CDN address. To update URL, first call the removePublishOriginStreamUrl, and add after removing the original address.
  • With this API, only one-channel stream pushing addresses can be added each time. If multi-channel streams need to be pushed, this API has to be called repeatedly. A maximum of five addresses are supported for stream pushing.
  • The server will push the source stream to the corresponding URL after publishing. It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
Parameters
ParameterDescription
urlCDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::removePublishOriginStreamUrl:

- (int)removePublishOriginStreamUrl:(NSString* _Nonnull)url;

Remove source stream pushing address.

Notes:

  • After this API is called, the anchor's current audio/video stream will not be pushed to the specified CDN address.
Parameters
ParameterDescription
urlCDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud supports merely 256 bytes.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLiveTranscodingTask:transcoding:

- (int)setLiveTranscodingTask:(NSString* _Nonnull)taskId transcoding:(LiveTranscoding* _Nonnull)transcoding;

Add/update stream mixing taskLiveTranscoding.

Notes:

  • After this API is called, the Jocloud background will start the stream mixing and transcoding tasks, and start the video mixing and audio mixing with all source streams set. The application needs specific stream mixing IDs to differentiate different stream mixing tasks.
  • This API can be called repeatedly to update stream mixing parameters during the process. Multiple stream mixing tasks can be set in the same room.
  • It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
  • The stream pushing address can be added to stream mixing and transcoding tasks with the addPublishTranscodingStreamUrl. The stream mixing and transcoding will be pushed to the specified address after stream mixing and transcoding operations are complete.
Parameters
ParameterDescription
taskIdThe stream mixing task ID is generated by the application. It must be globally unique
transcodingSee details in LiveTranscoding for information about stream mixing configuration.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::addPublishTranscodingStreamUrl:url:

- (int)addPublishTranscodingStreamUrl:(NSString* _Nonnull)taskId url:(NSString* _Nonnull)url;

Add mixed stream pushing address.

Notes:

  • Call this API after adding transcoding task by calling setLiveTranscodingTask. -After this API is called, the specified mixed stream will be pushed to the specified CDN address. To update URL, first call the removePublishTranscodingStreamUrl and add after removing the original address.
  • Add a stream pushing address for specified a transcoding task; only one address can be added at a time. If multiple-channel streams have to be pushed, call this API multiple times. At most five stream pushing addresses are supported for one transcoding task.
  • It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
Parameters
ParameterDescription
taskIdStream mixing task ID
urlCDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::removePublishTranscodingStreamUrl:url:

- (int)removePublishTranscodingStreamUrl:(NSString* _Nonnull)taskId url:(NSString* _Nonnull)url;

Remove mixed stream pushing address.

Notes:

  • After this API is called, the specified mixed stream will not be pushed to the specified CDN address.
  • With this API, only single-channel stream pushing address can be deleted each time. If multi-channel streams need to be removed, this API has to be called repeatedly.
  • Call it after joining a room joinRoom.
Parameters
ParameterDescription
taskIdStream mixing task ID
urlCDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::removeLiveTranscodingTask:

- (int)removeLiveTranscodingTask:(NSString* _Nonnull)taskId;

Remove the stream mixing task.

Notes:

  • After this API is called, the Jocloud background will remove and stop the stream mixing task, but the URL added by the addPublishTranscodingStreamUrl will not be removed.
Parameters
ParameterDescription
taskIdThe stream mixing task ID is generated by the application. It must be globally unique
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::addSubscribe:uid:

- (int)addSubscribe:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid;

Cross-room subscription.

Notes:

  • Subscribe to the audio/video streams of other rooms after joining a room. In other words, this function can be called after joining a room joinRoom,and the configuration will be cleared after exiting the room.
Parameters
ParameterDescription
roomIdRoom No.
uidUser ID
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::removeSubscribe:uid:

- (int)removeSubscribe:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid;

Remove cross-room subscription.

Notes:

  • Call this API to remove audio/video stream subscriptions to other rooms. This has the opposite effect of the addSubscribe. It can only be called after joining the room joinRoom.
Parameters
ParameterDescription
roomIdRoom No.
uidUser ID
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setMediaMode:

- (int)setMediaMode:(ThunderRtcConfig)mode;

Set the SDK media mode.

Notes:

  • Media modes for the SDK include both audio-only and A/V(audio/video) modes. This API shall be called before joining a room, and is invalid after joining the room. If not called, the default mode is audio/video.
Parameters
ParameterDescription
modeSee details in ThunderRtcConfig for media mode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setRoomMode:

- (int)setRoomMode:(ThunderRtcRoomConfig)mode;

Set the room scenario mode.

Notes:

  • This API is for setting the room scenario mode. Live streaming mode is by default upon non-callback. It can be used before and after joining the room.
  • By knowing the application scenario (e.g. communication mode, live streaming mode), the SDK can apply different optimization APIs.
Parameters
ParameterDescription
modeSee details in ThunderRtcRoomConfig for media mode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableWebSdkCompatibility:

- (int)enableWebSdkCompatibility:(BOOL)enabled;

Enable/disable WebSDK compatibility.

Notes:

  • Applicable only to live streaming scenarios.
  • Enabling WebSDK compatibility internally prohibits B-frames, because WebSDK cannot normally decode B-frames. It should be called before publishing. -Co-hosting is compatible with Web SDK by default, without the need to call this API.
Parameters
ParameterDescription
enabledYES: compatible
NO: incompatible
(default)
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setVideoEncoderConfig:

- (int)setVideoEncoderConfig:(ThunderVideoEncoderConfiguration* _Nonnull)config;

Set video encoding profile.

Notes:

  • The SDK will obtain specific parameters for encoding video from the configuration server. If you have special parameter requirements for encoding video, you may contact customer support for personalized configuration.
  • If video has been published, update the video encoding parameters. Local preview and remote subscription will be able to see the updated effect.
Parameters
ParameterDescription
configSee details in ThunderVideoEncoderConfiguration for encoding configuration.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLocalVideoCanvas:

- (int)setLocalVideoCanvas:(ThunderVideoCanvas *_Nullable)local;

Set local view.

Notes:

  • If this window is not set, you can still preview and publish. You can view locally captured pictures by setting this window.
Parameters
ParameterDescription
localSee details in ThunderVideoCanvas for specific rendering settings.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setRemotePlayType:

- (int)setRemotePlayType:(ThunderRtcRemotePlayType)remotePlayType;

Set the remote view mode.

Notes:

  • Set whether to enable remote view of multi-person co-hosting and enter many-to-many mode. Call before joining the channel after “initialization”.
Parameters
ParameterDescription
remotePlayTypeSee details in ThunderRtcRemotePlayType for view display mode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setMultiVideoViewLayout:

- (int)setMultiVideoViewLayout:(ThunderMultiVideoViewParam* _Nonnull)params;

Set multi-person co-hosting layout.

Notes:

  • For setting the multi-person co-hosting layout, call before joining the channel, after “initialization”.
Parameters
ParameterDescription
paramsSee details in ThunderMultiVideoViewParam for specific co-hosting layout.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setRemoteVideoCanvas:

- (int)setRemoteVideoCanvas:(ThunderVideoCanvas *_Nonnull)remote;

Set remote user view.

Notes:

  • You can subscribe without setting this window. By setting this window, you can see the corresponding video of remote users who subscribed.
Parameters
ParameterDescription
remoteSee details in ThunderVideoCanvas for specific view setting.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLocalCanvasScaleMode:

- (int)setLocalCanvasScaleMode:(ThunderVideoRenderMode)mode;

Set local view mode.

Parameters
ParameterDescription
modeSee details in ThunderVideoRenderMode
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setRemoteCanvasScaleMode:mode:

- (int)setRemoteCanvasScaleMode:(NSString* _Nonnull)uid mode:(ThunderVideoRenderMode)mode;

Set the remote view mode.

Parameters
ParameterDescription
uidUser ID
modeSee details in ThunderVideoRenderMode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::startVideoPreview

- (int)startVideoPreview;

Enable video preview.

Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopVideoPreview

- (int)stopVideoPreview;

Disable video preview.

Notes:

  • Disabling preview will stop video.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableLocalVideoCapture:

- (int)enableLocalVideoCapture:(BOOL)enabled;

Enable/disable local video capture.

Parameters
ParameterDescription
enabledYES: enable local video capture
NO: disable local video capture
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopLocalVideoStream:

- (int)stopLocalVideoStream:(BOOL)stopped;

Enable/disable local video stream transmission.

Notes:

  • Call this API after joining the room via (joinRoom).
Parameters
ParameterDescription
stoppedYES: disable local video transmission
NO: enable local video transmission
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopAllRemoteVideoStreams:

- (int)stopAllRemoteVideoStreams:(BOOL)stopped;

Stop/resume receiving all video streams.

Notes:

  • After setting "stop" to "false", all video streams in the room will be subscribed to automatically. You can unsubscribe to a specific stream via stopRemoteVideoStream.
  • After setting "stop" to "true“, no video streams in the room will be subscribed to. You can subscribe to a specific stream via stopRemoteVideoStream.
  • This API has no precedence relationship with stopRemoteVideoStream, and the last called API is effective.
Parameters
ParameterDescription
stoppedYES: receive none
NO: receive all
(default)
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopRemoteVideoStream:stopped:

- (int)stopRemoteVideoStream:(NSString* _Nonnull)uid stopped:(BOOL)stopped;

Stop/resume receiving specified video stream.

Notes:

Parameters
ParameterDescription
uidUser ID
stoppedYES: stop receiving remote video streams of specified users
NO: start receiving remote video streams of specified users
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setCustomVideoSource:

- (void)setCustomVideoSource:(id<ThunderCustomVideoSourceProtocol> _Nullable)videoSource;

Set customized video source.

Notes:

<<<<<<< HEAD:en/product_category/rtc_service/rt_audio_interaction/api/iOS/v2.9.20/function.md

  • In real-time communication, Jocloud SDK usually enables the default video input device, i.e. the built-in camera, for video pushing. To customize video device, the application can customize an object to realize ThunderCustomVideoSourceProtocol protocol, and call this method to add the customized video source to the SDK. =======
  • In real-time communication, Jocloud SDK usually enables the default video input device, i.e. the built-in camera, for video pushing. To customize video device, the application can customize an object to realize ThunderCustomVideoSourceProtocol protocol, and call this method to add the customized video source to the SDK.

域名更换:en/product_category/rtc_service/rt_audio_interaction/api/iOS/v2.9.20/function.md

Parameters
ParameterDescription
videoSourceSee details in ThunderCustomVideoSourceProtocol.

ThunderEngine::setVideoWatermark:

- (int)setVideoWatermark:(ThunderImage *_Nonnull)watermark;

Set local video watermark.

Notes:

  • This API adds a PNG-format image as a watermark for publishing along with local video.
  • If the PNG image size is incompatible with your method settings, the SDK will clip it to match.
  • Only one watermark can be added to live video, and any watermark added later will replace the former one.
  • The watermark will rotate along with any display rotation.
Parameters
ParameterDescription
watermarkWatermark name
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::registerVideoDecodeFrameObserver:uid:

-(int)registerVideoDecodeFrameObserver:(nullable id<ThunderDecodeFrameObserver>)delegate uid:(nonnull NSString*)uid;

Customize decoding picture rendering.

Parameters
ParameterDescription
delegateSee details in ThunderVideoDecodeFrameObserver for API of capturing decoding image.
uidIndicate the video stream of the user ID to be obtained
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::registerVideoCaptureFrameObserver:

-(int)registerVideoCaptureFrameObserver:(nullable id<ThunderVideoCaptureObserver>)delegate;

Customize image pre-processing function.

Parameters
ParameterDescription
delegateSee details in ThunderVideoCaptureFrameObserver for pre-processing API for local video frame.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::switchFrontCamera:

- (int)switchFrontCamera:(BOOL)bFront;

Switch to front/rear camera.

Notes:

  • Call this API to switcht to front/rear camera. After the startVideoPreview is called, the callback is effective. The front camera is enabled by default when the API is not called.
Parameters
ParameterDescription
bFrontYES: enable front camera NO: enable rear camera
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setVideoCaptureOrientation:

- (int)setVideoCaptureOrientation:(ThunderVideoCaptureOrientation)orientation;

Set portrait and landscape.

Notes:

  • Call this API to set portrait and landscape. It can be called either before preview startVideoPreview, or during the publishing. If not called, the portrait orientation is applied by default.
Parameters
ParameterDescription
orientationSee details in ThunderVideoCaptureOrientation for portrait and landscape.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLocalVideoMirrorMode:

- (int)setLocalVideoMirrorMode:(ThunderVideoMirrorMode)mode;

Set camera mirror.

Notes:

  • Call this API to set camera mirror before preview startVideoPreview, or during the publishing.
  • Applicable to the front camera only.
  • Preview and stream pushing are not mirrored for rear camera. Preview is mirrored but stream pushing is not mirrored for front camera by default.
Parameter
ParameterDescription
modeSee details in ThunderVideoMirrorMode for mirror mode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableLoudspeaker:

- (int)enableLoudspeaker:(BOOL)enableSpeaker;

Enable/disable loudspeaker.

Notes:

  • You can call this API to forcibly set the audio router as loudspeaker.
Parameters
ParameterDescription
enabledYES: play with loudspeaker
NO: play with receiver
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::isLoudspeakerEnabled

- (BOOL)isLoudspeakerEnabled;

Query loudspeaker status.

Return
  • YES: output to loudspeaker
  • NO: output to device other than loudspeaker (receiver, earphone, etc.)

ThunderEngine::setAudioConfig:commutMode:scenarioMode:

- (int)setAudioConfig:(ThunderRtcAudioConfig)config
           commutMode:(ThunderRtcCommutMode)commutMode
         scenarioMode:(ThunderRtcScenarioMode)scenarioMode;

Set audio profiles.

Notes:

  • This API is used to set audio parameters and application scenarios.
Parameters
ParameterDescription
configSee details in ThunderRtcAudioConfig.
commuModeSee details in ThunderRtcCommutMode for setting interaction mode.
scenarioModeSee details in ThunderRtcScenarioMode for setting scenario mode.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setAudioVolumeIndication:moreThanThd:lessThanThd:smooth

- (int)setAudioVolumeIndication:(NSInteger)interval
                    moreThanThd:(NSInteger)moreThanThd
                    lessThanThd:(NSInteger)lessThanThd
                         smooth:(NSInteger)smooth;

Enable the speaker volume prompt.

Notes:

  • This API enables the SDK to report that who is talking and the speaker's volume.
  • Return via onPlayVolumeIndication.
  • The volume does not include the volume captured by local microphone or the volume of the audio file being played.
Parameters
ParameterDescription
intervalCallback interval =0 by default
<=0, the volume prompt is disabled,
>0, callback interval (ms)
moreThanThdFrom =moreThanThd, immediate callback once (not subject to interval)
<= 0 invalid, range: [0,100], default value: 0
lessThanThdFrom >= lessThanThd to < lessThanThd, immediate callback once (not subject to interval)
<= 0 invalid, range: [0,100], default value: 0
smoothInvalid momentarily
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableCaptureVolumeIndication:moreThanThd:lessThanThd:smooth:

- (int)enableCaptureVolumeIndication:(NSInteger)interval
                         moreThanThd:(NSInteger)moreThanThd
                         lessThanThd:(NSInteger)lessThanThd
                              smooth:(NSInteger)smooth;

Enable/disable capture volume callback.

Notes:

  • This API enables the SDK to periodically send the application feedback on current microphone capture volume.
  • Return via onCaptureVolumeIndication.
Parameters
ParameterDescription
intervalCallback interval;
<=0, the volume prompt is disabled,
>0, callback interval (unit: ms),
=0 by default
moreThanThdFrom < moreThanThd to >=moreThanThd, immediate callback once (not subject to interval)
<= 0 invalid, range: [0,100], default value: 0
lessThanThdFrom >= lessThanThd to < lessThanThd, immediate callback once (not subject to interval)
<= 0 invalid, range: [0,100], default value: 0
smoothInvalid momentarily
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopLocalAudioStream:

- (int)stopLocalAudioStream:(BOOL)stopped;

Enable/disable local audio sending.

Notes:

  • This API is used to enable/disable sending local audio stream to the network.
  • This API is called after joining a room joinRoom
Parameters
ParameterDescription
stoppedYES: disable local audio sending
NO: enable local audio sending
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopAllRemoteAudioStreams:

- (int)stopAllRemoteAudioStreams:(BOOL)stopped;

Stop/resume receiving all audio streams.

Notes:

  • After setting "stop" to "NO", all video streams in the room will be subscribed to automatically. You can unsubscribe to a specific stream via stopRemoteAudioStream.
  • After setting "stop" to "YES“, no video streams in the room will be subscribed to. You can subscribe to a specific stream via stopRemoteAudioStream.
  • This API has no precedence relationship with stopRemoteAudioStream, and the last called API is effective.
Parameters
ParameterDescription
stoppedYES: receive none
NO: receive all
(default)
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::stopRemoteAudioStream:stopped:

- (int)stopRemoteAudioStream:(nonnull NSString*)uid stopped:(BOOL)stopped;

Stop/resume receiving specified video stream.

Notes:

Parameters
ParameterDescription
uidUser ID
stoppedYES: stop receiving the remote audio stream of specified users
NO: start receiving remote audio stream of specified users
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLoudSpeakerVolume:

- (int)setLoudSpeakerVolume:(NSInteger)volume;

Set the loudspeaker volume.

Parameters
ParameterDescription
volumeVolume, range:[0-400]
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setMicVolume:

- (int)setMicVolume:(NSInteger)volume;

Set microphone volume.

Parameters
ParameterDescription
volumeVolume, range:[0-400]
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setPlayVolume:volume:

- (int)setPlayVolume:(nonnull NSString*)uid volume:(NSInteger)volume;

Set volume for a specified user.

Parameters
ParameterDescription
uidSpecified user ID
volumeVolume, range:[0-400]
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::createAudioFilePlayer

- (nullable ThunderAudioFilePlayer*)createAudioFilePlayer;

Create an object of audio file player. See details in ThunderAudioFilePlayer.


ThunderEngine::destroyAudioFilePlayer:

- (void)destroyAudioFilePlayer:(nonnull ThunderAudioFilePlayer*)filePlayer;

Destroy the object of audio file player.

Parameters
ParameterDescription
filePlayerSee details in ThunderAudioFilePlayer for file player object.

ThunderEngine::setEnableInEarMonitor:

- (int)setEnableInEarMonitor:(BOOL)enabled;

Enable/disable the in-ear monitoring.

Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setEnableEqualizer:

- (int)setEnableEqualizer:(BOOL)enabled;

Enable/disable local voice equalizer.

Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setEqGains:

- (int)setEqGains:(const _Nonnull ThunderEqGainsOc)gains;

Set equalizer parameters.

Parameters
ParameterDescription
gainsSee details in ThunderEqGainsOc for equalizer parameters.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setEnableReverb:

- (int)setEnableReverb:(BOOL)enabled;

Enable/disable local sound reverberation.

Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setReverbParam:

- (int)setReverbParam:(ThunderReverbExParamOc)reverbParam;

Set reverb parameters.

Parameters
ParameterDescription
reverbParamSee details in ThunderReverbExParamOc for reverberation parameters.
Return
  • 0: success.
  • See details inThunderRet for other errors.

ThunderEngine::setEnableCompressor:

- (int)setEnableCompressor:(BOOL)enabled;

Enable/disable sound compressor.

Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setCompressorParam:

- (int)setCompressorParam:(ThunderCprParamOc)parameter;

Set compressor parameters.

Parameters
ParameterDescription
parameterSee details in ThunderCprParamOc for compressor parameters.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setEnableLimiter:

- (int)setEnableLimiter:(BOOL)enabled;

Enable/disable pressure limiter.

Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setLimiterParam:

- (int)setLimiterParam:(ThunderLimiterParamOc)parameter;

Set pressure limiter parameters.

Parameters
ParameterDescription
parameterSee details in ThunderLimiterParamOc for pressure limiter parameters.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setAudioSourceType:

- (void)setAudioSourceType:(ThunderSourceType)sourceType;

Set the audio publishing mode.

Parameters
ParameterDescription
sourceTypeSee details in ThunderSourceType for audio publishing mode.

ThunderEngine::enableAudioPlaySpectrum:

- (void)enableAudioPlaySpectrum:(Boolean)enable;

Enable/disable the callback of audio play spectrum data.

Parameters
ParameterDescription
enableYES: enable
NO: disable

ThunderEngine::setAudioPlaySpectrumInfo:notifyIntervalMS:

- (void)setAudioPlaySpectrumInfo:(UInt32)spectrumLen notifyIntervalMS:(UInt32)notifyIntervalMS;

Set playing spectrum parameters.

Parameters
ParameterDescription
spectrumLenThe length of the spectrum data, range: [12-256], default: 256
notifyIntervalMSCallback interval (ms), which should be a multiple of 10, and the default value is 30 ms

ThunderEngine::sendUserAppMsgData:

- (int)sendUserAppMsgData:(NSData * _Nonnull)msgData

Send service-customized broadcast message.

Notes:

  • Send service-customized broadcast message in the room. Call this API to send messages via the UDP channel, which may be unreliable and low-latency. Constraints are as follows:
    1. The sender must join the room.
    1. The API can only be called after successfully connecting the microphone (messages cannot be sent if there is only audience or if broadcast authentication fails).
    1. This API can be called no more than twice/second, and the msgData size cannot exceed 200 Byte.
    1. msg will be dropped if any of the above conditions are unmet.
    1. There is no guarantee that messages will be delivered to all online users in the room, and no guarantee that they will be delivered in order.
  • Call back customized broadcast message sent by other users to the application via onRecvUserAppMsgData. -You can get the cause of msg sending failure via onSendAppMsgDataFailedStatus.
Parameters
ParameterDescription
msgDataMessage sent
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::sendMediaExtraInfo:

- (int)sendMediaExtraInfo:(NSData * _Nonnull)data;

Send SEI.

Use video channel when uploading video, otherwise use audio channel.

Notes:

  • The sender must join the room, and call it after successfully publishing the audio.
  • Audio-only broadcast (publishing in an audio-only mode or only publishing audio in an audio/video mode) calling frequency cannot exceed once every 100 ms. If video publishing in audio/video mode, calling frequency cannot exceed the frame rate. For example: stream pushing adopts a default frame rate of 15 fps, meaning that the frequency of calling cannot exceed 1000/15=66.7 ms per occurrence.
  • If only publishing audio (publishing in audio-only mode or publishing only audio in audio/video mode), SEI cannot exceed 200 bytes; if video publishing in audio/video mode, SEI must not exceed 2048 bytes.
  • Packet loss may occur.
  • You can get the cause of SEI sending failure by calling onSendMediaExtraInfoFailedStatus under proxy of ThunderMediaExtraInfoDelegate.
  • Call back SEI sent by other users to the application via onRecvMediaExtraInfo under proxy of ThunderMediaExtraInfoDelegate.
Parameters
ParameterDescription
DateSEI data to be transmitted
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setMediaExtraInfoDelegate:

- (int)setMediaExtraInfoDelegate:(nullable id<ThunderMediaExtraInfoDelegate>)delegate;

Set callback monitoring for SEI.

Parameters
ParameterDescription
delegateSee details in ThunderMediaExtraInfoDelegate.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableMixVideoExtraInfo:

- (int)enableMixVideoExtraInfo:(BOOL)enable;

Enable/disable video mixing with SEI. For example: video mixing with layout information.

When enabled, callback of onRecvMixVideoInfo can be received when the mixed video stream is played at the audience end.

Parameters
ParameterDescription
enableWhether to enable video mixing with SEI.
YES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::startAudioSaver:saverMode:fileMode:

- (BOOL)startAudioSaver:(NSString* _Nonnull)fileName saverMode:(ThunderSaverMode)saverMode fileMode:(ThunderFileMode)fileMode

Start saving audio data as files in AAC format.

Parameters
ParameterDescription
fileNameFile saving path, which must be a full path with the file name and postfix .aac.
saverModeAudio saving mode. See details in ThunderSaverMode.
fileModeAudio file writing mode. See details in ThunderFileMode.
Return
  • YES: success
  • NO: failure

ThunderEngine::stopAudioSaver

- (BOOL)stopAudioSaver

Stop saving audio files in acc format.

Return
  • YES: success
  • NO: failure

ThunderEngine::setSoundEffect:

-(void)setSoundEffect:(NSInteger)mode

Set the audio effect mode.

Parameters
ParameterDescription
modeAudio saving mode THUNDER_SOUND_EFFECT_MODE_NONE(0):Disable mode
THUNDER_SOUND_EFFECT_MODE_VALLEY(1): VALLEY mode
THUNDER_SOUND_EFFECT_MODE_RANDB(2):R&B mode
THUNDER_SOUND_EFFECT_MODE_KTV(3):KTV mode
THUNDER_SOUND_EFFECT_MODE_CHARMING(4):CHARMING mode
THUNDER_SOUND_EFFECT_MODE_POP(5): Pop mode
THUNDER_SOUND_EFFECT_MODE_HIPHOP(6): Hiphop mode
THUNDER_SOUND_EFFECT_MODE_ROCK(7): Rock mode
THUNDER_SOUND_EFFECT_MODE_CONCERT(8): Concert mode
THUNDER_SOUND_EFFECT_MODE_STUDIO(9): Studio mode

ThunderEngine::setVoiceChanger:

- (void)setVoiceChanger:(int32_t)mode;

Set the voice change mode.

Parameters
ParameterDescription
modeAudio saving mode THUNDER_SOUND_EFFECT_MODE_NONE(0):Disable mode
THUNDER_SOUND_EFFECT_MODE_VALLEY(1): VALLEY mode
THUNDER_SOUND_EFFECT_MODE_RANDB(2):R&B mode
THUNDER_SOUND_EFFECT_MODE_KTV(3):KTV mode
THUNDER_SOUND_EFFECT_MODE_CHARMING(4):CHARMING mode
THUNDER_SOUND_EFFECT_MODE_POP(5): Pop mode
THUNDER_SOUND_EFFECT_MODE_HIPHOP(6): Hiphop mode
THUNDER_SOUND_EFFECT_MODE_ROCK(7): Rock mode
THUNDER_SOUND_EFFECT_MODE_CONCERT(8): Concert mode
THUNDER_SOUND_EFFECT_MODE_STUDIO(9): Studio mode

ThunderEngine::setRecordingAudioFrameParameters:channel:mode:samplesPerCall:

- (int)setRecordingAudioFrameParameters:(NSInteger)sampleRate
                                channel:(NSInteger)channel
                                   mode:(ThunderAudioRawFrameOperationMode)mode
                         samplesPerCall:(NSInteger)samplesPerCall;

Set recorded audio format.

Parameters
ParameterDescription
sampleRateSampling rate
channelAudio channel; 1: single channel; 2: dual channel
modeSee details in ThunderAudioRawFrameOperationMode for use mode of onRecordAudioFrame.
samplesPerCallSpecify sampling number of data returned in onRecordAudioFrame. For example, usually the sampling number in applications of transcoding stream pushing is 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01 (s).
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setPlaybackAudioFrameParameters:channel:mode:samplesPerCall:

- (int)setPlaybackAudioFrameParameters:(NSInteger)sampleRate
                               channel:(NSInteger)channel
                                  mode:(ThunderAudioRawFrameOperationMode)mode
                        samplesPerCall:(NSInteger)samplesPerCall;

Set played audio format.

Parameters
ParameterDescription
sampleRateSampling rate
channelAudio channel; 1: single channel; 2: dual channel
modeSee details in ThunderAudioRawFrameOperationMode, for use mode of onRecordAudioFrame.
samplesPerCallSpecify sampling number of data returned in onRecordAudioFrame, For example, usually the sampling number in applications of transcoding stream pushing is 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01 (s).
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::enableCustomAudioSource:channelsPerFrame:

- (int)enableCustomAudioSource:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame;

Set external audio capture parameters.

Notes:

  • Call this API before audio publishing.
Parameters
ParameterDescription
sampleRateThe external audio source sampling rate can be 8000, 16000, 32000, 44100 or 48000
channelsPerFrameNumber of external audio source channels (supports two at most)
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::disableCustomAudioSource

- (int)disableCustomAudioSource;

Disable external audio sampling parameters.

Notes:

  • Call this API after disabling audio publishing.
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::pushCustomAudioRawData:samples:timestamp:

- (BOOL)pushCustomAudioRawData:(void *_Nonnull)data samples:(NSUInteger)samples timestamp:(NSTimeInterval)timestamp;

Push external audio stream.

Parameters
ParameterDescription
DateExternal audio data
samplesThe number of samples of corresponding audio data
timeStampTimestamps of external audio data are used to synchronize external video sources
Return
  • YES: API calling succeeded
  • NO: API calling failed

ThunderEngine::pushCustomAudioSampleBuffer:

- (BOOL)pushCustomAudioSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;

Push external audio frames.

Parameters
ParameterDescription
sampleBufferExternal audio frame
Return
  • YES: API calling succeeded
  • NO: API calling failed

ThunderEngine::enableVoicePosition:

- (int)enableVoicePosition:(BOOL)enabled;

Enable/disable remote user voice stereo.

Notes:

  • Make sure to call this API before calling joinRoom.
Parameters
ParameterDescription
enabledYES: enable
NO: disable
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderEngine::setRemoteUidVoicePosition:azimuth:gain:

- (int)setRemoteUidVoicePosition(nonnull NSString*)uid azimuth:(NSInteger)azimuth gain:(NSInteger)gain

Set the sound position and volume of a remote user.

Parameters
ParameterDescription
uidRemote user ID
azimuthSet vocal positions of a remote user, with a value range of [-90,90]. 0: (default) voice comes from directly ahead. -90: voice comes from the left. 90: voice comes from the right
gainSet vocal volume of a remote user, with a value range of [0,100]. The default value is 100.0, indicating a user's original volume. The smaller the value, the lower the volume
Return
  • 0: return when API calling succeeded
  • < 0: return when calling failed

ThunderEngine::getVideoEncoderParam:

- (ThunderVideoEncodeParam* _Nonnull) getVideoEncoderParam:(ThunderVideoEncoderConfiguration* _Nonnull)config

Get video encoding paraenmeters.

Parameters
ParameterDescription
configEncoding configuration, see details in ThunderVideoEncoderConfiguration.
Return

ThunderEngine::getConnectionStatus

- (ThunderConnectionStatus)getConnectionStatus

Search for network connection status.

Return

ThunderEngine::setVoicePitch:

- (int)setVoicePitch:(float)pitch;

Set the voice pitch.

Note:

  • This API can be called after initialization and be reset only by calling destroyEngine.
  • The samller the value, the lower the voice pitch.
Parameter
ParameterDescription
pitchVoice pitch, range: [-12,12]; default value: 0
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderEngine::enableHowlingDetector:

- (int)enableHowlingDetector:(BOOL)enabled;

Whether to enable howling detection.

Note:

This API should be calledafter initialization and reset by calling destroyEngine. The detection results will be reported via the callback onHowlingDetectResult.

Parameter
ParameterDescription
enabledWhether to enable howling detection: "true"-enable, "false"-disable (default)
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderEngine::enableEchoDetector:

- (int)enableEchoDetector:(BOOL)enabled;

Enable/disable echo detection.

Note:

This API should be called after initialization and reset by calling destroyEngine. The detection results will be reported via the callback onEchoDetectResult.

Parameter
ParameterDescription
enabledWhether to enable echo detection: "true"-enable, "false"(default)-disable
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderEngine::isCameraManualFocusPositionSupported:

- (BOOL)isCameraManualFocusPositionSupported;

Whether the camera supports manual focus.

Note:

  • Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
Return
  • Return "YES" for supporting and return "NO" for not supporting.

ThunderEngine::isCameraManualExposurePositionSupported:

- (BOOL)isCameraManualExposurePositionSupported;

Whether the camera supports manual exposure.

Note:

  • Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
Return
  • Return "YES" for supporting and return "NO" for not supporting.

ThunderEngine::setCameraZoomFactor:

- (CGFloat)setCameraZoomFactor:(CGFloat)zoomFactor;

Set camera zoom scale.

Note:

-Return the maximum zoom value if the zoomFactor exceeds the maximum value. -Return the minimum zoom value if the zoomFactor is smaller than the minimum value.

  • Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
  • After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
Parameter
ParameterDescription
zoomFactorZoom scale
Return
  • Return zoom scale for success, return <0 for failure.

ThunderEngine::setCameraFocusPosition:

- (int)setCameraFocusPosition:(CGPoint)position;

Set camera focus position.

Note:

  • After this API is called, onCameraExposureAreaChanged will be triggered.
  • Default to set the front camera, if you need to set the rear camera, first call switchFrontCamera to swith cameras.
  • After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
  • When significant changes in the main area of the video are detected, the focus and exposure are automatically adjusted.
Parameter
ParameterDescription
positionFocus position, range: (0,0) to (1,1), default:(0.5,0.5)
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderEngine::setCameraExposurePosition:

- (int)setCameraExposurePosition:(CGPoint)position;

Set camera exposure position.

Note:

  • After this API is called, onCameraExposureAreaChanged will be triggered.
  • Default to set the front camera, if you need to set the rear camera, first call switchFrontCamera to swith cameras.
  • After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
  • When significant changes in the main area of the video are detected, the focus and exposure are automatically adjusted.
Parameter
ParameterDescription
positionExposure position, range: (0,0) to (1,1), default:(0.5,0.5)
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderEngine::setMixedAudioFrameParameters:

- (int)setMixedAudioFrameParameters:(NSInteger)sampleRate
								channel:(NSInteger)channel
						 samplesPerCall:(NSInteger)samplesPerCall;

Set the audio data mixed with the captured data and the playback data.

Parameter
ParameterDescription
sampleRateSample rate
channelAudio channels; 1-Mono, 2-Stereo
samplesPerCallSample rate, SamplesPerCall = (int)(SampleRate × sampleInterval), sample ≥ 0.01, unit: seconds
Return
  • 0: Success
  • <0: Failure, see details in ThunderRet

ThunderVideoFrameConsumer

ThunderVideoFrameConsumer::consumePixelBuffer:withTimestamp:rotation:

- (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
             withTimestamp:(CMTime)timestamp
                  rotation:(ThunderVideoRotation)rotation;

API for pushing video frame.

Parameters
ParameterDescription
pixelBufferRaw video data (a frame)
timestampThe current frame displays the system time (ms). The developer must set a timestamp for each video frame.
rotationSee details in ThunderVideoRotation for clockwise rotation angle of the video.

ThunderVideoFrameConsumer::consumeRawData:withTimestamp:format:size:rotation

- (void)consumeRawData:(void *_Nonnull)rawData
         withTimestamp:(CMTime)timestamp
                format:(ThunderVideoPixelFormat)format
                  size:(CGSize)size
              rotation:(ThunderVideoRotation)rotation;

API for pushing raw video data.

Parameters
ParameterDescription
rawDataRaw video data (a frame)
timestampThe current frame displays the system time (ms). The developer must set a timestamp for each video frame.
formatImage format
sizeSee details in CGSize for raw video data size.
rotationSee details in ThunderVideoRotation for clockwise rotation angle of the video.

ThunderVideoFrameConsumer::consumeCMSampleBuffer:

- (void)consumeCMSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;

API for pushing raw video data.

Parameters
ParameterDescription
sampleBufferRaw video data (a frame)

ThunderAudioFilePlayer

ThunderAudioFilePlayer::setPlayerDelegate:

- (void)setPlayerDelegate:(nullable id<ThunderAudioFilePlayerDelegate>)delegate;

Set event callback of audio output.

Parameters
ParameterDescription
delegateSee details in ThunderAudioFilePlayerDelegate for event callback.

ThunderAudioFilePlayer::open:

- (void)open:(nonnull NSString*)path;

Open an audio file (supports mp3, aac, wav).

Parameters
ParameterDescription
pathFile path

ThunderAudioFilePlayer::close

- (void)close;

Close an audio file.


ThunderAudioFilePlayer::play

- (void)play;

Start playing.


ThunderAudioFilePlayer::stop

- (void)stop;

Stop playing.


ThunderAudioFilePlayer::pause

- (void)pause;

Pause.


ThunderAudioFilePlayer::resume

- (void)resume;

Resume.


ThunderAudioFilePlayer::seek:

- (void)seek:(uint32_t)timeMS;

Skip to play from specified time.

Parameters
ParameterDescription
timeMSPlaying time

ThunderAudioFilePlayer::getTotalPlayTimeMS

- (uint32_t)getTotalPlayTimeMS;

Skip to play from specified time.

Notes:

  • Return the total playing duration (ms).

ThunderAudioFilePlayer::getCurrentPlayTimeMS

- (uint32_t)getCurrentPlayTimeMS;

Get current elapsed play time. Return the duration played (ms).


ThunderAudioFilePlayer::setPlayVolume:

- (void)setPlayVolume:(uint32_t)volume;

Set volume of the file being played.

Parameters
ParameterDescription
volumePlaying volume [0-400]

ThunderAudioFilePlayer::setPlayerLocalVolume:

- (int)setPlayerLocalVolume:(uint32_t)volume;

Adjust local volume for mixed audio file's music.

Notes:

  • Call this API while in channels.
Parameters
ParameterDescription
volumePlaying volume [0-100]
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderAudioFilePlayer::setPlayerPublishVolume:

- (int)setPlayerPublishVolume:(uint32_t)volume;

Adjust remote volume for mixed audio file's music.

Notes:

  • Call this API while in channels.
Parameters
ParameterDescription
volumePlaying volume [0-100]
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderAudioFilePlayer::getPlayerLocalVolume

- (int)getPlayerLocalVolume;

Get music files' local volume.

Return
  • [0-100]: when the API is called successfully, return the volume, range as [0-100]
  • < 0: API calling failed

ThunderAudioFilePlayer::getPlayerPublishVolume

- (int)getPlayerPublishVolume;

Get music files' remote volume.

Return
  • [0-100]: when the API is called successfully, return the volume, range as [0-100]
  • < 0: API calling failed

ThunderAudioFilePlayer::setSemitone:

- (void)setSemitone:(int)val;

Set audio tone.

Parameters
ParameterDescription
valVolume -5, -4, -3, -2, -1, 0(normal), 1, 2, 3, 4, 5

ThunderAudioFilePlayer::setLooping:

- (int)setLooping:(int)cycle;

Set loop playback timing.

Parameters
ParameterDescription
cyclePositive integer: loop count
0: loop canceled
-1: infinite loop
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderAudioFilePlayer::selectAudioTrack:

- (int)selectAudioTrack:(int)trackIndex;

Select audio track.

Parameters
ParameterDescription
trackIndexAudio track index
Return
  • 0: success.
  • See details in ThunderRet for other errors.

ThunderAudioFilePlayer::setTempo:

- (void) setTempo:(float)val

Set audio playback speed.

Parameters
ParametersDescription
valPlayback speed: 0.5 f, 0.75 f, 1.0 f, 1.25 f, 1.5 f, 2.0 f

ThunderAudioFilePlayer::setPosition:

- (void) setPosition:(int)azimuth

Set audio playback direction.

Parameters
ParametersDescription
azimuthPlayback direction: -90~90

ThunderAudioFilePlayer::getAudioTrackCount

-(int)getAudioTrackCount;

Get the number of audio tracks. Return the number of file audio tracks.

Notes:

  • Call this API after receiving the file open success callback AUDIO_PLAY_EVENT_OPEN of onAudioFileStateChange.

ThunderAudioFilePlayer::enablePublish:

- (void)enablePublish:(BOOL)enable;

Whether to use a currently played file as a live accompaniment.

Parameters
ParameterDescription
enableEnable or disable, disable by default

ThunderAudioFilePlayer::enableSpectrum:

- (void)enableSpectrum:(BOOL)enable;

Whether to enable the spectrum.

Parameters
ParameterDescription
enableYES: enable
NO: disable
(default)

ThunderAudioFilePlayer::enableVolumeIndication:interval:

- (void)enableVolumeIndication:(BOOL)enable interval:(int)interval;

Whether to enable the volume callback.

Parameters
ParameterDescription
enableYES: enable
NO: disable
intervalCallback interval

ThunderAudioFilePlayer::setMixStandard:

-(void)setMixStandard:(BOOL)standard;

Whether to set the accompaniment as a standard stream for video mixing.

Parameters
ParameterDescription
standardYES: standard stream
NO: non-standard stream
(default)

ThunderAudioFilePlayer::isMixStandard

-(BOOL)isMixStandard;

Query whether the accompaniment is a mixed video standard stream.

Return
  • YES: standard stream
  • NO: non-standard stream

ThunderAudioFilePlayer::getCurrentSpectrum:len:

-(int)getCurrentSpectrum:(float* _Nonnull)buffer len:(int)len;

Get spectrum information.

Notes:

  • Return the effective data length, ranging from [0 to 1].
Parameters
ParameterDescription
bufferSpectrum buffer
lenLength of spectrum buffer

IMediaEngine

IMediaEngine::registerAudioFrameObserver

  static bool registerAudioFrameObserver(IAudioFrameObserver* observer);

Register an audio frame observer.

Parameters
ParameterTypeDescription
observerINAudio observer object

Enumeration & Structure

ThunderEngine

ThunderRtcConfig

typedef NS_ENUM(NSInteger, ThunderVideoRenderMode);

Video rendering mode

Enumeration ValueDescription
THUNDER_RENDER_MODE_FILL(0)Fill the window. If the dimensions do not fit, they will be stretched to fill the window
THUNDER_RENDER_MODE_ASPECT_FIT(1)Adapt to the window. If the dimensions do not fit, a black edge will fill the gap
THUNDER_RENDER_MODE_CLIP_TO_BOUNDS(2)Fill the window. If the dimensions do not fit, they will be clipped

ThunderRtcRoomConfig

typedef NS_ENUM(NSInteger, ThunderRtcRoomConfig);

Set room profiles

Enumeration ValueDescription
THUNDER_ROOM_CONFIG_LIVE(0)Live streaming (high audio quality, without interaction mode) (switched to medium audio quality in case of co-hosting with strong interaction mode)
THUNDER_ROOM_CONFIG_COMMUNICATION(1)Communication (medium audio quality with strong interaction mode)
THUNDER_ROOM_CONFIG_GAME(3)Game (low audio quality with strong interaction mode)
THUNDER_ROOM_CONFIG_MULTIAUDIOROOM(4)Multi-person voice chatroom (medium audio quality, conserving traffic with strong interaction mode)
THUNDER_ROOM_CONFIG_CONFERENCE(5)Conference (medium audio quality with strong interaction mode, applicable to enabling/disabling microphones frequently without freezing)

ThunderRtcLogLevel

typedef NS_ENUM(NSInteger, ThunderRtcLogLevel);

Set log level

Enumeration ValueDescription
THUNDER_LOG_LEVEL_TRACE(0)//TRACE
THUNDER_LOG_LEVEL_DEBUG(1)//DEBUG
THUNDER_LOG_LEVEL_INFO(2)//INFO
THUNDER_LOG_LEVEL_WARN(3)//WARN
THUNDER_LOG_LEVEL_ERROR(4)//ERROR

LiveTranscoding

@API LiveTranscoding : NSObject

@property(nonatomic, strong)NSString *mAudioUrl;
@property(nonatomic, strong)NSString *mLyricUrl;
@property(nonatomic, strong)NSString *mMediaUrl;
@property(nonatomic, strong)MediaStreamLayoutObj* mMediaStreamLayout;

/**
 @brief Add a user to the mixed video layout
 @param [IN] user TranscodingUser
 @return 0 success
 */
- (int)addUser:(TranscodingUserObj*)user;

/**
 @brief Set user mixed video layout in batches
        In this method, the user sets all users participating in the combined picture. This method replaces the raw data with new user data.
 @param [IN] users All mixed video users in channel
 */
- (void)setUsers:(NSMutableArray*)users;

/**
 @brief Get current user location information
 @return Get information of all users in mixed video canvas in channel
 */
- (NSMutableArray*)getUsers;

/**
 @brief Remove users joining video mixing
 @param [IN] uid User ID to be removed
 @return 0 success
 */
- (int)removeUserWithUid:(NSString*)uid;

/**
 @brief Remove the mixed video of this channel. That is, the user will not use the mixed video
 @return 0 success
 */
- (int)removeAllUsers;

/**
 @brief Get the number of users joining video mixing
 @return Number of users
 */
- (int)getUserCount;

/**
 @brief Set the bracket of mixed video outputted
 @param [IN] transCodingMode mode
 */
- (void)setTransCodingMode:(ThunderTranscodingModeType)transCodingMode;

/**
 @brief Get the bracket of mixed video outputted
 @return mode
 */
- (ThunderTranscodingModeType)getTransCodingMode;

/**
 @brief Whether to open the mixed video with SEI
 @return true open, false close
*/
- (BOOL)isEnableMixVideoExtraInfo;

/**
 @brief Set the external pure audio URL as the standard stream for this mixed video. Because the progress of the standard stream playback is required internally for synchronization of mixed video, it cannot be used simultaneously through the API setMediaStandardSream.
   So, the client should use ThunderAudioFilePlayer to play this audio and call setMixStandard in ThunderAudioFilePlayer to set the standard stream.
   If the user wants to use customized style lyrics in the mixed video, the anchor can use the sendMediaExtraInfo API to send the lyrics progress, and call setAudioOnlyStandardSreamUrl to set the lyricUrl parameter to null,
   The audience will receive the onRecvMediaExtraInfo callback of IThunderMediaExtraInfoCallback when playing this mixed video stream, and read out the corresponding lyrics progress, and draw the lyrics according to the progress. 
 @param [IN] audioUrl Standard video file URL
 @param [IN] lyricUrl URL of the lyrics file corresponding to the audio. The blank indicates no lyrics, otherwise the lyrics will be added to the mixed video in the default style.
 @return 0 success, <0 failure
*/
- (int)setAudioOnlyStandardSreamUrl:(NSString*)audioUrl lyricUrl:(NSString*)lyricUrl;

/**
 @brief The external video media stream is set as the standard stream for mixed video, which cannot be used through API setAudioOnlyStandardSreamUrl simultaneously.
 @param [IN] mediaUrl Standard video file url
 @param [IN] layout   Layout information of video media stream in the mixed video.
 @return 0 success, <0 failure
*/
- (int)setMediaStandardSream:(NSString*) mediaUrl layout:(MediaStreamLayoutObj*) layout;

- (NSString*)description;

@end

ThunderVideoRotation

typedef NS_ENUM(NSInteger, ThunderVideoRotation);

Video rotation angle.

Enumeration ValueDescription
THUNDER_VIDEO_ROTAION_NONE(0)Rotate 0 degree clockwise
THUNDER_VIDEO_ROTAION_90(1)Rotate 90 degrees clockwise
THUNDER_VIDEO_ROTAION_180(2)Rotate 180 degrees clockwise
THUNDER_VIDEO_ROTAION_270(3)Rotate 270 degrees clockwise

ThunderRtcRemotePlayType

typedef NS_ENUM(NSInteger, ThunderRtcRemotePlayType);

Mode of remote video displayed locally with a singular view for one person or multiple

Enumeration ValueDescription
THUNDER_REMOTE_PLAY_NORMAL(0)Common audience view
THUNDER_REMOTE_PLAY_MULTI(1)Multi-person co-hosting view

ThunderMultiVideoViewParam

__attribute__((visibility("default"))) @API ThunderMultiVideoViewParam: NSObject
@property(strong, nonatomic)NSArray<ThunderMultiVideoViewCoordinate*>* _Nonnull videoPositions;
@property(strong, nonatomic)ThunderMultiVideoViewCoordinate* _Nullable bgCoordinate;
@property(copy, nonatomic)NSString* _Nullable bgImageName;
@end
ParameterDescription
videoPositionsSee details in ThunderMultiVideoViewCoordinate for video view layout parameters.
bgCoordinateSee details in ThunderMultiVideoViewCoordinate for video view background layout parameters.
bgImageNameVideo view background picture

ThunderMultiVideoViewCoordinate

__attribute__((visibility("default"))) @API ThunderMultiVideoViewCoordinate: NSObject
@property(assign, nonatomic)int x;
@property(assign, nonatomic)int y;
@property(assign, nonatomic)int width;
@property(assign, nonatomic)int height;
@property(assign, nonatomic)int index;
@end

Layout of multi-person co-hosting setting

ParameterDescription
xX-coordinate at the upper left corner in the layout for a single video view
yY-coordinate at the upper left corner in the layout for a single video view
widthWidth of the layout for a single video view
heightHeight of the layout for a single video view
indexSeat numbers in the layout for a single video view, start from 0

ThunderVideoCanvas

__attribute__((visibility("default"))) @API ThunderVideoCanvas : NSObject
@property(strong, nonatomic) UIView* _Nullable view;
@property(assign, nonatomic) ThunderVideoRenderMode renderMode;
@property(copy, nonatomic) NSString* _Nullable uid;
@property(assign, nonatomic)int seatIndex;
@end
ParameterDescription
viewUIView
renderModeSee details in ThunderVideoRenderMode.
uidUser ID
seatIndexSet the window position of a user during multi-person co-hosting

ThunderVideoRenderMode

typedef NS_ENUM(NSInteger, ThunderAudioRawFrameOperationMode );

Raw audio data mode

Enumeration ValueDescription
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_ONLY(1)Read-only mode. The user only gets data from AudioFrame
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_WRITE_ONLY(2)Write-only mode. The user replaces data in AudioFrame for encoding transmission of SDK
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_WRITE(3)Read/write mode. The user obtains and modifies data from AudioFrame, then returns it to SDK for encoding and transmission.

ThunderVideoMirrorMode

typedef NS_ENUM(NSInteger, ThunderVideoMirrorMode);

Mirroring

Enumeration ValueDescription
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_MIRROR_PUBLISH_NO_MIRROR(0)Preview is mirrored, but stream pushing is not mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_MIRROR(1)Both preview and stream pushing are mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_NO_MIRROR(2)Neither preview nor stream pushing is mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_NO_MIRROR_PUBLISH_MIRROR(3)Preview is not mirrored, but publishing is mirrored

ThunderRtcAudioConfig

typedef NS_ENUM(NSInteger, ThunderRtcAudioConfig);

Audio Profiles

Enumeration ValueDescription
THUNDER_AUDIO_CONFIG_DEFAULT(0)Default settings. 1 in communication mode, and 2 in live streaming mode
THUNDER_AUDIO_CONFIG_SPEECH_STANDARD(1)Specify a 16 KHz sampling rate, audio encoding, single channel, and an encoding bit rate of about 18 kbps
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD_STEREO(2)Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 24 kbps. High encoding delay
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD(3)Specify a 44.1 kHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 40 kbps. Low encoding delay
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO(4)Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 128 kbps
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO_192(5)Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 192 kbps

ThunderRtcCommutMode

typedef NS_ENUM(NSInteger, ThunderRtcCommutMode);

Interaction Mode

Enumeration ValueDescription
THUNDER_COMMUT_MODE_DEFAULT(0)=1 by default
THUNDER_COMMUT_MODE_HIGH(1)Strong interaction mode
THUNDER_COMMUT_MODE_LOW(1)Weak interaction mode

ThunderRtcScenarioMode

typedef NS_ENUM(NSInteger, ThunderRtcScenarioMode);

Scenario mode

Enumeration ValueDescription
THUNDER_SCENARIO_MODE_DEFAULT(0)=1 by default
THUNDER_SCENARIO_MODE_STABLE_FIRST(1)Smoothness priority: stable, recommended for education
THUNDER_SCENARIO_MODE_QUALITY_FIRST(2)Smoothness priority: stable, recommended for education

ThunderEqGainsOc

typedef float ThunderEqGainsOc[11];

Equalizer parameter, -12 <= gains[i] <= 12, in which the range of i is 0<= i <=10


ThunderReverbExParamOc

struct ThunderReverbExParamOc;

Reverberation parameters

ParameterTypeValue
mRoomSizedouble0~100
mPreDelaydouble0~200
mReverberancedouble0~100
mHfDampingdouble0~100
mToneLowdouble0~100
mToneHighdouble0~100
mWetGaindouble-20~10
mDryGaindouble-20~10
mStereoWidthdouble0~100

ThunderCprParamOc

typedef struct CG_BOXABLE ThunderCprParamOc ThunderCprParamOc;

Compressor parameters

ParameterTypeValue
thresholdintThreshold; range: [-40~0]
makeupGainintGain
ratiointScale
kneeintSlope
releaseTimeintRelease time; range: Over 0
attackTimeintLaunch time; range: Over 0

ThunderLimiterParamOc

struct ThunderLimiterParamOc;
typedef struct CG_BOXABLE ThunderLimiterParamOc ThunderLimiterParamOc;
ParameterTypeValue
fCeilingfloat(-30 ~ 0)
fThresholdfloat(-10 ~ 0)
fPreGainfloat(0~30)
fReleasefloat(0~1000)
fAttackfloat(0~1000)
fLookaheadfloat(0~8)
fLookaheadRatiofloat(0.5~2)
fRMSfloat(0~100)
fStLinkfloat(0~1)

ThunderSourceType

typedef NS_ENUM(NSInteger, ThunderSourceType);

Audio publishing mode

Enumeration ValueDescription
THUNDER_AUDIO_MIC(0)Microphone-only
THUNDER_AUDIO_FILE(1)File-only
THUNDER_AUDIO_MIX(2)Microphone and file
THUNDER_SOURCE_TYPE_NONE(10)Stop all uplink audio data

ThunderSaverMode

typedef NS_ENUM(NSInteger, ThunderSaverMode);

Save mode.

Enumeration ValueDescription
THUNDER_AUDIO_SAVER_ONLY_CAPTURE(0)Only save uplink audio data in the room.Uplink audio data: only audio data set as uplink of both the anchor and accompaniment can be saved
THUNDER_AUDIO_SAVER_ONLY_RENDER(1)Save audio data excluding that of the anchor in the room, e.g. audio data of the accompaniment and audience
THUNDER_AUDIO_SAVER_BOTH(2)Save all audio data in the room

ThunderFileMode

typedef NS_ENUM(NSInteger, ThunderFileMode);

Writing data mode

Enumeration ValueDescription
THUNDER_AUDIO_SAVER_FILE_APPEND(0)Open a text file, and written data will overlap its original content
THUNDER_AUDIO_SAVER_FILE_OVERRIDE(1)Open another text file and write data at the end of the file

ThunderAudioRawFrameOperationMode

typedef NS_ENUM(NSInteger, ThunderAudioRawFrameOperationMode );

Writing data mode

Enumeration ValueDescription
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_ONLY(1)Read-only mode. The user only gets data from AudioFrame
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_WRITE_ONLY(2)Open another text file and write data at the end of the file
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_WRITE(3)Read/write mode, write-only mode. Users replace data in AudioFrame for encoding and transmission of SDK

CGSize

struct CGSize {
    CGFloat width;
    CGFloat height;
};
FieldDescription
widthWidth
heightHeight

AudioFrame

struct IAudioFrameObserver::AudioFrame;

Details of audio data

ParameterDescription
typeAudio frame type. See details in AUDIO_FRAME_TYPE.
samplesNumber of samples in this frame
bytesPerSampleBytes per sample: PCM (16 digits), including two bytes
channelsThe number of channels (data are interleaved if stereo); 1: single channel, 2: dual channel
samplesPerSecSampling rate
bufferdata buffer
renderTimeMsNot used
avsync_typeNot used

TranscodingUserObj

@API TranscodingUserObj : NSObject

@property(copy, nonatomic) NSString* uid; // Anchor ID
@property(copy, nonatomic) NSString* roomId; // Anchor's current publish room
@property(assign, nonatomic) BOOL bStandard; // Standard stream user or not, default to false, competition stream is generally regarded as standard stream in a competition scenario
@property(assign, nonatomic) int layoutX; // User's x coordinate of the begin point in video mixing canvas
@property(assign, nonatomic) int layoutY; // User's y coordinate of the begin point in video mixing canvas
@property(assign, nonatomic) int layoutW; // User's width in video mixing canvas
@property(assign, nonatomic) int layoutH; // User's height in video mixing canvas
@property(assign, nonatomic) int zOrder; // Layer number of user frame on the live video.
                                         // The value range is the integer in [0, 100], and the minimum value is 0 (default value), indicating that the image in this region is at the lowest level
@property(assign, nonatomic) BOOL bCrop; // The way in which the source stream adapts to the video mixing window
                                         // true: clipping extra parts after zooming; false: mend black edge after zooming; this is applied to the clipping region if such a region is set.
@property(assign, nonatomic) int cropX; // X-coordinate of the begin point in the clipping region of current anchor's source video
@property(assign, nonatomic) int cropY; // Y-coordinate of the begin point in the clipping region of current anchor's source video
@property(assign, nonatomic) int cropW; // Width of the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropH; // Height of the clipping region of current anchor’s source video
@property(assign, nonatomic) float alpha; // Transparency of user video on the live video. The value range is [0.0, 1.0].
                                          // 0.0 indicates that the image in this region is completely transparent, while 1.0 indicates completely opaque. The default is 1.0
@property(assign, nonatomic) int audioChannel; // Not yet realized

- (NSString*)description;
- (BOOL)isEqual:(id)obj;

@end

ThunderTranscodingModeType

typedef NS_ENUM(NSInteger, ThunderTranscodingModeType);

Video mixing bracket

Enumeration ValueDescription
TRANSCODING_MODE_NON(0)//Retain bracket
TRANSCODING_MODE_320X180(1)"encode":100,"bitrate": 150, "fps": 15, "gop": 30, "width": 320, "height": 180
TRANSCODING_MODE_320X240(2)"encode": 100,"bitrate": 200, "fps": 15, "gop": 30, "width": 320, "height": 240
TRANSCODING_MODE_640X360(3)"encode": 100,"bitrate": 500, "fps": 15, "gop": 30, "width": 640, "height": 360
TRANSCODING_MODE_640X480(4)"encode": 100,"bitrate": 500, "fps": 15, "gop": 30, "width": 640, "height": 480
TRANSCODING_MODE_960X544(5)"encode": 100,"bitrate": 1000, "fps": 24, "gop": 48, "width": 960, "height": 544
TRANSCODING_MODE_1280X720(6)"encode": 100,"bitrate": 1600, "fps": 24, "gop": 48, "width": 1280, "height": 720
TRANSCODING_MODE_1920X1080(7)"encode": 100,"bitrate": 4500, "fps": 24, "gop": 48, "width": 1920, "height": 1080

MediaStreamLayoutObj

@API MediaStreamLayoutObj : NSObject

@property(assign, nonatomic) int layoutX; // X-coordinate of begin point of the media in video mixing canvas
@property(assign, nonatomic) int layoutY; // Y-coordinate of begin point of the media in video mixing canvas
@property(assign, nonatomic) int layoutW; // Width of the media in video mixing canvas
@property(assign, nonatomic) int layoutH; // Height of the media in video mixing canvas
@property(assign, nonatomic) int zOrder; // Layer number of the media video frame on the live video. The value range is the integer in [0, 100],
                                         // and the minimum value is 0 (default value), indicating that the image in this region is at the lowest level
@property(assign, nonatomic) BOOL bCrop; // The way in which the source stream adapts to the video mixing window, true: crop extra parts after zooming;
                                         // false: mend black edge after zooming; this is applied to the clipping region if such a region is set.
@property(assign, nonatomic) int cropX; // X-coordinate of the begin point in the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropY; // Y-coordinate of the begin point in the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropW; // Width of the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropH; // Height of the clipping region of current anchor’s source video
@property(assign, nonatomic) float alpha; // Transparency of media video on the live video. The value range is [0.0, 1.0].
                                          // 0.0 indicates that the image in this region is completely transparent, while 1.0 indicates completely opaque. The default is 1.0
@property(assign, nonatomic) int audioChannel; // Unrealized

- (NSString*)description;
- (BOOL)isEqual:(id)obj;

@end

ThunderVideoEncoderConfiguration

__attribute__((visibility("default"))) @API ThunderVideoEncoderConfiguration : NSObject
@property(assign, nonatomic) ThunderPublishPlayType playType;
@property(assign, nonatomic) int publishMode;
@end

Video publishing profile

ParameterDescription
playTypeSee details in ThunderPublishPlayType for publishing methods.
publishModeSee details in ThunderPublishVideoMode for video encoding types.

ThunderVideoEncodeParam

__attribute__((visibility("default"))) @API ThunderVideoEncodeParam : NSObject
@property(assign, nonatomic) NSUInteger width; // width
@property(assign, nonatomic) NSUInteger height; // height
@property(assign, nonatomic) NSUInteger frameRate; // frame rate
@property(assign, nonatomic) NSUInteger codeRate; // bit rate
@end

ThunderPublishPlayType

typedef enum ThunderPublishPlayType;

Publish play type

Enumeration ValueDescription
THUNDERPUBLISH_PLAY_SINGLE(0)Single publishing
THUNDERPUBLISH_PLAY_INTERACT(1)Co-hosting video publishing
THUNDERPUBLISH_PLAY_SCREENCAP(2)Screen recording publishing
THUNDERPUBLISH_PLAY_MULTI_INTERACT(3)Multi-person co-hosting publishing

ThunderPublishVideoMode

typedef enum ThunderPublishVideoMode;

Video encoding types

Enumeration ValueDescriptionResolution(Width*Height)Encoding RateFrame Rate
THUNDERPUBLISH_VIDEO_MODE_NORMAL(1)Ordinary320 x 240 (landscape)200 kbps15 fps
THUNDERPUBLISH_VIDEO_MODE_HIGHQULITY(2)High definition368 x 640 (portrait)500 kbps15 fps
THUNDERPUBLISH_VIDEO_MODE_SUPERQULITY(3)Ultra high-definition544 x 960 (portrait)1000 kbps24 fps
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_2M(4)Blue ray 2M720 x 1280 (portrait)1500 kbps24 fps
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_4M(5)Blue ray 4M1080 x 1920 (portrait)3000 kbps24 fps

ThunderRtcAreaType

typedef NS_ENUM(NSInteger, ThunderRtcAreaType);

Geographic area

Enumeration ValueDescription
THUNDER_AREA_DEFAULT(0)Default (domestic)
THUNDER_AREA_FOREIGN(1)Overseas

ThunderVideoCaptureOrientation

typedef NS_ENUM(NSInteger, ThunderVideoCaptureOrientation);

Portrait and landscape

Enumeration ValueDescription
THUNDER_VIDEO_CAPTURE_ORIENTATION_PORTRAIT(0)Portrait
THUNDER_VIDEO_CAPTURE_ORIENTATION_LANDSCAPE(1)Landscape

AUDIO_FRAME_TYPE

enum AUDIO_FRAME_TYPE;

Audio/video data frame type.

Enumeration ValueDescription
FRAME_TYPE_PCM16(0)PCM 16 bit little endian

Was this page helpful?

Helpful Not helpful
Submitted! Your feedback would help us improve the website.
Feedback
Top