Event Callback

Callback List

  • ThunderEventDelegate

Public Callback FunctionFunction Name
voidthunderEngine:onJoinRoomSuccess:withUid:elapsed:
voidthunderEngine:onLeaveRoomWithStats:
voidthunderEngine:sdkAuthResult:
voidthunderEngine:bPublish:bizAuthResult:
voidthunderEngine:onPlayVolumeIndication:totalVolume:
voidthunderEngine:onCaptureVolumeIndication:cpt:micVolume:
voidthunderEngine:onAudioPlaySpectrumData:
voidthunderEngine:onRecvUserAppMsgData:uid:
voidthunderEngine:onSendAppMsgDataFailedStatus:
voidthunderEngine:onRemoteAudioStopped:byUid:
voidthunderEngine:onRemoteVideoStopped:byUid:
voidthunderEngine:onRemoteVideoPlay:size:elapsed:
voidthunderEngine:onVideoSizeChangedOfUid:size:rotation:
voidthunderEngine:onVideoCaptureStatus:
voidthunderEngine:onConnectionStatus:
voidthunderEngine:onRoomStats:
voidthunderEngine:onFirstLocalAudioFrameSent:
voidthunderEngine:onFirstLocalVideoFrameSent:
voidthunderEngine:onPublishStreamToCDNStatusWithUrl:errorCode:
voidthunderEngine:onNetworkTypeChanged:
voidthunderEngine:onLocalVideoStats:
voidthunderEngine:onLocalAudioStats:
voidthunderEngine:onAudioCaptureStatus:
voidthunderEngineConnectionLost:
voidthunderEngine:onTokenWillExpire:
voidthunderEngineTokenRequest:
voidthunderEngine:onUserBanned:
voidthunderEngine:onNetworkQuality:txQuality:rxQuality:
voidthunderEngine:onRemoteVideoStatsOfUid:stats:
voidthunderEngine:onRemoteAudioStatsOfUid:stats:
voidthunderEngine:onRemoteAudioPlay:elapsed:
voidthunderEngine:onLocalAudioStatusChanged:errorReason:
voidthunderEngine:onLocalVideoStatusChanged:error:
voidthunderEngine:onRemoteAudioStateChangedOfUid:state:reason:elapsed:
voidthunderEngine:onRemoteVideoStateChangedOfUid:state:reason:elapsed:
voidthunderEngine:onDeviceStats:
voidthunderEngine:onAudioRouteChanged:
voidthunderEngine:onHowlingDetectResult:
voidthunderEngine:onEchoDetectResult:
voidthunderEngine:onCameraFocusAreaChanged:
voidthunderEngine:onCameraExposureAreaChanged:
  • ThunderVideoDecodeFrameObserver

Public Callback FunctionFunction Name
voidonVideoDecodeFrame:pts:uid:
  • ThunderVideoCaptureFrameObserver

Public Callback FunctionFunction Name
ThunderVideoCaptureFrameDataTypeneedThunderVideoCaptureFrameDataType:
CVPixelBufferRef _NullableonVideoCaptureFrame:PixelBuffer:
BOOLonVideoCaptureFrame:PixelBuffer:SourceTextureID:DestinationTextureID:TextureFormat:TextureTarget:TextureWidth:TextureHeight:
  • ThunderMediaExtraInfoDelegate

Public Callback FunctionFunction Name
voidonSendMediaExtraInfoFailedStatus:
voidonRecvMediaExtraInfo:ofUid:
voidonRecvMixAudioInfo:ofUid:
voidonRecvMixVideoInfo:ofUid:
  • ThunderAudioFilePlayerDelegate

Public Callback FunctionFunction Name
voidonAudioFilePlayEnd: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFilePlayError:errorCode: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFilePlaying: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFilePause: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFileResume: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFileStop: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFileSeekComplete:milliseconds: (This callback is deprecated from V2.8.0,it is recommended to call onAudioFileStateChange:event:errorCode:)
voidonAudioFileVolume:volume:currentMs:totalMs:
voidonAudioFileStateChange:event:errorCode:
  • IAudioFrameObserver

Public Callback FunctionFunction Name
virtual boolonRecordAudioFrame(AudioFrame& audioFrame) = 0
virtual boolonPlaybackAudioFrame(AudioFrame& audioFrame) = 0
virtual boolonPlaybackAudioFrameBeforeMixing(char* uid, AudioFrame& audioFrame) = 0
virtual boolonMixedAudioFrame(AudioFrame& audioFrame)
  • ThunderRtcLogDelegate

Public Callback FunctionFunction Name
voidonThunderRtcLogWithLevel:message:
  • ThunderCustomVideoSourceProtocol

Public Callback FunctionFunction Name
BOOLonInitialize:(nullable id<ThunderVideoFrameConsumer>)protocol
ThunderVideoBufferTypebufferType
voidonStart
voidonStop
voidonDispose
  • ThunderExternalAudioProcessorDelegate

Public Callback FunctionFunction Name
voidaudioCaptureStart
voidaudioCaptureData:data:len:sampleRate:channelCount:bitPerSample:
voidaudioCaptureStop
voidaudioRenderStart
voidaudioRenderData:data:len:sampleRate:channelCount:bitPerSample:
voidaudioRenderStop

Callback Details

ThunderRtcLogDelegate

ThunderRtcLogDelegate::onThunderRtcLogWithLevel:message:

- (void)onThunderRtcLogWithLevel:(ThunderRtcLogLevel)level message:(nonnull NSString*)msg;

Processing log callback.

Parameters
ParameterDescription
levelSee level details in [ThunderRtcLogLevel].(#ThunderRtcLogLevel).
msgLog

ThunderEventDelegate:thunderEngine:onJoinRoomSuccess:withUid:elapsed:

- (void)thunderEngine:(ThunderEngine* _Nonnull)engine
    onJoinRoomSuccess:(nonnull NSString*)room
              withUid:(nonnull NSString*)uid
              elapsed:(NSInteger)elapsed;

Callback of joining a room.

Parameters
ParameterDescription
roomRoom name
uidUser ID
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:sdkAuthResult:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine sdkAuthResult:(ThunderRtcSdkAuthResult)sdkAuthResult;

Callback of SDK authentication results.

Parameters
ParameterDescription
sdkAuthResultSee authentication result details in ThunderRtcSdkAuthResult

ThunderEventDelegate:thunderEngine:bPublish:bizAuthResult:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine bPublish:(BOOL)bPublish bizAuthResult:(NSInteger)bizAuthResult;

Callback of business authentication results.

Notes:

When business authentication is required, Jocloud will forward the authentication request to the business authentication server, and after passing through, return the authentication results.

Parameters
ParameterDescription
bPublishYES: publishing authentication
NO: playing authentication
bizAuthResultAuthentication results: results of passing through business authentication; 0: success;

ThunderEventDelegate:onPlayVolumeIndication:totalVolume:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
onPlayVolumeIndication:(NSArray<ThunderRtcAudioVolumeInfo *> * _Nonnull)speakers
          totalVolume:(NSInteger)totalVolume;

Callback of speaking volume.

Notes:

Notifications for who is speaking in the room and their volume.

Parameters
ParameterDescription
speakersSpeaker (array). Each speaker includes follwing information:
"Uid"- Speaker ID.
"volume"-speaker's volume.
"Pts"-Playing timestamp
totalVolumeTotal volume, range: [0-100]

ThunderEventDelegate:thunderEngine:onAudioPlaySpectrumData:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onAudioPlaySpectrumData:(nullable NSData*)data;

Callback of audio spectrum data.

Notes:

  • Return playing audio's spectrum data to the user.
Parameters
ParameterDescription
DateSpectrum data

ThunderEventDelegate:onRecvUserAppMsgData:uid:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
  onRecvUserAppMsgData:(nonnull NSData*)msgData
                   uid:(nonnull NSString*)uid;

Callback of service-customized broadcast messages.

Notes:

Return pass-through messages and the sender's ID to message recipients.

Parameters
ParameterDescription
msgDataPass-through message received
uidSender ID

ThunderEventDelegate:thunderEngine:onSendAppMsgDataFailedStatus:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onSendAppMsgDataFailedStatus:(NSUInteger)status;

Callback of failure to send service-customized broadcast message.

Notes:

Return the reason that a service-customized broadcast message failed to send. By current stipulations, pass-through frequency is 2x/s and the data sent must be <= 200 bytes.

Parameters
ParameterDescription
statusFailure status:
1: Sending frequency too high
2: Sent data too large
3: Publishing failed

ThunderEventDelegate:thunderEngine:onRemoteAudioStopped:byUid:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onRemoteAudioStopped:(BOOL)stopped byUid:(nonnull NSString*)uid;

Notification for remote user audio stream status.

Parameters
ParameterDescription
stoppedCallback of remote user audio stream status
uidRemote user ID

ThunderEventDelegate:thunderEngine:onRemoteVideoStopped:byUid:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onRemoteVideoStopped:(BOOL)stopped byUid:(nonnull NSString*)uid;

Notification for remote user video stream status.

Parameters
ParameterDescription
stoppedCallback of remote user video stream status
uidRemote user ID

ThunderEventDelegate:thunderEngine:onRemoteVideoPlay:size:elapsed:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine
    onRemoteVideoPlay:(nonnull NSString *)uid
    size:(CGSize)size
    elapsed:(NSInteger)elapsed;

Callback of the first frame of remote video displayed.

Notes:

Used to calculate the video speed.

Parameters
ParameterDescription
uidUser ID
sizeVideo size (width and height). See details in CGSize
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onVideoSizeChangedOfUid:size:rotation:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine
onVideoSizeChangedOfUid:(nonnull NSString*)uid
                 size:(CGSize)size
                 rotation:(NSInteger)rotation;

Callback of changes to local or remote video resolution.

Parameters
ParameterDescription
uidUser ID
sizeVideo size (width and height). See details in CGSize
rotationRotation degree [0,360]

ThunderEventDelegate:thunderEngine:onVideoCaptureStatus:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onVideoCaptureStatus:(ThunderVideoCaptureStatus)status;

Notification for camera capture status changes.

Notes:

  • After enabling camera capture, receive this notification for changes in its status.
Parameters
ParameterDescription
statusSee camera capture status details in ThunderVideoCaptureStatus.

ThunderEventDelegate:thunderEngine:onConnectionStatus:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onConnectionStatus:(ThunderConnectionStatus)status;

Callback of server network connection status.

Parameters
ParameterDescription
statusSDK-server network connection status. See details in ThunderConnectionStatus.

ThunderEventDelegate:thunderEngine:onRoomStats:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onRoomStats:(nonnull RoomStats*)stats;

Notifications for upstream/downstream traffic

Notes:

  • Notifications for upstream/downstream traffic are periodic at two-second intervals.
Parameters
ParameterDescription
statsUpstream/downstream traffic statistics. See details in RoomStats.

ThunderEventDelegate:thunderEngine:onFirstLocalAudioFrameSent:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onFirstLocalAudioFrameSent:(NSInteger)elapsed;

Callback of the first frame of local audio sent.

Parameters
ParameterDescription
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onFirstLocalVideoFrameSent:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onFirstLocalVideoFrameSent:(NSInteger)elapsed;

Callback of the first frame of local video sent.

Parameters
ParameterDescription
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onPublishStreamToCDNStatusWithUrl:errorCode:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine
  onPublishStreamToCDNStatusWithUrl:(NSString *_Nonnull)url
  errorCode:(ThunderPublishCDNErrorCode)errorCode;

Callback of stream pushing to CDN results

Notes:

  • After setting publishing or a transcoding task, this callback will trigger upon calling addPublishOriginStreamUrl to set the source stream for CDN pushing, or upon calling addPublishTranscodingStreamUrl to set mixed video streams pushing to CDN.
  • Notify whether CDN stream pushing is successful. If publishing fails, errorCode will give the specific reason.
  • Trigger when stream pushing status changes; in the absence of changes, it triggers once every 10 seconds.
Parameters
ParameterDescription
urlStream pushing target URL
errorCodeStream pushing error code. See details in ThunderPublishCDNErrorCode.

ThunderEventDelegate:thunderEngine:onNetworkTypeChanged:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onNetworkTypeChanged:(NSInteger)type;

Callback of network type changes.

Parameters
ParameterDescription
type
THUNDER_NETWORK_TYPE_UNKNOWN(0): Unknown connection type
THUNDER_NETWORK_TYPE_DISCONNECTED(1): Network disconnected
THUNDER_NETWORK_TYPE_CABLE(2): Wired network
THUNDER_NETWORK_TYPE_WIFI(3): Wi-Fi (hotspot included)
THUNDER_NETWORK_TYPE_MOBILE(4): Mobile network, 2G, 3G and 4G are not identified
THUNDER_NETWORK_TYPE_MOBILE_2G(5): 2G mobile network
THUNDER_NETWORK_TYPE_MOBILE_3G(6): 3G mobile network
THUNDER_NETWORK_TYPE_MOBILE_4G(7): 4G mobile network

ThunderEventDelegate:thunderEngine:onLocalVideoStats:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onLocalVideoStats:(ThunderRtcLocalVideoStats * _Nonnull)stats;

Local video statistics notifications.

Notes:

  • Provides statistics on local device video stream output. Timing: 1. immediate callback upon calling the publishing API; 2. immediate callback of mid-publishing bracket changes; 3. periodically at two-second intervals
Parameters
ParameterDescription
statsLocal video statistics. See details in ThunderRtcLocalVideoStats

ThunderEventDelegate:thunderEngine:onLocalAudioStats:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onLocalAudioStats:(ThunderRtcLocalAudioStats * _Nonnull)stats;

Local audio statistics notifications.

Notes:

  • Provide statistics on local device audio stream output. Timing: periodically at two-second intervals
Parameters
ParameterDescription
statsLocal audio statistics. See details in ThunderRtcLocalAudioStats.

ThunderEventDelegate:thunderEngine:onAudioCaptureStatus:

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onAudioCaptureStatus:(NSInteger)status;

Notification of changes to audio device capture status.

Notes:

  • After enabling audio capture, receive notification when there are changes to audio capture device status
Parameters
ParameterDescription
statusAudio device status. See details in ThunderAudioDeviceStatus.

ThunderEventDelegate:thunderEngineConnectionLost:

- (void)thunderEngineConnectionLost:(ThunderEngine *_Nonnull)engine;

Callback of server network disconnection.

Notes:

  • After calling joinRoom, regardless of whether joining is successful or not, if the server cannot be connected within 10 seconds, the SDK will trigger this callback. Until the application proactively calls leaveRoom, the SDK will automatically try to reconnect.

ThunderEventDelegate:thunderEngine:onTokenWillExpire:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onTokenWillExpire:(nonnull NSString*)token;

Callback of imminent token expiration.

Notes:

  • The SDK will return this callback 30 seconds before the token expires.
Parameters
ParameterDescription
tokenExpiring token

ThunderEventDelegate:thunderEngineTokenRequest:

- (void)thunderEngineTokenRequest:(ThunderEngine * _Nonnull)engine;

Callback of token expired.

Notes:

  • The SDK will return this callback when the token expires.

ThunderEventDelegate:thunderEngine:onUserBanned:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onUserBanned:(BOOL)status;

Callback of changes to a user's banned status.

Parameters
ParameterDescription
statusBanned status (YES-banned NO-not banned)

ThunderEventDelegate:thunderEngine:onUserJoined:elapsed:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onUserJoined:(nonnull NSString*)uid elapsed:(NSInteger)elapsed;

Callback of a remote user joining the current room.

Notes:

  • This API became obsolete with V2.8.0.
  • Effective in an audio-only mode.
Parameters
ParameterDescription
uidRemote user ID
elapsedDelay (ms) from calling joinRoom to triggering callback

ThunderEventDelegate:thunderEngine:onUserOffline:reason:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
        onUserOffline:(nonnull NSString*)uid
        reason:(ThunderLiveRtcUserOfflineReason)reason;

Callback of a remote user exiting the current room.

Notes:

  • This API became obsolete with V2.8.0.
  • Effective in an audio-only mode.
Parameters
ParameterDescription
uidRemote user ID
reasonReason for going offline. See details in ThunderLiveRtcUserOfflineReason.

ThunderEventDelegate:thunderEngine:onNetworkQuality:txQuality:rxQuality:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
     onNetworkQuality:(nonnull NSString*)uid
     txQuality:(ThunderLiveRtcNetworkQuality)txQuality
     rxQuality:(ThunderLiveRtcNetworkQuality)rxQuality;

Reports on user uplink/downlink network quality.

Parameters
ParameterDescription
uidUser ID for the corresponding network quality report. When setting to 0, the local user's network quality is returned
txQualityUplink network quality. See details in ThunderLiveRtcNetworkQuality
rxQualityDownlink network quality. See details in ThunderLiveRtcNetworkQuality

ThunderEventDelegate:thunderEngine:onRemoteVideoStatsOfUid:stats:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
        onRemoteVideoStatsOfUid:(nonnull NSString*)uid
        stats:(ThunderRtcRemoteVideoStats* _Nonnull)stats;

Callback of E2E video stream status during remote user calls.

Notes:

  • Provide the E2E video stream status during remote user calls. Trigger periodically at two-second intervals for each remote user/anchor—that is, when there are multiple remote users/anchors, callback will trigger that many times every two seconds.
Parameters
ParameterDescription
uidRemote user/anchor ID
statsRemote video statistics. See details in ThunderRtcRemoteVideoStats

ThunderEventDelegate:thunderEngine:onRemoteAudioStatsOfUid:stats:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
        onRemoteAudioStatsOfUid:(nonnull NSString*)uid
        stats:(ThunderRtcRemoteAudioStats* _Nonnull)stats;

Callback of E2E audio stream status during remote user calls.

Notes:

  • Provide E2E audio stream status during remote user calls. Trigger periodically at two-second intervals for each remote user/anchor—that is, when there are multiple remote users/anchors, callback will trigger that many times every two seconds.
Parameters
ParameterDescription
uidRemote user/anchor ID
statsRemote audio statistics. See details in ThunderRtcRemoteAudioStats

ThunderEventDelegate:thunderEngine:onRemoteAudioPlay:elapsed

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onRemoteAudioPlay:(nonnull NSString *)uid elapsed:(NSInteger)elapsed

Callback of the first frame of remote video played.

Parameters
ParameterDescription
uidRemote user/anchor ID
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onLocalAudioStatusChanged:errorReason

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine 
        onLocalAudioStatusChanged:(ThunderLocalAudioStreamStatus)status
        errorReason:(ThunderLocalAudioStreamErrorReason)errorReason;

Callback of local audio status changes.

Parameters
ParameterDescription
statusLocal audio status. See details in ThunderLocalAudioStreamStatus.
errorReasonError code. See details in ThunderLocalAudioStreamErrorReason.

ThunderEventDelegate:thunderEngine:onLocalVideoStatusChanged:error

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
        onLocalVideoStatusChanged:(ThunderLocalVideoStreamStatus)status
        error:(ThunderLocalVideoStreamErrorReason)error;

Callback of local video status changes.

Parameters
ParameterDescription
statusLocal video status. See details in ThunderLocalVideoStreamStatus.
errorError code. See details in ThunderLocalVideoStreamErrorReason.

ThunderEventDelegate:thunderEngine:onRemoteAudioStateChangedOfUid:state:reason:elapsed

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine 
                onRemoteAudioStateChangedOfUid:(nonnull NSString*)uid
                state:(ThunderRemoteAudioState)state
               reason:(ThunderRemoteAudioReason)reason 
               elapsed:(NSInteger)elapsed;

Callback of remote audio stream status changes. Return the updated audio status and reason for the status change.

Parameters
ParameterDescription
uidRemote user/anchor ID
stateRemote user audio status. See details in ThunderRemoteAudioState.
reasonReason for audio status change. See details in ThunderRemoteAudioReason.
elapsedTime elapsed (ms) from the calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onRemoteVideoStateChangedOfUid:state:reason:elapsed

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
        onRemoteVideoStateChangedOfUid:(nonnull NSString*)uid
        state:(ThunderRemoteVideoState)state
        reason:(ThunderRemoteVideoReason)reason
        elapsed:(NSInteger)elapsed;

Callback of remote video stream status changes. Return the updated video status and reason for the status change.

Parameters
ParameterDescription
uidRemote user/anchor ID (anchor ID)
stateRemote user video status. See details in ThunderRemoteVideoState.
reasonReason for video status change. See details in ThunderRemoteVideoReason.
elapsedTime elapsed (ms) from calling joinRoom to callback event

ThunderEventDelegate:thunderEngine:onDeviceStats

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine onDeviceStats:(ThunderRtcLocalDeviceStats * _Nonnull)stats;

Callback of CPU or memory usage status; periodic return at two-second intervals upon joining a room.

Parameters
ParameterDescription
statsCPU or memory usage status. See details in ThunderRtcLocalDeviceStats.

ThunderEventDelegate:thunderEngine:onAudioRouteChanged

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onAudioRouteChanged:(ThunderAudioOutputRouting)routing;

Called when the audio routing changes.

Parameter
ParameterDescription
routingThe current audio routing, see details in ThunderAudioOutputRouting

ThunderEventDelegate:thunderEngine:onHowlingDetectResult

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onHowlingDetectResult:(BOOL)bHowling;

Called for reporting howling detection status.

Note:

  • The callback is received only when the enableHowlingDetector is enabled.
  • The callback is called when the howling detection status changes.
Parameter
ParameterDescription
bHowlingHowling detection status: "true"-detected, "false"-not detected

ThunderEventDelegate:thunderEngine:onEchoDetectResult

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onEchoDetectResult:(BOOL)bEcho;

Callback of echo detection results.

Note:

  • The callback is received when the enableEchoDetector is enabled and the microphone is on.
  • The callback is called when the echo detection status changes.
  • The callback will be recevied when the enableEchoDetector is enabled and the microphone status changes.
  • This callback will be received once from enableEchoDetector(false) to enableEchoDetector(true) when the microphone is on.
Parameter
ParameterDescription
bEchoDetection result: "true"-detected, "false"-not detected

ThunderEventDelegate:thunderEngine:onCameraFocusAreaChanged

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onCameraFocusAreaChanged:(CGRect)focusArea;

Called when the focus area changes.

Note:

  • The callback is triggered after callling setCameraExposurePosition to change the exposure position.
Parameter
ParameterDescription
focusAreaFocus area, range: [0,1]

ThunderEventDelegate:thunderEngine:onCameraExposureAreaChanged

- (void)thunderEngine:(ThunderEngine *_Nonnull)engine onCameraExposureAreaChanged:(CGRect)exposureArea;

Called when the exposure area changes.

Note:

  • The callback is triggered after callling setCameraExposurePosition to change the exposure position.
Parameter
ParameterDescription
exposureAreaExposure area,range: [0,1]

ThunderVideoDecodeFrameObserver:onVideoDecodeFrame:pts:uid:

- (void) onVideoDecodeFrame:(CVPixelBufferRef)pixelBuf pts:(uint64_t)pts uid:(NSString*)uid;

Custom rendering of decoded images, meaning removal of SDK decoded image for service-customized rendering.

Notes:

  • There may be multiple video streams in the room. Set ThunderDecodeFrameObserver protocol for video streams with different IDs accordingly.
Parameters
ParameterDescription
pixelBufbuf pointer of current frame
ptsTime shown in current frame (pts)
uidOther party's ID

ThunderVideoCaptureFrameObserver:needThunderVideoCaptureFrameDataType:

- (ThunderVideoCaptureFrameDataType)needThunderVideoCaptureFrameDataType;

ThunderVideoCaptureFrameObserver has a defined set of APIs through which the developer can set video pre-processing tasks. Result parameters are returned to the SDK for continued encoding.

Declare the data format to the SDK by the following two methods.

Return value

For video capture callback data types, see ThunderVideoCaptureFrameDataType.


ThunderVideoCaptureFrameObserver:onVideoCaptureFrame:PixelBuffer:

- (CVPixelBufferRef _Nullable)onVideoCaptureFrame:(EAGLContext *_Nonnull)glContext
                                      PixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuf;

ThunderVideoCaptureFrameObserver has a defined set of APIs through which the developer can set video pre-processing tasks. Result parameters are returned to the SDK for continued encoding.

Receive a frame of capture data for processing and return the processed data.

Notes:

  • The SDK returns the original PixelBuffer to the developer via API. After developer processing, the result is returned to SDK in form of a return value for further operations.
Parameters
ParameterDescription
glContextEAGLContext
pixelBufbuf pointer of the current frame

ThunderVideoCaptureFrameObserver:onVideoCaptureFrame:PixelBuffer:SourceTextureID:DestinationTextureID:TextureFormat:TextureTarget:TextureWidth:TextureHeight:

- (BOOL)onVideoCaptureFrame:(EAGLContext *_Nonnull)context
                PixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
            SourceTextureID:(unsigned int)srcTextureID
       DestinationTextureID:(unsigned int)dstTextureID
              TextureFormat:(int)textureFormat
              TextureTarget:(int)textureTarget
               TextureWidth:(int)width
              TextureHeight:(int)height;

ThunderVideoCaptureFrameObserver has a defined set of interfaces through which the developer can set video pre-processing tasks. Result parameters are returned to the SDK for continued encoding.

Receive a frame of capture data or processing and return the processed data. Process data by OpenGL texture ID.

Notes:

  • The SDK converts pixelBuffer into srcTextureID and dstTextureID via API for return to the developer. The developer can process the texture and render the final result in dstTextureID. The SDK will use dstTextureID data in subsequent tasks.
Parameters
ParameterDescription
contextEAGLContext
pixelBufferOriginal image pixelBuffer
srcTextureIDSource texture ID
dstTextureIDDestination texture ID
textureFormatTexture format
textureTargetTexture target
widthTexture width
heightTexture height
Return
  • YES

ThunderEventDelegate:thunderEngine:onLeaveRoomWithStats:

- (void)thunderEngine:(ThunderEngine* _Nonnull)engine onLeaveRoomWithStats:(ThunderRtcRoomStats* _Nonnull)stats;

Callback of exiting the room.

Notes:

  • You will receive this callback if exiting the room normally by calling leaveRoom.
Parameters
ParameterDescription
statsRoom exit status; reserved parameter, unrealized

ThunderEventDelegate:thunderEngine:onCaptureVolumeIndication:cpt:micVolume:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
onCaptureVolumeIndication:(NSInteger)totalVolume
                  cpt:(NSUInteger)cpt
            micVolume:(NSInteger)micVolume;

Callback of capture volume.

Notes:

Parameters
ParameterDescription
totalVolumeTotal volume of audio capture (including microphone capture and file playing) [0-100]
cptCapture timestamp (ms)
micVolumeVolume of microphone capture [0-100]

ThunderEventDelegate:thunderEngine:onRecvUserAppMsgData:uid:

- (void)thunderEngine:(ThunderEngine * _Nonnull)engine
  onRecvUserAppMsgData:(nonnull NSData*)msgData
                   uid:(nonnull NSString*)uid;

Callback of service-customized broadcast messages.

Notes:

  • Return the pass-through message received and the ID of the message's sender.
Parameters
ParameterDescription
msgDataReceived pass-through message
uidSender ID

ThunderMediaExtraInfoDelegate

ThunderMediaExtraInfoDelegate::onSendMediaExtraInfoFailedStatus:

- (void)onSendMediaExtraInfoFailedStatus:(NSUInteger)status;

Callback of failure to send Supplemental Enhancement Information (SEI).

Notes:


ThunderMediaExtraInfoDelegate::onRecvMediaExtraInfo:ofUid:

- (void)onRecvMediaExtraInfo:(nonnull NSData*)data ofUid:(nonnull NSString*)uid;

Callback of SEI received.

Parameters
ParameterDescription
dateSEI
uidUser ID

ThunderMediaExtraInfoDelegate::onRecvMixAudioInfo:ofUid:

- (void)onRecvMixAudioInfo:(nonnull NSArray<ThunderMixAudioInfo*>*)infos ofUid:(nonnull NSString*)uid;

Callback of received mixed audio stream SEI.

Parameters
ParameterDescription
infosMixed audio stream information, indicating the contributing source streams. See details in ThunderMixAudioInfo.
uidMixed audio stream ID

ThunderMediaExtraInfoDelegate::onRecvMixVideoInfo:ofUid:

- (void)onRecvMixVideoInfo:(nonnull NSArray<ThunderMixVideoInfo*>*)infos ofUid:(nonnull NSString*)uid;

Callback of received mixed video stream SEI.

Parameters
ParameterDescription
uidMixed video stream ID
infosMixed video stream information, indicating the contributing source streams. See details in ThunderMixAudioInfo.

IAudioFrameObserver

IAudioFrameObserver::onRecordAudioFrame:

virtual void Thunder::IAudioFrameObserver::onRecordAudioFrame(AudioFrame& audioFrame);

Callback of raw audio capture data.

Notes:

  • This API adopts the C++ method. After calling registerAudioFrameObserver and registering an IAudioFrameObserver, receive this callback when capture is enabled.
Parameters
ParameterTypeDescription
audioFrameOUTRaw audio data. See details in AudioFrame.

IAudioFrameObserver::onPlaybackAudioFrame:

virtual void Thunder::IAudioFrameObserver::onPlaybackAudioFrame(AudioFrame& audioFrame);

Callback of raw audio playing data.

Notes:

  • This interface adopts the C++ method. After calling registerAudioFrameObserver and registering an IAudioFrameObserver, receive this callback when raw audio is played.
Parameters
ParameterTypeDescription
audioFrameOUTRaw audio data. See details in AudioFrame.

IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing:

virtual void Thunder::IAudioFrameObserver::onPlaybackAudioFrameBeforeMixing(char* uid, AudioFrame& audioFrame);

Callback of remote user-decoded raw audio data. Users are differentiated by ID.

Notes:

  • This interface adopts the C++ method. After calling registerAudioFrameObserver and registering an IAudioFrameObserver, receive this callback when remote audio data is played.
Parameters
ParameterTypeDescription
uidOUTRemote user ID
audioFrameOUTRaw audio data. See details in AudioFrame.

IAudioFrameObserver::onMixedAudioFrame:

virtual void Thunder::IAudioFrameObserver::onMixedAudioFrame(AudioFrame& audioFrame);

Callback of the audio data mixed with the captured data and the playback data.

Parameter
ParameterTypeDescription
audioFrameINAudio raw data, see details in AudioFrame

ThunderAudioFilePlayerDelegate

ThunderAudioFilePlayerDelegate::onAudioFilePlayEnd:

Caution:

- (void)onAudioFilePlayEnd:(nonnull ThunderAudioFilePlayer*)player;

Audio playing complete.

Parameters
ParameterDescription
playerPointer of file playing object

ThunderAudioFilePlayerDelegate::onAudioFilePlayError:errorCode:

Caution:

- (void)onAudioFilePlayError:(nonnull ThunderAudioFilePlayer*)player errorCode:(int)errorCode;

Audio file playing error

Parameters
ParameterDescription
playerPointer of file playing object
errorCodeerrorCode = 0: File opening succeeded
errorCode = -1: Error parsing file format
errorCode = -2: Error decoding file format
errorCode = -3: Unsupported file format
errorCode = -4: File path does not exist

ThunderAudioFilePlayerDelegate::onAudioFilePlaying:

Caution:

- (void)onAudioFilePlaying:(nonnull ThunderAudioFilePlayer*)player;

Audio file started playing.

Parameters
ParameterDescription
playerPointer of file playing object

ThunderAudioFilePlayerDelegate::onAudioFilePause:

Caution:

- (void)onAudioFilePause:(nonnull ThunderAudioFilePlayer*)player;

Audio file playing paused.

Parameters
ParameterDescription
playerPointer of file playing object

ThunderAudioFilePlayerDelegate::onAudioFileResume:

Caution:

- (void)onAudioFileResume:(nonnull ThunderAudioFilePlayer*)player;

Audio file playing resumed.

Parameters
ParameterDescription
playerPointer of file playing object

ThunderAudioFilePlayerDelegate::onAudioFileStop:

Caution:

- (void)onAudioFileStop:(nonnull ThunderAudioFilePlayer*)player;

Callback of playing stopped by user.

Parameters
ParameterDescription
playerPointer of file playing object

ThunderAudioFilePlayerDelegate::onAudioFileSeekComplete:milliseconds:

Caution:

- (void)onAudioFileSeekComplete:(nonnull ThunderAudioFilePlayer*)player milliseconds:(int)milliseconds;

Skipping to a specified playing location is completed.

Parameters
ParameterDescription
playerPointer of file playing object
millisecondsActual fast forwarding progress

ThunderAudioFilePlayerDelegate::onAudioFileVolume:volume:currentMs:totalMs:

- (void)onAudioFileVolume:(nonnull ThunderAudioFilePlayer*)player
                   volume:(uint32_t)volume
                   currentMs:(uint32_t)currentMs
                   totalMs:(uint32_t)totalMs;

Audio playing volume.

Parameters
ParameterDescription
playerPointer of file playing object
volumePlaying volume
currentMsCurrent playing progress
totalMsTotal duration

ThunderAudioFilePlayerDelegate::onAudioFileStateChange:event:errorCode

- (void)onAudioFileStateChange:(nonnull ThunderAudioFilePlayer*)player event:(ThunderAudioFilePlayerEvent)event  errorCode:(ThunderAudioFilePLayerErrorCode)errorCode;

Callback of player status changes.

Parameters
ParameterDescription
playerPointer of file playing object
eventPlayer event. See details in ThunderAudioFilePlayerEvent.
errorCodeError code. See details in ThunderAudioFilePLayerErrorCode.

ThunderCustomVideoSourceProtocol

ThunderCustomVideoSourceProtocol::onInitialize

- (BOOL)onInitialize:(nullable id<ThunderVideoFrameConsumer>)protocol;

Initialize video source.

Engine calls this method when initializing a video source. The developer can prepare in the method by enabling the camera, initializing the video source, and telling Engine (via return value) whether a customized video source is ready. When initializing a video source, the developer needs to specify a Buffer type (bufferType), and only transmit video frame data in the corresponding format. Also during initialization, Engine will send the developer a ThunderVideoFrameConsumer object. The developer needs to save this object and use it to input the video frame to Engine, once the video source is enabled.

Parameters
ParameterDescription
protocolExternal video frame operation object. See details in ThunderVideoFrameConsumer.
Return value
  • YES: customized video source initialization completed.
  • NO: the customized video source device is not ready or has failed initialization. Engine will stop and report the error.

ThunderCustomVideoSourceProtocol::bufferType

- (ThunderVideoBufferType)bufferType;

Get Buffer type.

During initialization, Engine calls this method to consult the Buffer type for the given video source. The developer can only and must specify just one Buffer type to the media engine via return value.

Return value

ThunderCustomVideoSourceProtocol::onStart

- (void)onStart;

Enable video source.

During initialization, Engine calls this method to consult the Buffer type for the given video source. The developer can only and must specify just one Buffer type to the media engine via return value.


ThunderCustomVideoSourceProtocol::onStop

- (void)onStop;

Disable video source.

The developer can stop collecting video by this method. When the video source is stopped, the media engine notifies the developer by this callback that the frame input switch of ThunderVideoFrameConsumer is about to close and any subsequent video frame input will be discarded.


ThunderCustomVideoSourceProtocol::onDispose

- (void)onDispose;

Destroy video source.

When Engine notifies the developer that the video source is to be invalidated, the developer may then shut down the video source device in this method. Engine will destroy the ThunderVideoFrameConsumer object and the developer should ensure it is not used again following this callback.


ThunderExternalAudioProcessorDelegate

ThunderExternalAudioProcessorDelegate::audioCaptureStart

- (void)audioCaptureStart;

Audio capture started.


ThunderExternalAudioProcessorDelegate::audioCaptureData:data:len:sampleRate:channelCount:bitPerSample:

- (void)audioCaptureData:(void*_Nonnull)data
                     len:(uint32_t)len
              sampleRate:(uint32_t)sampleRate
            channelCount:(uint32_t)channelCount
            bitPerSample:(uint32_t)bitPerSample;

Callback of audio capture data.

Parameters
ParameterDescription
DateAudio data
lenAudio duration
sampleRateAudio sampling rate
channelCountNumber of channels
bitPerSampleBit width of sampling point

ThunderExternalAudioProcessorDelegate::audioCaptureStop

- (void)audioCaptureStop;

Audio capture stopped.


ThunderExternalAudioProcessorDelegate::audioRenderStart

- (void)audioRenderStart;

Audio rendering started.


ThunderExternalAudioProcessorDelegate::audioRenderData:data:len:sampleRate:channelCount:bitPerSample:

-(void)audioRenderData:(void*_Nonnull)data
                   len:(uint32_t)len
            sampleRate:(uint32_t)sampleRate
          channelCount:(uint32_t)channelCount
          bitPerSample:(uint32_t)bitPerSample;

Callback of audio rendering data.

Parameters
ParameterDescription
DateAudio data
lenAudio duration
sampleRateAudio sampling rate
channelCountNumber of channels
bitPerSampleBit width of sampling point

ThunderExternalAudioProcessorDelegate::audioRenderStop

- (void)audioRenderStop;

Audio rendering stopped.


Enumerations & Structure

AudioFrame

struct IAudioFrameObserver::AudioFrame;

Audio data information.

ParameterDescription
typeAudio frame type. See details in AUDIO_FRAME_TYPE.
samplesNumber of samples in this frame
bytesPerSampleBytes per sample: PCM (16 digits) contains 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

AUDIO_FRAME_TYPE

enum AUDIO_FRAME_TYPE;

Audio/video data frame type.

Enumeration ValueDescription
FRAME_TYPE_PCM16(0)PCM 16bit little endian

ThunderRtcScenarioMode

typedef NS_ENUM(NSInteger, ThunderRtcScenarioMode);

Set 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)Tone quality priority: recommended for shows with little or no co-hosting

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

ThunderRtcSdkAuthResult

typedef NS_ENUM(NSInteger, ThunderRtcSdkAuthResult);

Authentication results

Enumeration ValueDescription
THUNDER_SDK_AUTHRES_SUCCUSS(0)Authentication succeeded
THUNDER_SDK_AUTHRES_ERR_SERVER_INTERNAL(10000)Internal server error, try again
THUNDER_SDK_AUTHRES_ERR_NO_TOKEN(10001)No token, call [ThunderAPI updateToken:]
THUNDER_SDK_AUTHRES_ERR_TOKEN_ERR(10002)Token authentication failed (incorrect digital signature); appSecret may be incorrect
THUNDER_SDK_AUTHRES_ERR_APPID(10003)Application ID in token is inconsistent with the application ID used in authentication
THUNDER_SDK_AUTHRES_ERR_UID(10004)User ID in token is inconsistent with the user ID used in authentication
THUNDER_SDK_AUTHRES_ERR_TOKEN_EXPIRE(10005)Token expired
THUNDER_SDK_AUTHRES_ERR_NO_APP(10006)The application does not exist, and is not registered in the management background
THUNDER_SDK_AUTHRES_ERR_TOKEN_WILL_EXPIRE(10007)Token will expire
THUNDER_SDK_AUTHRES_ERR_BAND(10008)The user is banned

ThunderLiveRtcUserOfflineReason

typedef NS_ENUM(NSUInteger, ThunderLiveRtcUserOfflineReason);

Reasons for user going offline

Enumeration ValueDescription
THUNDER_SDK_USER_OFF_LINE_REASON_QUIT(1)The user actively went offline
THUNDER_SDK_USER_OFF_LINE_REASON_DROPPED(2)Timeout, no data received for a long time
THUNDER_SDK_USER_OFF_LINE_REASON_BECOME_AUDIENCE(3)User status switched from anchor to audience (live streaming mode)

ThunderLiveRtcNetworkQuality

typedef NS_ENUM(NSUInteger, ThunderLiveRtcNetworkQuality);

Network quality

Enumeration ValueDescription
THUNDER_SDK_NETWORK_QUALITY_UNKNOWN(0)Unknown quality
THUNDER_SDK_NETWORK_QUALITY_EXCELLENT(1)Excellent network quality
THUNDER_SDK_NETWORK_QUALITY_GOOD(2)Good network quality
THUNDER_SDK_NETWORK_QUALITY_POOR(3)Poor network quality; communication is not affected but the user can sense the deficiency
THUNDER_SDK_NETWORK_QUALITY_BAD(4)Bad network quality; communication is hindered but possible
THUNDER_SDK_NETWORK_QUALITY_VBAD(5)Very bad network quality; communication is essentially impossible
THUNDER_SDK_NETWORK_QUALITY_DOWN(6)Disconnected; communication is impossible

ThunderSendMediaExtraInfoFailedStatus

typedef NS_ENUM(NSUInteger, ThunderSendMediaExtraInfoFailedStatus);

Status of failure in sending SEI

Enumeration ValueDescription
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_DATA_EMPTY(1)SEI is null
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_DATA_TOO_LARGE(2)Data oversized. Each time, size should not exceed 200 bytes for audio-only publishing, or 2048 bytes if there is video
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_FREQUENCY_TOO_HIGHT(3)Overly frequent; sending cannot exceed 100 ms/time
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_NOT_IN_ANCHOR_SYSTEM(4)Not an anchor system
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_NO_JOIN_MEDIA(5)Not in a channel
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_NO_PUBLISH_SUCCESS(6)Publishing failed

ThunderVideoCaptureStatus

typedef NS_ENUM(NSInteger, ThunderVideoCaptureStatus);

Callback of video capture status

Enumeration ValueDescription
THUNDER_VIDEO_CAPTURE_STATUS_SUCEESS(0)Capture enabled. ios is currently undetectable. To unify with Android, add this value
THUNDER_VIDEO_CAPTURE_STATUS_AUTHORIZED(1)User authorization
THUNDER_VIDEO_CAPTURE_STATUS_NOT_DETERMINED(2)The user has not given permission
THUNDER_VIDEO_CAPTURE_STATUS_RESTRICTED(3)Occupied
THUNDER_VIDEO_CAPTURE_STATUS_DENIED(4)The user has denied permission
THUNDER_VIDEO_CAPTURE_STATUS_DENIED(5)Camera disabled

ThunderVideoCaptureFrameDataType

typedef NS_ENUM(NSInteger, ThunderVideoCaptureFrameDataType);

Type of video capture data called back

Enumeration ValueDescription
THUNDER_VIDEO_CAPTURE_DATATYPE_PIXELBUFFER(0)SDK will return pixelbuffer camera data
THUNDER_VIDEO_CAPTURE_DATATYPE_TEXTURE(1)SDK will return texture ID data

ThunderLocalAudioStreamStatus

typedef NS_ENUM(NSInteger, ThunderLocalAudioStreamStatus);

Local audio stream statuses

Enumeration ValueDescription
THUNDER_LOCAL_AUDIO_STREAM_STATUS_STOPPED(0)Default initialization status
THUNDER_LOCAL_AUDIO_STREAM_STATUS_CAPTURING(1)Recording device successfully enabled
THUNDER_LOCAL_AUDIO_STREAM_STATUS_ENCODING(2)First frame of local audio successfully coded
THUNDER_LOCAL_AUDIO_STREAM_STATUS_SENDING(3)First frame of local audio successfully sent
THUNDER_LOCAL_AUDIO_STREAM_STATUS_FAILED(4)Enabling local audio failed

ThunderLocalAudioStreamErrorReason

typedef NS_ENUM(NSInteger, ThunderLocalAudioStreamErrorReason);

Reasons for local audio failure

Enumeration ValueDescription
THUNDER_LOCAL_AUDIO_STREAM_ERROR_OK(0)Normal
THUNDER_LOCAL_AUDIO_STREAM_ERROR_UNKNOWN(1)Unknown
THUNDER_LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE(2)Local audio capture failed
THUNDER_LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE(3)Local audio encoding failed

ThunderLocalVideoStreamStatus

typedef NS_ENUM(NSInteger, ThunderLocalVideoStreamStatus);

Local video stream statuses

Enumeration ValueDescription
THUNDER_LOCAL_VIDEO_STREAM_STATUS_STOPPED(0)Default initialization status
THUNDER_LOCAL_VIDEO_STREAM_STATUS_CAPTURING(1)Recording device successfully enabled
THUNDER_LOCAL_VIDEO_STREAM_STATUS_PREVIEWING(2)Local video preview succeeded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_ENCODING(3)First frame of local video successfully encoded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_SENDING(4)First frame of local video successfully sent
THUNDER_LOCAL_VIDEO_STREAM_STATUS_FAILED(5)Enabling local video failed

ThunderLocalVideoStreamErrorReason

typedef NS_ENUM(NSInteger, ThunderLocalVideoStreamErrorReason);

Reasons for remote video failure

Enumeration ValueDescription
THUNDER_LOCAL_VIDEO_STREAM_ERROR_OK(0)Normal
THUNDER_LOCAL_VIDEO_STREAM_ERROR_FAILURE(1)Unknown
THUNDER_LOCAL_VIDEO_STREAM_ERROR_DEVICE_DENIED(2)Need device permission
THUNDER_LOCAL_VIDEO_STREAM_ERROR_DEVICE_RESTRICTED(3)The capture device is in use
THUNDER_LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE(4)Local video capture failed. Check whether the device is working properly
THUNDER_LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE(5)Local video encoding failed

ThunderRemoteAudioState

typedef NS_ENUM(NSInteger, ThunderRemoteAudioState);

Remote audio stream statuses

Enumeration ValueDescription
THUNDER_REMOTE_AUDIO_STATE_STOPPED(0)Default initialization status, reported under these conditions: THUNDER_REMOTE_AUDIO_REASON_LOCAL_STOPPED(4) or THUNDER_REMOTE_AUDIO_REASON_REMOTE_STOPPED(6)
THUNDER_REMOTE_AUDIO_STATE_STARTING(1)Local user has accepted the first remote audio stream package
THUNDER_REMOTE_AUDIO_STATE_DECODING(2)Decoding, playing is normal
THUNDER_REMOTE_AUDIO_STATE_FROZEN(3)Remote audio is frozen, reported under the condition of THUNDER_REMOTE_AUDIO_REASON_NETWORK_CONGESTION(2)
THUNDER_REMOTE_AUDIO_STATE_FAILED(4)(unrealized) Playing remote audio failed, reported under the condition of THUNDER_REMOTE_AUDIO_REASON_INTERNAL(1)

ThunderRemoteAudioReason

typedef NS_ENUM(NSInteger, ThunderRemoteAudioReason);

Reasons for remote audio stream status changes

Enumeration ValueDescription
THUNDER_REMOTE_AUDIO_REASON_OK(0)Normal
THUNDER_REMOTE_AUDIO_REASON_INTERNAL(1)Internal reason
THUNDER_REMOTE_AUDIO_REASON_NETWORK_CONGESTION(2)Network blocked
THUNDER_REMOTE_AUDIO_REASON_NETWORK_RECOVERY(3)Network recovered
THUNDER_REMOTE_AUDIO_REASON_LOCAL_STOPPED(4)Local user stopped receiving remote audio or disabled the audio module
THUNDER_REMOTE_AUDIO_REASON_LOCAL_STARTED(5)Local user resumed receiving remote audio or enabled the audio module
THUNDER_REMOTE_AUDIO_REASON_REMOTE_STOPPED(6)Remote user stopped sending audio or disabled the audio module
THUNDER_REMOTE_AUDIO_REASON_REMOTE_STARTED(7)Remote user resumed sending remote audio or enabled the audio module
THUNDER_REMOTE_AUDIO_REASON_PLAY_DEVICE_START_FAILED(8)Enabling the audio player failed
THUNDER_REMOTE_AUDIO_REASON_FORMAT_NOT_SUPPORT(9)Decoding failure as the audio coding standard is not supported

ThunderRemoteVideoState

typedef NS_ENUM(NSInteger, ThunderRemoteVideoState);

Remote video stream statuses

Enumeration ValueDescription
THUNDER_REMOTE_VIDEO_STATE_STOPPED(0)Default initialization status, reported under these conditions: THUNDER_REMOTE_VIDEO_REASON_LOCAL_STOPPED(4) or THUNDER_REMOTE_VIDEO_REASON_REMOTE_STOPPED(6)
THUNDER_REMOTE_VIDEO_STATE_STARTING(1)Local user has accepted the first remote video package
THUNDER_REMOTE_VIDEO_STATE_DECODING(2)Remote video is being decoded
THUNDER_REMOTE_VIDEO_STATE_RENDERING(3)Remote video is being rendered
THUNDER_REMOTE_VIDEO_STATE_FROZEN(4)Remote video is frozen, reported under the condition of THUNDER_REMOTE_VIDEO_REASON_NETWORK_CONGESTION(2)

ThunderRemoteVideoReason

typedef NS_ENUM(NSInteger, ThunderRemoteVideoReason);

Reasons for remote video stream status changes

Enumeration ValueDescription
THUNDER_REMOTE_VIDEO_REASON_OK(0)Normal
THUNDER_REMOTE_VIDEO_REASON_INTERNAL(1)Internal reason
THUNDER_REMOTE_VIDEO_REASON_NETWORK_CONGESTION(2)Network blocked
THUNDER_REMOTE_VIDEO_REASON_NETWORK_RECOVERY(3)Network recovered
THUNDER_REMOTE_VIDEO_REASON_LOCAL_STOPPED(4)Local user stopped receiving remote video or disabled the video module
THUNDER_REMOTE_VIDEO_REASON_LOCAL_STARTED(5)Local user resumed receiving remote video or enabled the video module
THUNDER_REMOTE_VIDEO_REASON_REMOTE_STOPPED(6)Remote user stopped sending video or disabled the video module
THUNDER_REMOTE_VIDEO_REASON_REMOTE_STARTED(7)Remote user resumed sending remote video or enabled the video module

ThunderAudioOutputRouting

typedef NS_ENUM(NSInteger, ThunderAudioOutputRouting);

The type of the current audio routing.

Enumeration ValueDescription
HUNDER_AUDIO_OUTPUT_ROUTING_DEFAULT(-1)Default
THUNDER_AUDIO_OUTPUT_ROUTING_HEADSET(0)Headset
THUNDER_AUDIO_OUTPUT_ROUTING_EARPIECE(1)Earpiece
THUNDER_AUDIO_OUTPUT_ROUTING_HEADSETNOMIC(2)Headset without microphone
THUNDER_AUDIO_OUTPUT_ROUTING_SPEAKERPHONE(3)Speakerphone
THUNDER_AUDIO_OUTPUT_ROUTING_LOUDSPEAKER(4)Loudspeaker
THUNDER_AUDIO_OUTPUT_ROUTING_HEADSETBLUETOOTH(5)Bluetooth headset

CGSize

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

RoomStats

__attribute__((visibility("default"))) @interface RoomStats : NSObject

@property(nonatomic, assign) uint32_t totalDuration; // Total call duration (s)
@property(nonatomic, assign) uint32_t txBitrate; // Link sending bit rate (bps)
@property(nonatomic, assign) uint32_t rxBitrate; // Link receiving bit rate (bps)
@property(nonatomic, assign) uint32_t txBytes; // Total bytes sent
@property(nonatomic, assign) uint32_t rxBytes; // Total bytes received
@property(nonatomic, assign) uint32_t txAudioBytes; // Total audio bytes sent
@property(nonatomic, assign) uint32_t rxAudioBytes; // Total audio bytes received
@property(nonatomic, assign) uint32_t txVideoBytes; // Total video bytes sent
@property(nonatomic, assign) uint32_t rxVideoBytes; // Total video bytes received
@property(nonatomic, assign) uint32_t txAudioBitrate; // Audio packet sending bit rate (bps)
@property(nonatomic, assign) uint32_t rxAudioBitrate; // Audio packet receiving bit rate (bps)
@property(nonatomic, assign) uint32_t txVideoBitrate; // Video packet sending bit rate (bps)
@property(nonatomic, assign) uint32_t rxVideoBitrate; // Video packet receiving bit rate (bps)
@property(nonatomic, assign) uint32_t lastmileDelay; // Local client-to-edge server delay (ms)
@end

Upstream/downstream traffic information


ThunderPublishCDNErrorCode

typedef NS_ENUM(NSInteger, ThunderPublishCDNErrorCode);

Publish stream to external server result status code.

Enumeration ValueDescription
THUNDER_PUBLISH_CDN_ERR_SUCCESS(0)Stream pushing succeeded
THUNDER_PUBLISH_CDN_ERR_TOCDN_FAILED(1)Pushing streams to external server (CDN) failed.
1. Check whether the URL is correct.
2. Check whether the token in the URL is valid (generally, CDN stream pushing requires a token; if not, you can ignore it).
THUNDER_PUBLISH_CDN_ERR_THUNDERSERVER_FAILED(2)Pushing streams to the internal thunder server failed.
1. Check the anchor's uplink network.
2. Contact us to troubleshoot internal transmission problems.
THUNDER_PUBLISH_CDN_ERR_THUNDERSERVER_STOP(3)Stop pushing streams

ThunderRtcLocalVideoStats

__attribute__((visibility("default"))) @interface ThunderRtcLocalVideoStats : NSObject
@property (assign, nonatomic) NSUInteger sendBitrate;  // Actual sending bit rate (kbps)
@property (assign, nonatomic) NSUInteger sendFrameRate; // Actual sending frame rate (fps)
@property (assign, nonatomic) NSUInteger encoderOutputFrameRate;// Local encoder output frame rate(fps)
@property (assign, nonatomic) NSUInteger renderOutputFrameRate;// Local renderer frame rate (fps)
@property (assign, nonatomic) NSUInteger targetBitrate;// Current encoder target encoding bit rate (kbps)
@property (assign, nonatomic) NSUInteger targetFrameRate;// Current encoder target encoding frame rate (fps)
// Self-adaptive local video quality since last statistics (based on target frame rate and target bit rate)
@property (assign, nonatomic) ThunderVideoQualityAdaptIndication qualityAdaptIndication;
@property (assign, nonatomic) NSUInteger encodedBitrate;// Video encoding bit rate (Kbps)
@property (assign, nonatomic) NSUInteger encodedFrameWidth;// Encoded video width (px)
@property (assign, nonatomic) NSUInteger encodedFrameHeight;// Encoded video height (px)
@property (assign, nonatomic) NSUInteger encodedFrameCount;// Video frames sent; cumulative
@property (assign, nonatomic) ThunderVideoEncodedType encodedType;// Encoding mode
@property (assign, nonatomic) ThunderVideoCodecType codecType;// Video encoding type
@property (assign, nonatomic) NSUInteger configBitRate;  //Configured bit rate (kbps)
@property (assign, nonatomic) NSUInteger configFrameRate;// Configured frame rate
@property (assign, nonatomic) NSUInteger configWidth;// Configured video height
@property (assign, nonatomic) NSUInteger configHeight;// Configured video width
@end

Statistics of local video


ThunderRtcLocalAudioStats

__attribute__((visibility("default"))) @interface ThunderRtcLocalAudioStats : NSObject
@property (assign, nonatomic) NSUInteger encodedBitrate; // Encoding rate (kbps) 
@property (assign, nonatomic) NSUInteger numChannels;// Number of channels
@property (assign, nonatomic) NSUInteger sendSampleRate;// Sampling rate (Hz)
@property (assign, nonatomic) NSUInteger sendBitrate;// Sending bit rate (average value in kbps)
@property (assign, nonatomic) NSUInteger enableVad;// Whether to enbale VAD when sending audio: 0-no, disable, 1-yes, enable
@end

Statistics of local audio


ThunderAudioDeviceStatus

typedef NS_ENUM(NSInteger, ThunderAudioDeviceStatus);

Audio device capture statuses

Enumeration ValueDescription
THUNDER_AUDIO_DEVICE_STATUS_INIT_CAPTURE_SUCCESS(0)Callback of successful initialization of audio capture device
THUNDER_AUDIO_DEVICE_STATUS_INIT_CAPTURE_ERROR_OR_NO_PERMISSION(1)Callback of failed initialization of audio capture device. May be caused by no permission
THUNDER_AUDIO_DEVICE_STATUS_RELEASE_CAPTURE_SUCCESS(2)Callback of successful release of audio capture device

ThunderRtcRemoteVideoStats

__attribute__((visibility("default"))) @interface ThunderRtcRemoteVideoStats : NSObject
@property (assign, nonatomic) NSUInteger delay; // Delay between pushing and playing remote video stream
@property (assign, nonatomic) NSUInteger width; // Width of remote video stream
@property (assign, nonatomic) NSUInteger height; // Height of remote video stream
@property (assign, nonatomic) NSUInteger totalDelay; // Total audio delay from host to audience (ms)
@property (assign, nonatomic) NSUInteger receivedBitrate; // Receiving bit rate (kbps)
@property (assign, nonatomic) NSUInteger decoderOutputFrameRate; // Remote video decoder output frame rate (fps)
@property (assign, nonatomic) NSUInteger rendererOutputFrameRate; // Remote video renderer output frame rate (fps)
@property (assign, nonatomic) NSUInteger packetLossRate; // PRemote video packet loss rate (%) after anti-packet loss measures
@property (assign, nonatomic) NSUInteger rxStreamType; // Video stream types, including high and low quality streams
@property (assign, nonatomic) NSUInteger totalFrozenTime; // Cumulative time (ms) from a remote user first publishing to the first instance of video freezing
@property (assign, nonatomic) NSUInteger frozenRate; // The cumulative duration of video freezing since a remote user started publishing as a percentage (%) of the total video duration
@end

Statistics of remote video


ThunderRtcRemoteAudioStats

__attribute__((visibility("default"))) @interface ThunderRtcRemoteAudioStats : NSObject
@property (assign, nonatomic) NSUInteger quality; // Remote user audio stream quality. 0: Unknown; 1: Excellent; 2: Good; 3: Poor, communication is not affected but the user can sense the deficiency; 4: Bad, communication is hindered but possible; 5: Very Bad, communication is essentially impossible; 6: Disconnected, communication is impossible 
@property (assign, nonatomic) NSUInteger networkTransportDelay; // Network delay from audio sending end to receiving end
@property (assign, nonatomic) NSUInteger jitterBufferDelay; // Receiving-end delay due to network jitter buffer
@property (assign, nonatomic) NSUInteger totalDelay; // Total delay from host audio capture to audience audio playing (ms)
@property (assign, nonatomic) NSUInteger frameLossRate; // Remote audio stream frame loss rate (%) 
@property (assign, nonatomic) NSUInteger numChannels; // Number of channels
@property (assign, nonatomic) NSUInteger receivedSampleRate; // Remote audio sampling rate (Hz)
@property (assign, nonatomic) NSUInteger receivedBitrate; // Average bit rate for remote audio within the statistical period
@property (assign, nonatomic) NSUInteger totalFrozenTime; // Cumulative time (ms) from a remote user joining a channel until audio freezing occurs
@property (assign, nonatomic) NSUInteger frozenRate; // The cumulative duration of audio freezing after a remote user joined a channel as a percentage (%) of the total audio duration
@end

Remote audio statistics


ThunderMixAudioInfo

__attribute__((visibility("default")))@interface ThunderMixAudioInfo : NSObject
@property(copy, nonatomic) NSString* _Nonnull uid;
@property(assign, nonatomic) int volume; // [0,100]
@end

Mixed video stream information


ThunderMixVideoInfo

__attribute__((visibility("default"))) @interface ThunderMixVideoInfo : NSObject
@property(copy, nonatomic) NSString* _Nonnull uid; // User ID
@property(assign, nonatomic) CGSize size; // Original width and height of user's video
@property(assign, nonatomic) CGRect crop; // Clipped region from source video for use in video mixing
@property(assign, nonatomic) CGRect layout; // User video location on video mixing canvas
@property(assign, nonatomic) int zOrder; // Layer number of this user's video frame in video mixing. Values are integers from [0, 100],
                                         // and the minimum value is 0, indicating the bottommost level
@property(assign, nonatomic) float alpha; // User's video frame transparency in video mixing. Value range: [0.0, 1.0].
                                          // 0.0 indicates complete transparency; 1.0 indicates complete opacity
@end

Mixed video streams source information


ThunderVideoBufferType

typedef NS_ENUM(NSInteger, ThunderVideoBufferType);

Buffer type

Enumeration ValueDescription
THUNDER_VIDEOBUFFER_TYPE_PIXELBUFFER(1)Buffer using Pixel Buffer
THUNDER_VIDEOBUFFER_TYPE_RAWDATA(2)Buffer using Raw Data

ThunderRtcLocalDeviceStats

__attribute__((visibility("default"))) @interface ThunderRtcLocalDeviceStats : NSObject
@property (assign, nonatomic) CGFloat cpuTotalUsage; // Current system CPU usage (%)
@property (assign, nonatomic) CGFloat cpuAppUsage; // CPU usage of the current application (%)
@property (assign, nonatomic) CGFloat memoryAppUsage; // Memory usage of the current application (%)
@property (assign, nonatomic) CGFloat memoryTotalUsage; // Current system memory usage (%)
@end

CPU/memory usage status


ThunderAudioFilePlayerEvent

typedef NS_ENUM(NSInteger, ThunderAudioFilePlayerEvent);

Local files playing status

Enumeration ValueDescription
AUDIO_PLAY_EVENT_OPEN(1)File opened
AUDIO_PLAY_EVENT_PLAY(2)Playing started
AUDIO_PLAY_EVENT_STOP(3)Playing stopped
AUDIO_PLAY_EVENT_PAUSE(4)Paused
AUDIO_PLAY_EVENT_RESUME(5)Playing resumed
AUDIO_PLAY_EVENT_END(6)Playing completed
AUDIO_PLAY_EVENT_SEEK_COMPLETE(7)Fast forwarding

ThunderAudioFilePLayerErrorCode

typedef NS_ENUM(NSInteger, ThunderAudioFilePLayerErrorCode);

Error codes about local file playback

Enumeration ValueDescription
AUDIO_PLAYER_OPEN_FILE_PATH_ERROR(-4)Incorrect file path
AUDIO_PLAYER_OPEN_FILE_FORMAT_NOT_SUPPORT(-3)Incorrect file format
AUDIO_PLAYER_OPEN_FILE_DECODER_FAILED(-2)Decoding file format failed
AUDIO_PLAYER_CREATE_FILE_DECODER_FAILED(-1)Parsing file format failed
AUDIO_PLAYER_STATUS_SUCCESS(0)Succeeded

Was this page helpful?

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