Functional APIs

API List

  • ThunderEngine

Static Public Member FunctionFunction Name
static synchronized ThunderEnginecreateEngine(Context context, String appId, long sceneId, ThunderEventHandler handler)
static synchronized ThunderEnginecreateWithLoop(Context context, String appId, long sceneId, ThunderEventHandler handler, Looper loop)
static synchronized voiddestroyEngine()
static StringgetVersion()
static intsetLogLevel(int filter)
static intsetLogFilePath(String filePath)
static intsetLogCallback(IThunderLogCallback callback)
Public Member FunctionsFunction Name
voidsetSceneId(long sceneId)
intsetMediaMode(int mode)
intsetRoomMode(int mode)
intsetArea(int area)
intjoinRoom(byte[] token, String roomName, String uid)
intleaveRoom()
intupdateToken(byte[] token)
intsetAudioConfig(int profile, int commutMode, int scenarioMode)
intenableVoicePosition(boolean enable)
intsetRemoteUidVoicePosition(String uid, int azimuth, int gain)
intenableLoudspeaker(boolean enable)
intisLoudspeakerEnabled()
intsetLoudSpeakerVolume(int volume)
intsetAudioVolumeIndication(int interval, int moreThanThd, int lessThanThd, int smooth)
intenableCaptureVolumeIndication(int interval, int moreThanThd, int lessThanThd, int smooth)
booleanstartAudioSaver(String fileName, int saverMode, int fileMode)
booleanstopAudioSaver()
voidsetSoundEffect(int mode)
voidsetVoiceChanger(int mode)
intstopLocalAudioStream(boolean stop)
intstopRemoteAudioStream(String uid, boolean stop)
intstopAllRemoteAudioStreams(boolean stop)
intsetMicVolume(int volume)
intsetRemoteAudioStreamsVolume(String uid, int volume)
ThunderAudioFilePlayercreateAudioFilePlayer()
voiddestroyAudioFilePlayer(ThunderAudioFilePlayer audioFilePlayer)
intsetEnableEqualizer(boolean enabled)
intsetEqGains(final int[] gains)
intsetEnableReverb(boolean enabled)
intsetReverbExParameter(ReverbExParameter param)
intsetEnableCompressor(boolean enabled)
intsetCompressorParam(CompressorParam param)
intsetEnableLimiter(boolean enabled)
intsetLimiterParam(LimterParam param)
intsetVoicePitch(float pitch)
voidenableAudioPlaySpectrum(boolean enable)
voidsetAudioPlaySpectrumInfo(int spectrumLen, int notifyIntervalMS)
intsendUserAppMsgData(byte[] msgData)
intsendMediaExtraInfo(ByteBuffer data, int dataLen)
intsetMediaExtraInfoCallback(IThunderMediaExtraInfoCallback callback)
intenableMixVideoExtraInfo(boolean enable)
voidsetAudioSourceType(int sourceType)
intsetEnableInEarMonitor(boolean enable)
intsetVideoEncoderConfig(ThunderVideoEncoderConfiguration yyVideoConfig)
intsetLocalVideoCanvas(ThunderVideoCanvas local)
intsetRemotePlayType(int remotePlayType)
intsetMultiVideoViewLayout(ThunderMultiVideoViewParam params)
intsetRemoteVideoCanvas(ThunderVideoCanvas remote)
intsetLocalCanvasScaleMode(int mode)
intsetRemoteCanvasScaleMode(String uid, int mode)
intstartVideoPreview()
intstopVideoPreview()
intenableLocalVideoCapture((boolean enable)
intstopLocalVideoStream(boolean stop)
intstopRemoteVideoStream(String uid, boolean stop)
intstopAllRemoteVideoStreams(boolean stop)
intregisterVideoCaptureTextureObserver(IGPUProcess observer)
intregisterVideoCaptureFrameObserver(IVideoCaptureObserver observer)
intregisterVideoDecodeFrameObserver(String uid, IVideoDecodeObserver observer)
intregisterAudioFrameObserver(IAudioFrameObserver observer)
intsetMixedAudioFrameParameters(int sampleRate, int channels, int samplesPerCall)
intsetRecordingAudioFrameParameters(int sampleRate, int room, int mode, int samplesPerCall)
intsetPlaybackAudioFrameParameters(int sampleRate, int room, int mode, int samplesPerCall)
intsetVideoWatermark(ThunderBoltImage watermark)
intsetCustomAudioSource(boolean enabled, int sampleRate, int channel)
intpushCustomAudioFrame(byte[] data, long timeStamp)
intsetCustomVideoSource(ThunderCustomVideoSource videoSource)
intaddPublishOriginStreamUrl(String url)
intremovePublishOriginStreamUrl(String url)
intsetLiveTranscodingTask(String taskId, LiveTranscoding transcoding)
intremoveLiveTranscodingTask(String taskId)
intaddPublishTranscodingStreamUrl(String taskId, String url)
intremovePublishTranscodingStreamUrl(String taskId, String url)
intaddSubscribe(String roomId, String uid)
intremoveSubscribe(String roomId, String uid)
intswitchFrontCamera(boolean bFront)
intsetVideoCaptureOrientation(int orientation)
intsetLocalVideoMirrorMode(int mode)
intenableWebSdkCompatibility(boolean enabled)
ThunderVideoEncodeParamgetVideoEncoderParam(ThunderVideoEncoderConfiguration videoConfig)
intgetConnectionStatus()
intenableHowlingDetector(bool enabled)
intenableEchoDetector(boolean enabled)
  • ThunderAudioFilePlayer

public Member FunctionsFunction Name
voidopen(String path)
voidclose()
voidplay()
voidstop()
voidpause()
voidresume()
voidseek(long timeMS)
longgetTotalPlayTimeMS()
longgetCurrentPlayTimeMS()
voidsetPlayVolume(int volume)
intsetPlayerLocalVolume(int volume)
intsetPlayerPublishVolume(int volume)
intgetPlayerLocalVolume()
intgetPlayerPublishVolume()
intgetAudioTrackCount()
intselectAudioTrack(int audioTrack)
voidsetSemitone(int val)
intsetLooping(int cycle)
voidenablePublish(boolean enable)
voidsetTempo(float tempo)
voidsetPosition(int azimuth)
synchronized voidsetPlayerNotify(IThunderAudioFilePlayerCallback callback)
synchronized voidenableVolumeIndication(boolean enable, int interval)
synchronized voidsetMixStandard(boolean standard)
synchronized booleanisMixStandard()

API Details

Note:

If the return value of API is int, unless otherwise specified, 0 indicates a successful call, and less than 0 indicates a failed call. For detailed return code, see ThunderRtcConstant.ThunderRet

ThunderEngine

ThunderEngine.createEngine

public static synchronized ThunderEngine createEngine(Context context,
                                                      String appId,
                                                      long sceneId,
                                                      ThunderEventHandler handler)

Create ThunderEngine and initialize ThunderEngine instance.

Description
  • Now, the SDK only supports one ThunderEngine instance, indicating that it can be only created one by application.
  • Unless otherwise specified, all API functions of ThunderEngine are asynchronously called, and the API is called in the same thread.
  • SceneId is used to differentiate scenes of the same business, contributing to analyze data based on them.
  • This method needs to be called on the main thread.

Note:

  • Only users of the same AppId can communicate with each other.
Parameter
ParameterDescription
contextThe context of the Android Application
appIdThe signed AppId for applications
sceneIdThe scene Id customized by the developer can subdivide business scenes; if unnecessary, fill 0
handlerThunderEventHandler is a abstract object providing default implementation, by which SDK can report events to applications when SDK is running.
Return
  • ThunderEngine instance object

ThunderEngine.createWithLoop

public static synchronized ThunderEngine createWithLoop(Context context,
                                                        String appId,
                                                        long sceneId,
                                                        ThunderEventHandler handler,
                                                        Looper loop)

Create ThunderEngine and initialize ThunderEngine instance.

Description
  • Now, the SDK only supports one ThunderEngine instance, indicating that it can be only created by one application.
  • Unless otherwise specified, all API functions of ThunderEngine are asynchronously called, and the API is called in the same thread.
  • SceneId is used to differentiate scenes of the same business, contributing to analyze data based on them.

Note:

  • Users of the same AppId can communicate with each other.
Parameter
ParameterDescription
contextThe context of the Android Application
appIdAppID signed for application developers
sceneIdThe scene Id customized by the developer can subdivide business scenes; if unnecessary, fill 0
handlerThunderEventHandler is an abstract object providing default implementation, by which SDK can call back events from applications when SDK is running.
loopLooper objects correlated with thread can assign handler callback function to be performed in Associated thread.
Return
  • ThunderEngine instance object

ThunderEngine.destroyEngine

public static synchronized void destroyEngine()

Destroy ThunderEngine instance object

Description
  • This method releases all resources used by SDK.
  • Some applications only operate voice communication required by users. Resources can be released for other operations if they are not needed. This method may be applicable for such applications.
  • If destroyEngine is called, the user cannot use its method and event notices will not be triggered.
  • To use the communication function again, createEngine must be called again to create a ThunderEngine instance.

Note:


ThunderEngine.getVersion

public static String getVersion()

Get SDK version information.

Return
  • SDK version information

ThunderEngine.setLogFilePath

public static int setLogFilePath(String filePath)

Set path of log files (open log and save its information).

Description
  • One of the methods for outputting SDK logs. Specify the output directory and ensure its writability, and SDK outputs logs to this directory in logcat under debug.

Note:

  • Ensure that the specified directory has write permission.
Parameter
ParameterDescription
filePathPath for saving logs
Return

ThunderEngine.setLogCallback

public static int setLogCallback(IThunderLogCallback callback)

Set log callback.

Description
  • One of methods for outputting SDK logs. The SDK calls back log messages to application for writing.
  • After the log callback is set, the setLogFilePath will be invalid.
Parameter
ParameterDescription
callbackFor the callback API instances, refer to IThunderLogCallback API for detail
Return

ThunderEngine.setLogLevel

public static int setLogLevel(int filter)

Set log level.

Description
  • Set filtering level for log output, and call it before setLogFilePath or setLogCallback. If this API is not called, the default log level THUNDER_LOG_LEVEL_INFO will be used.
Parameter
ParameterDescription
filterUse the attributes of constants ThunderRtcConstant.ThunderLogLevel to set log level
Return

ThunderEngine.setSceneId

public void setSceneId(long sceneId)

Set scenario ID.

Parameter
ParameterDescription
sceneIdThe scene Id customized by the developer can subdivide business scenes; If unnecessary, fill 0

ThunderEngine.setMediaMode

public int setMediaMode(int mode)

Set media mode.

Description

Note:

Parameter
ParameterDescription
modeMedia mode. See ThunderRtcConstant.ThunderRtcProfile for details
Return

ThunderEngine.setRoomMode

public int setRoomMode(int mode)

Set room mode.

Description

Note:

Parameter
ParameterDescription
modeRoom mode. See ThunderRtcConstant.RoomConfig for details
Return

ThunderEngine.setArea

public int setArea(int area)

Set country and area of users.

To accommodate to different laws and regulations at home and abroad, Jocloud NETWORK provides both domestic (by default) and international central systems. Set it by referring to the following points:

  • If applications are mainly conducted abroad, this API shall be called to set abroad area.
  • The users in domestic and international central systems cannot communicate with each other. So make ensure that users in the same room shall be in the same system.
  • The two systems are deployed globally, supporting global access.

Note:

  • Only call it before the joinRoom can be valid. It is necessary for abroad users but not for domestic users.
  • The optional value of parameters can only be ThunderRtcConstant.RoomConfig options listed in the document.
  • It can only be reset when destroyEngine is performed.
Parameter
ParameterDescription
areaUser’s area. See ThunderRtcConstant.AreaType for details
Return

ThunderEngine.joinRoom

public int joinRoom(byte[] token, String roomName, String uid)

Join a room.

  • This method lets users join the (audio/video) communication room. In the same room, users can communicate with each other, and group chat starts when multiple users join it.
  • If during the call, users have to call leaveRoom to leave before joining the next one.

Note:

  • The applications cannot communicate with each other when using different appId.
  • Successful function return only indicates that the request is executed successfully. After receiving the callback on ThunderEventHandler.onJoinRoomSuccess , it can indicate the success of joining room.
Parameter
NameDescription
tokenFor the requirements of authentication, see Authentication Access Manual for details
roomNameRoom name (unique for each AppId) only supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
uidUser ID only supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
Return

ThunderEngine.leaveRoom

public int leaveRoom()

Leaving room indicates hang off or exiting conversation.

Note:

  • When joinRoom is called, you have to call leaveRoom to end conversation before starting the next one.
  • No matter whether the user is idle or in a call, leaveRoom can be called, without adverse effects. This method can release all resources related to conversation.
Return

ThunderEngine.updateToken

public int updateToken(byte[] token)

Update token.

Token is used for business authentication. The format is suggested as follows. See Authentication Access Manual for detail

uint16uint32uint64uint64uint32uint16nBytes20 Bytes
TokenLenAppIduidTimeStamp(ms)ValidTime(s)BizExtInfoLenBizExtInfoDataDigitalSignature

Refer to the following descriptions:

  • The multi-byte integer uses network byte order, generally Big Endian.
  • TokenLen: the length of the whole token includes its 2 bytes and abstract.
  • Token expiration time=Timestamp+ValidTime*1000, the UTC time in millisecond since 1970.
  • BizExtInfoData: The extension information of service authentication shall be customized by the developer.
  • DigitalSignature: The digital signature adopts hmac-sha1 algorithm to obtain [TokenLen,BizExtInfoData] by calculating all data before DigitalSignature. The private key uses assigned appSecret when applying for appId.
  • Token has to be transmitted by http, so the whole Token shall be encoded by url base64. Note that the url encode is not performed for the whole base64.
Parameter
ParameterDescription
tokenFor requirements of authentication, refer to "User Authentication Description" for detail
Return

ThunderEngine.setAudioConfig

public int setAudioConfig(int profile, int commutMode, int scenarioMode)

It is used to set audio parameter and application scene.

Note:

Parameter
ParameterDescription
profileAudio type. See ThunderRtcConstant.AudioConfig for details
commuModeInteractive mode. See ThunderRtcConstant.CommutMode for details
scenarioModeScenario mode. See ThunderRtcConstant.ScenarioMode for details (Reserved)
Return

ThunderEngine.enableVoicePosition

public int enableVoicePosition(boolean enable)

Enable/Disable voice stereo of remote users.

Note:

  • Call this API before joining a room by calling joinRoom.
Parameter
ParameterDescription
enabletrue: enable voice stereo of remote users
false: disable voice stereo of remote users
Return

ThunderEngine.setRemoteUidVoicePosition

public int setRemoteUidVoicePosition(String uid, int azimuth, int gain)

Set spatial location and volume of remote user's voice.

Parameter
ParameterDescription
uiduid of remote user
azimuthSet the position where the remote user’s voice appears, with value range of [-90,90].
0: voice appears in the right ahead. (default)
-90: voice appears in the left side.
90: voice appears in the right side.
gainSet the voice volume of remote user, with value range of [0,100]. The default value is 100.0, indicating user’s original volume. The smaller the value, the lower the volume
Return

ThunderEngine.enableLoudspeaker

public int enableLoudspeaker(boolean enabled)

Enable/Disable loudspeaker.

  • This method forces the voice routing to loudspeaker.
Parameter
ParameterDescription
enabledtrue: play by loudspeaker
false: play by receiver
Return

ThunderEngine.isLoudspeakerEnabled

public boolean isLoudspeakerEnabled()

Query the enabled status of loudspeaker.

Return
  • true: play by loudspeaker
  • false: play not by loudspeaker

ThunderEngine.setLoudSpeakerVolume

public int setLoudSpeakerVolume(int volume)

Set loudspeaker volume.

Parameter
ParameterDescription
volumeVolume value [0-400]
Return

ThunderEngine.setAudioVolumeIndication

public int setAudioVolumeIndication(int interval,
                                        int moreThanThd,
                                        int lessThanThd,
                                        int smooth)

Enable volume indication for speaker.

Note:

  • It can only be reset when destroyEngine is performed.
  • The voice volume collected by local microphone or playing file is not included.
Parameter
ParameterDescription
intervalThe callback interval (unit: millisecond) is
<=0: The volume indication is disabled,
>0: Use this numerical value as volume indication of interval enabling. The interval of more than 200 milliseconds is recommended, which is 0 by default.
moreThanThdFrom >= moreThanThd to < moreThanThd, immediately call back once (is not restricted by interval)
<= 0 invalid, range: [0,100], default value: 0
lessThanThdFrom >= lessThanThd to < lessThanThd, immediately call back once (is not restricted by interval)
<= 0 invalid, range: [0,100], default value: 0
smoothInvalid momentarily. Fill 0
Return

ThunderEngine.enableCaptureVolumeIndication

public int enableCaptureVolumeIndication(int interval,
                                             int moreThanThd,
                                             int lessThanThd,
                                             int smooth)

Enable/Disable collected volume callback.

Parameter
ParameterDescription
intervalThe callback interval (unit: millisecond) is
<=0: The volume indication is disabled,
> 0: Use this numerical value as capture volume indication of interval enabling, which is 0 by default
moreThanThdFrom >= moreThanThd to < moreThanThd, immediately call back once (is not restricted by interval)
<= 0 invalid, range: [0,100], default value: 0
lessThanThdFrom >= lessThanThd to < lessThanThd, immediately call back once (is not restricted by interval)
<= 0 invalid, range: [0,100], default value: 0
smoothInvalid momentarily. Fill 0
Return

ThunderEngine.startAudioSaver

public boolean startAudioSaver(String fileName, int saverMode, int fileMode)

Start saving audio data as aac format file.

Parameter
ParameterDescription
fileNameThe save path of file must be full path including file name with postfix of .aac. The directory for saving file must be created in advance, and the folder cannot be created by this API. For example: /sdcard/helloworld.aac
saverModeAudio saving mode. See [ThunderRtcConstant.AudioSaverMode].(#ThunderRtcConstant.AudioSaverMode) for details
fileModeAudio writing mode. See ThunderRtcConstant.AudioSaverWfMode for details
Return
  • true: Success.
  • false: Method call failed

ThunderEngine.stopAudioSaver

public boolean stopAudioSaver()

Stop saving audio data as aac format file.

Return
  • true: Success.
  • false: Method call failed

ThunderEngine.setSoundEffect

public void setSoundEffect(int mode)

Set sound effect mode.

Parameter
ParameterDescription
modesound effect mode. See ThunderRtcConstant.SoundEffectMode for details

ThunderEngine.setVoiceChanger

public void setVoiceChanger(int mode)

Set voice change mode.

Parameter
ParameterDescription
modeVoice change mode. See ThunderRtcConstant.VoiceChangerMode for details

ThunderEngine.stopLocalAudioStream

public int stopLocalAudioStream(boolean stop)

Enable/Disable the capture, encode and upstream of local audio.

Note:

  • Call this method after calling joinRoom successfully.
Parameter
ParameterDescription
stoptrue: disable the capture, encode and upstream of local audio
false: enable the capture, encode and upstream of local audio
Return

ThunderEngine.stopRemoteAudioStream

public int stopRemoteAudioStream(String uid, boolean stop)

Stop/Resume receiving audio stream of a specified user.

Note:

  • Subscription configuration is only reset when destroyEngine is performed
  • After stopping receiving the specified audio stream, you can receive all audio streams through stopAllRemoteAudioStreams and vice versa.
  • This API has no priority relationship with stopAllRemoteAudioStreams, and the API called later will be valid.
Parameter
ParameterDescription
uiduid of remote users
StopTrue: stop receiving audio stream of specified remote user
false: start receiving audio stream of specified remote user
Return

ThunderEngine.stopAllRemoteAudioStreams

public int stopAllRemoteAudioStreams(boolean stop)

Stop/Resume receiving all remote audio streams. Process this API based on the following rules:

  • By default, SDK receives all audio stream data.
  • After the setting of receiving all (stop=false), all audio streams in the room will be subscribed automatically. You can specify one stream of not being subscribed by stopRemoteAudioStream.
  • After the setting of receiving nothing (stop=true), all audio stream in the room will not be subscribed. You can specify one stream being subscribed by stopRemoteAudioStream.

Note:

  • Subscription configuration is only reset when destroyEngine is performed.
  • This API has no priority relationship with stopRemoteAudioStream , and which API called later will be valid.
Parameter
ParameterDescription
stoptrue: stop receiving all remote audios
false: resume receiving all remote audios
Return

ThunderEngine.setMicVolume

public int setMicVolume(int volume)

Set microphone volume.

Parameter
ParameterDescription
volumeVolume value [0-400]
Return

ThunderEngine.setRemoteAudioStreamsVolume

public int setRemoteAudioStreamsVolume(String uid, int volume)

Set the volume of the remote audio stream.

Parameter
ParameterDescription
uiduid of remote user
volumeVolume value [0-400]
Return

ThunderEngine.createAudioFilePlayer

public ThunderAudioFilePlayer createAudioFilePlayer()

Create instance object of audio file player.

Return

ThunderEngine.destroyAudioFilePlayer

public void destroyAudioFilePlayer(ThunderAudioFilePlayer audioFilePlayer)

Destroy instance object of audio file player.

Parameter
ParameterDescription
audioFilePlayerInstance object of audio file player ThunderAudioFilePlayer )

ThunderEngine.setEnableEqualizer

public int setEnableEqualizer(boolean enabled)

Enable/Disable local voice equalizer.

Parameter
ParameterDescription
enabledtrue: Enable
false: Disable
Return

ThunderEngine.setEqGains

public int setEqGains(final int[] gains)

Set voice equalizer parameters.

Parameter
ParameterDescription
gainsThe value range of each element: -12 <= gains[i] <= 12, in which the value range of i: -12 <= gains[i] <= 12
Return

ThunderEngine.setEnableReverb

public int setEnableReverb(boolean enabled)

Enable/Disable local voice reverberation.

Parameter
ParameterDescription
enabledtrue: Enable
false: Disable
Return

ThunderEngine.setReverbExParameter

public int setReverbExParameter(ThunderRtcConstant.ReverbExParameter param)

Set local voice reverberation parameters

Parameter
ParameterDescription
paramThe parameters of voice reverberation, refer to ThunderRtcConstant.ReverbExParameter for details
Return

ThunderEngine.setEnableCompressor

public int setEnableCompressor(boolean enabled)

Enable/Disable audio compressor.

Parameter
ParameterDescription
enabledtrue: Enable
false: disable
Return

ThunderEngine.setCompressorParam

public int setCompressorParam(ThunderRtcConstant.CompressorParam param)

Set audio compressor parameters.

Parameter
ParameterDescription
paramThe parameters of audio compressor, refer to ThunderRtcConstant.CompressorParam for details
Return

ThunderEngine.setEnableLimiter

public int setEnableLimiter(boolean enabled)

Enable/Disable limiter.

Parameter
ParameterDescription
enabledtrue: Enable
false: Disable
Return

ThunderEngine.setLimiterParam

public int setLimiterParam(ThunderRtcConstant.LimterParam param)

Set limiter parameters.

Parameter
ParameterDescription
paramThe parameters of limiter, refer to ThunderRtcConstant.LimterParam for details
Return

ThunderEngine.setVoicePitch

public 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

ThunderEngine.enableAudioPlaySpectrum

public void enableAudioPlaySpectrum(boolean enable)

Enable/Disable data callback on audio play spectrum.

The ThunderEventHandler.onAudioPlaySpectrumData function will be called back after it is enabled.

Parameter
ParameterDescription
enabletrue: Enable
false: Disable (default)

ThunderEngine.setAudioPlaySpectrumInfo

public void setAudioPlaySpectrumInfo(int spectrumLen, int notifyIntervalMS)

Set callback information of audio play spectrum data.

Parameter
ParameterDescription
spectrumLenThe length of spectrum is [12 - 256], and is 256 by default
notifyIntervalMSThe interval of spectrum callback must be the multiple of 10, and is 30MS by default

ThunderEngine.sendUserAppMsgData

public int sendUserAppMsgData(byte[] msgData)

Sending developer's custom broadcast messages in room.

This API sends messages through media UDP channel with features of low-lantency and unreliability. Specified constraints are as follows:

  • The sender must join the room.
  • Call the API after successfully uploading audio and video (messages cannot be sent if only a viewer or authentication fails).
  • The frequency of calling this API shall not be more than 2 times per second, and the msgData size is not more than 200 bytes.
  • msg will be dropped if any of the conditions above is not met.
  • The messages cannot be guaranteed to be delivered to all online users in room, and cannot be guaranteed be delivered in order.

Get the reason for failed sending of msg through ThunderEventHandler.onSendAppMsgDataFailedStatus API function. Get the custom broadcast messages from other users through ThunderEventHandler.onRecvUserAppMsgData API function.

Parameter
ParameterDescription
msgDataMessage sent
Return

ThunderEngine.sendMediaExtraInfo

public int sendMediaExtraInfo(java.nio.ByteBuffer data, int dataLen)

Send media extra information. Use video channel when uploading video, otherwise use audio channel.

Specified constraints are as follows:

  • The sender must join the room, and call it after successfully publishing audio.
  • The fastest call frequency is 100 ms one time in audio publishing (publishing in a pure audio mode or only audio publishing in an audio/video mode); the size of media extra information cannot exceed 200 bytes.
  • In audio/video mode, the call frequency of video publishing cannot exceed the frame rate, and the extra information shall be no more than 2048 bytes. For example, the default frame rate of 15fps is adopted for stream publishing, indicating that the call frequency cannot exceed 1000/15=66.7 ms each time
  • Packet loss may occur

Get the reason for failed sending of media extra information through IThunderMediaExtraInfoCallback.onSendMediaExtraInfoFailedStatus. Receive the media extra information from other users through IThunderMediaExtraInfoCallback.onRecvMediaExtraInfo API function.

Parameter
ParameterDescription
DateThe media extra information data to be transmitted which must be created using ByteBuffer.allocateDirect(int)
dataLenThe length of media extra information data.
If there is only audio publishing (publishing in a pure audio mode or only audio publishing in an audio/video mode), the size of extra information shall be no more than 200 bytes.
If there is video publishing in audio/video mode, the extra information shall be no more than 2048 bytes
Return

ThunderEngine.setMediaExtraInfoCallback

public int setMediaExtraInfoCallback(IThunderMediaExtraInfoCallback callback)

Set callback monitoring of media extra information.

Parameter
ParameterDescription
callbackThe callback instance object of media extra information, refer to IThunderMediaExtraInfoCallback for details
Return

ThunderEngine.enableMixVideoExtraInfo

public int enableMixVideoExtraInfo(boolean enable)

Enable mixed video carry media extra information, for example, mixed video carry layout information. After it is enabled, the callback on IThunderMediaExtraInfoCallback.onRecvMixVideoInfo can be received when this mixed video stream is played in audience terminal.

Parameter
ParameterDescription
enabletrue: Enable
false: Disable (default)
Return

ThunderEngine.setAudioSourceType

public void setAudioSourceType(int sourceType)

Set the audio source type.

Parameter
ParameterDescription
sourceTypeAudio source type. See ThunderRtcConstant.SourceType for details

ThunderEngine.setEnableInEarMonitor

public int setEnableInEarMonitor(boolean enable)

Enable/Disable in-ear monitor.

Parameter
ParameterDescription
enabledtrue: enable
false: disable (default)
Return

ThunderEngine.setVideoEncoderConfig

public int setVideoEncoderConfig(ThunderVideoEncoderConfiguration yyVideoConfig)

Set video encoding configuration.

  • SDK will get specified parameters for encoding video from configuration server based on config. If the developer has special parameter requirements for encoding video, contact technical support for personalized configuration.
  • If the video has been published, update the video encoding parameters. The updated video effect can be seen from local review and remote subscription.
Parameter
ParameterDescription
yyVideoConfigFor the video encoding configuration, refer to ThunderVideoEncoderConfiguration for details
Return

ThunderEngine.setLocalVideoCanvas

public int setLocalVideoCanvas(ThunderVideoCanvas local)

Set local view. If this view is not set, the preview and publishing can also be enabled. The local collected picture can seen after setting this view.

Parameter
ParameterDescription
localThe video rendering canvas instance, refer to ThunderVideoCanvas for details
Return

ThunderEngine.setRemotePlayType

public int setRemotePlayType(int remotePlayType)

Set the playing type of remote video. The default is the common audience view.

Note:

  • Call it before joining room.
Parameter
ParameterDescription
remotePlayTypePlaying type of remote video. For the optional value, refer to ThunderRtcConstant.ThunderRtcRemotePlayType
Return

ThunderEngine.setMultiVideoViewLayout

public int setMultiVideoViewLayout(ThunderMultiVideoViewParam params)

Set the layout parameters of the multi videos on the view

This function is mostly used for scenario of multiplayer interaction. Under this situation, the multi-channel video streams shall be displayed in the same view to reduce performance consumption. This function is called to set the locations where the multi-channel video streams are placed respectively.

Support setting background image and its display location.

Parameter
ParameterDescription
paramsThe layout parameters of multiplayer interaction video in rendering view, refer to ThunderMultiVideoViewParam for details
Return

ThunderEngine.setRemoteVideoCanvas

public int setRemoteVideoCanvas(ThunderVideoCanvas remote)

Set the user position for co-hosting.

Parameter
ParameterDescription
remoteThe display view instance, refer to ThunderVideoCanvas for details
Return

ThunderEngine.setLocalCanvasScaleMode

public int setLocalCanvasScaleMode(int mode)

Set the scale mode of the local video stream on the canvas.

Parameter
ParameterDescription
modeLocal view scale mode. For the optional value, refer to ThunderRtcConstant.ThunderVideoRenderMode
Return

ThunderEngine.setRemoteCanvasScaleMode

public int setRemoteCanvasScaleMode(String uid, int mode)

Set the scale mode of the remote video stream on the canvas.

Parameter
ParameterDescription
uiduid of remote user
modeRemote specified view scale mode. For the optional value, refer to ThunderRtcConstant.ThunderVideoRenderMode
Return

ThunderEngine.startVideoPreview

public int startVideoPreview()

Start video preview of local camera.

Return

ThunderEngine.stopVideoPreview

public int stopVideoPreview()

Stop video preview of local camera.

Return

ThunderEngine.enableLocalVideoCapture

public int enableLocalVideoCapture(boolean enable)

Enable/Disable local video capture.

Parameter
ParameterDescription
enabledtrue: enable local video capture
false: disable local video capture (default)
Return

ThunderEngine.stopLocalVideoStream

public int stopLocalVideoStream(boolean stop)

Disable/Enable local video sending.

**Caution: **

  • Call this API after join in the room via joinRoom.
Parameter
ParameterDescription
Stoptrue: stop sending local video (default)
false: start sending local video
Return

ThunderEngine.stopRemoteVideoStream

public int stopRemoteVideoStream(String uid, boolean stop)

Stop/Resume receiving video stream of a specified user.

Parameter
ParameterDescription
uiduid of remote user
Stoptrue: stop receiving specified video stream
false: receive specified video stream
Return

ThunderEngine.stopAllRemoteVideoStreams

public int stopAllRemoteVideoStreams(boolean stop)

Stop/Receive all remote videos

  • After the setting of receiving all (stop=false), all video streams in the room will be subscribed automatically. You can specify one stream of not being subscribed bystopRemoteVideoStream.
  • After the setting of receiving nothing (stop=true), all video streams in the room will not be subscribed. You can specify one stream being subscribed by stopRemoteVideoStream.
  • This API has no priority relationship with stopRemoteVideoStream, and the API called later will be valid.
Parameter
ParameterDescription
Stoptrue: stop receiving all video streams
false: resume receiving all video streams (clear all configuration records of stopRemoteVideoStream at the same time)
Return

ThunderEngine.registerVideoCaptureTextureObserver

public int registerVideoCaptureTextureObserver(IGPUProcess observer)

Register observer object for capturing video texture data, which is used for beautification etc.

Parameter
ParameterDescription
observerThe observer object instance for collecting video texture data can obtain and process rendering texture data of video’s each frame. See IGPUProcess for details.
If the null is transmitted, cancel registration.
Return

ThunderEngine.registerVideoCaptureFrameObserver

public int registerVideoCaptureFrameObserver(IVideoCaptureObserver observer)

Register observer object for collecting data of camera.

Parameter
ParameterDescription
observerThe observer object instance for collecting data of camera can obtain and render collected data of video camera yuv. See IVideoCaptureObserver for details.
If the null is transmitted, cancel registration.
Return

ThunderEngine.registerVideoDecodeFrameObserver

public int registerVideoDecodeFrameObserver(String uid, IVideoDecodeObserver observer)

Register the decoded YUV (I420) video data observer object for the specified user.

Parameter
ParameterDescription
uiduid needing to be monitored.
observerThe decoded observer object for video data can obtain and process decoded video data. See IVideoDecodeObserver for details.
If the null is transmitted, cancel registration.
Return

ThunderEngine.registerAudioFrameObserver

public int registerAudioFrameObserver(IAudioFrameObserver observer)

Register audio observer object.

Parameter
ParameterDescription
observerThe observer object for audio frame data can obtain and process audio frame data. See IAudioFrameObserver for details.
If the null is transmitted, cancel registration.
Return

ThunderEngine.setMixedAudioFrameParameters

public int setMixedAudioFrameParameters(int sampleRate, int channels, int samplesPerCall)

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

Parameter
ParameterDescription
sampleRateSample rate
channelsAudio channel: 1-Mono, 2-Stereo
samplesPerCallThe number of samples per channel
Return

ThunderEngine.setRecordingAudioFrameParameters

public int setRecordingAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall)

Set the format of captured audio data which will report.

Parameter
ParameterDescription
sampleRateSpecify sampling rate of audio callback data, and it can be set as 8000, 16000, 32000, 44100 or 48000
channelNumber of audio channels:1-single track, 2-dual track
modeSpecify operation mode of audio callback data. See ThunderRtcConstant.ThunderAudioRawFrameOperationMode for details
samplesPerCallSpecify number of samples for audio callback data. For example, the RTMP in push flow is always 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01, in seconds.
Return

ThunderEngine.setPlaybackAudioFrameParameters

public int setPlaybackAudioFrameParameters(int sampleRate, int channel, int mode, int samplesPerCall)

Set the format of playing audio data which will report.

Parameter
ParameterDescription
sampleRateSpecify sampling rate of audio callback data, and it can be set as 8000, 16000, 32000, 44100 or 48000
channelNumber of audio channels:1-single track, 2-dual track
modeSpecify operation mode of audio callback data. See ThunderRtcConstant.ThunderAudioRawFrameOperationMode for details
samplesPerCallSpecify number of samples for audio callback data. For example, the RTMP in push flow is always 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01, in seconds.
Return

ThunderEngine.setVideoWatermark

public int setVideoWatermark(ThunderBoltImage watermark)

Set watermark of local video.

  • This API adopts a picture in PNG format as a watermark in local video and releases with it.
  • If the size of picture in PNG format is inconsistent with settings in this method, SDK will make it coincident by clipping.
  • Only one watermark can be added into the live video, and the watermark added later will replace the last one.
  • The watermark will rotate with the rotation of screen.
Parameter
ParameterDescription
watermarkThe watermark pictures to be added into local live video, refer to ThunderBoltImage for details. The settings of null indicates canceling watermark
Return

ThunderEngine.setCustomAudioSource

public int setCustomAudioSource(boolean enabled, int sampleRate, int channel)

Set parameters of external audio source.

Parameter
ParameterDescription
enabledtrue: enable external audio capture
false: disable external audio capture (default)
sampleRateThe sampling rate of external audio source can be 8000, 16000, 32000, 44100 or 48000
channelNumber of channels for external audio source (support two at most)
Return

ThunderEngine.pushCustomAudioFrame

public int pushCustomAudioFrame(byte[] data, long timeStamp)

Push external audio frame.

Parameter
ParameterDescription
DateExternal PCM audio frame data
timeStampTimestamp of external audio frame is used to synchronize external video source
Return

ThunderEngine.setCustomVideoSource

public int setCustomVideoSource(ThunderCustomVideoSource videoSource)

Set customized video source.

Parameter
ParameterDescription
videoSourceOperation API for external video source
Return

ThunderEngine.addPublishOriginStreamUrl

public int addPublishOriginStreamUrl(String url)

Add a publishing address of source stream.

  • 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.
  • Only one-channel stream publishing address can be added each time by this method. If multi-channel streams need to be pushed, this method have to be called repeatedly. A maximum of 5 addresses are supported for stream publishing.
  • The server will push the source stream to corresponding URL after publishing. It can be called after joining the room (joinroom), and the configuration will be cleared after leaving the room.
Parameter
ParameterDescription
urlStream publishing address, with the format of RTMP.
The special characters such as Chinese cannot be supported, and the address length cannot be more than 512 bytes.
Note: some CDN manufacturers may not support 512 bytes, for example, the Aliyun only supports 256 bytes.
Return

ThunderEngine.removePublishOriginStreamUrl

public int removePublishOriginStreamUrl(String url)

Remove the publishing address of source stream.

  • After this API is called, the anchor's current audio/video stream will not be pushed to the specified CDN address.
Parameter
ParameterDescription
urlThe address to stop pushing stream, the format is RTMP.
The special characters such as Chinese cannot be supported, and the address length cannot be more than 512 bytes.
Note: some CDN manufacturers may not support 512 bytes, for example, the Aliyun only supports 256 bytes.
Return

ThunderEngine.setLiveTranscodingTask

public int setLiveTranscodingTask(String taskId, LiveTranscoding transcoding)

Add or update transcoding task.

  • After this API is called, the server of Jocloud will start stream mixing and transcoding tasks, and pull various set source streams to mix videos and audios. The application needs to specify task ID to differentiate different stream mixing and transcoding tasks.
  • This API can be called repeatedly to update stream mixing parameters in the mix process. Multiple stream mixing tasks can be set in the same room.
  • This API is called only after you join a room (joinRoom). The configuration will be cleaned after you leave the room.
  • The stream publishing address can be added into the stream mixing and transcoding tasks by addPublishTranscodingStreamUrl API. The mixing and transcoding stream will be pushed to specified address after operating the stream mixing and transcoding.
Parameter
ParameterDescription
taskIdTask ID for stream mixing and transcoding tasks is generated and managed by the developer. It shall be unique in a room and supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
transcodingThe configuration information of stream mixing and transcoding, refer to LiveTranscoding for details
Return

ThunderEngine.removeLiveTranscodingTask

public int removeLiveTranscodingTask(String taskId)

Remove a transcoding task.

  • After this API is called, the server of Jocloud will delete and stop the stream mixing task, but the url added by the addPublishTranscodingStreamUrl will not be remove.
Parameter
ParameterDescription
taskIdTask ID for stream mixing and transcoding tasks is generated and managed by the developer. It shall be unique in a room and supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
Return

ThunderEngine.addPublishTranscodingStreamUrl

public int addPublishTranscodingStreamUrl(String taskId, String url)

Add a publishing address of transcoding stream.

  • Call this API after adding transcoding task by calling setLiveTranscodingTask API.
  • After this API is called, the specified mixing stream will be pushed to the specified CDN address. To update url, first call the removePublishTranscodingStreamUrl and add after removing the original address.
  • Add stream publishing address for specified transcoding task, and only one address can added by this method. If multiple-channel streams have to be pushed, call this method repeatedly. 5 stream publishing addresses can be supported at most in the same transcoding task.
  • This API is called only after you join a room (joinRoom). The configuration will be cleaned after you leave the room.
Parameter
ParameterDescription
taskIdThe transcoding task ID is generated and managed by users. It shall be unique globally, and only supports character set composed of a-zA-Z0-9 with length of no more than 20 characters.
urlStream publishing address, with the format of RTMP.
The special characters such as Chinese cannot be supported, and the address length cannot be more than 512 bytes.
Note: some CDN manufacturers may not support 512 bytes, for example, the Aliyun only supports 256 bytes
Return

ThunderEngine.removePublishTranscodingStreamUrl

public int removePublishTranscodingStreamUrl(String taskId, String url)

Remove the publishing address of the transcoding stream.

  • After this API is called, the specified transcoding stream will not be pushed to the specified CDN address.
  • Only one-channel stream publishing address can be deleted each time by this method. If multi-channel streams need to be removed, this method have to be called repeatedly.
  • Call it after joining room (joinRoom).
Parameter
ParameterDescription
taskIdThe transcoding task ID is generated by application. It shall be unique globally, and only supports character set composed of a-zA-Z0-9 with length of no more than 20 characters.
urlThe publishing stream address to be deleted, the format is RTMP.
The special characters such as Chinese cannot be supported, and the address length cannot be more than 512 bytes.
Note: some CDN manufacturers may not support 512 bytes, for example, the Aliyun only supports 256 bytes.
Return

ThunderEngine.addSubscribe

public int addSubscribe(String roomId, String uid)

Subscribe stream of specified user across the room.

  • Subscribe audio/video stream of other rooms after joining the room. Namely, this function can be called after joining the room (joinRoom). Leaving the room will empty the configuration.
Parameter
ParameterDescription
roomIdRoom ID only supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
uidUser ID, the corresponding anchor uid of audio/video to be subscribed
Return

ThunderEngine.removeSubscribe

public int removeSubscribe(String roomId, String uid)

Remove the subscription of stream of specified user across the room.

  • Remove the subscription of audio/video stream of other rooms. It plays a opposite role with the addSubscribe API. It also shall be called after joining the room (joinRoom).
Parameter
ParameterDescription
roomIdRoom ID only supports the permutation and combination of characters such as [A,Z],[a,z],[0,9],-,_, with the length of not more than 64 bytes.
uidUser ID, the corresponding anchor uid of audio/video to be unsubscribed
Return

ThunderEngine.switchFrontCamera

public int switchFrontCamera(boolean bFront)

Switch to front/rear camera.

  • It needs to be called after starting the preview startVideoPreview.
  • The front camera is by default enabled when this method is not called.
Parameter
ParameterDescription
bFronttrue: enable front camera (default)
false: switch to rear camera
Return

ThunderEngine.setVideoCaptureOrientation

public int setVideoCaptureOrientation(int orientation)

Set the capture angle of camera (landscape/portrait).

  • It can be valid before or after calling startVideoPreview .
  • The capture orientation is vertical by default when this method is not called.
Parameter
ParameterDescription
orientationThe capture orientation of camera. For the optional value, refer to ThunderRtcConstant.ThunderVideoCaptureOrientation for details
Return

ThunderEngine.setLocalVideoMirrorMode

public int setLocalVideoMirrorMode(int mode)

Set local video mirror mode.

  • It can be valid before or after calling startVideoPreview .
  • This method is only applicable for front camera other than rear camera. The preview and stream publishing of rear camera will not be mirrored.
  • By default, the front camera mirrors preview other than stream publishing.
Parameter
ParameterDescription
modeMirror mode. For the optional value, seeThunderRtcConstant.ThunderVideoMirrorMode for details
Return

ThunderEngine.enableWebSdkCompatibility

public int enableWebSdkCompatibility(boolean enabled)

Enable/Disable WebSDK compatibility.

  • After enabling WebSDK compatibility, the encoding B-frames is prohibited internally, because it cannot be encoded normally by WebSDK.
  • This is applicable for live scenes and shall be called before publishing. It has nothing to join/exit channel, and only be reset when destroyEngine is performed
  • Audio/Video connection is compatible with Web SDK by default, and there is no need to calling this method.
Parameter
ParameterDescription
enabledtrue: Compatible
false: Incompatible (default)
Return

ThunderEngine.getVideoEncoderParam

public ThunderVideoEncodeParam getVideoEncoderParam(ThunderVideoEncoderConfiguration videoConfig)

Get encoding inforamtion (including width, height, frame rate, bit rate, etc.) by calling the API.

Parameter
PrameterDescription
videoConfigVideo encoding configuration, see details in ThunderVideoEncoderConfiguration
Return

ThunderEngine.getConnectionStatus

public int getConnectionStatus()

Search for network connection status, and this API can be called after initializing SDK.

Return

ThunderEngine.enableEchoDetector

public int enableEchoDetector(boolean 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

ThunderEngine.enableHowlingDetector

public int enableHowlingDetector(boolean enabled)

Whether to enable howling detection.

Note:

This API should be called after 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

ThunderAudioFilePlayer

ThunderAudioFilePlayer.open

public void open(final String path)

Open the file to be played, and the following formats are supported: mp3, aac, wav.

Parameter
ParameterDescription
pathAudio file path

ThunderAudioFilePlayer.close

public void close()

Close play file, and ThunderAudioFilePlayer.open can be called again.


ThunderAudioFilePlayer.play

public void play()

Start playing.


ThunderAudioFilePlayer.stop

public void stop()

Stop playing, and call ThunderAudioFilePlayer.play to play again.


ThunderAudioFilePlayer.pause

public void pause()

Suspend playing, and call ThunderAudioFilePlayer.resume to continue.


ThunderAudioFilePlayer.resume

public void resume()

Continue to play.


ThunderAudioFilePlayer.seek

public void seek(final long timeMS)

Skip to specified play time.(Only support local audio files)

Parameter
ParameterDescription
timeMSThe time (in seconds), shall be no more than the value obtained by ThunderAudioFilePlayer.getTotalPlayTimeMS

ThunderAudioFilePlayer.getTotalPlayTimeMS

public long getTotalPlayTimeMS()

Get the total play time of files.

Return
  • Total play time in seconds

ThunderAudioFilePlayer.getCurrentPlayTimeMS

public long getCurrentPlayTimeMS()

Get the time which has been played.

Return

ThunderAudioFilePlayer.setPlayVolume

public void setPlayVolume(int volume)

Set play volume of current music files locally (anchor) and remotely (audience).

Parameter
ParameterDescription
volumePlay volume [0-100]

ThunderAudioFilePlayer.setPlayerLocalVolume

public int setPlayerLocalVolume(int volume)

Adjust the local volume of music files. Call this method in the room.

Parameter
ParameterDescription
volumePlay volume [0-100]
Return

ThunderAudioFilePlayer.setPlayerPublishVolume

public int setPlayerPublishVolume(int volume)

Adjust remote volume of music files. Call this method in the room.

Parameter
ParameterDescription
volumePlay volume [0-100]
Return

ThunderAudioFilePlayer.getPlayerLocalVolume

public int getPlayerLocalVolume()

Get the local volume of music files.

Return

ThunderAudioFilePlayer.getPlayerPublishVolume

public int getPlayerPublishVolume()

Get the remote volume of music files.

Return

ThunderAudioFilePlayer.getAudioTrackCount

public int getAudioTrackCount()

Get the number of tracks of audio files.

Caution:

  • Call this API after receiving the callback function of file open success "AUDIO_PLAY_EVENT_OPEN" of onAudioFileStateChange
Return

ThunderAudioFilePlayer.selectAudioTrack

public int selectAudioTrack(int audioTrack)

Switch to specified audio track.

Parameter
ParameterDescription
audiotrackSpecified audio track to be switch to. 0 indicates the first audio track
Return

ThunderAudioFilePlayer.setSemitone

public void setSemitone(int val)

Set a tone for audio playing.

Parameter
ParameterDescription
valOptional value of tone quantity: -5, -4, -3, -2, -1, 0(normal), 1, 2, 3, 4, 5

ThunderAudioFilePlayer.setLooping

public int setLooping(int cycle)

Sets times of loop playbacks.

Parameter
ParameterDescription
cycle-1: indicates infinite loop
0: No loop (default value); Positive integer: Loop times
Return

ThunderAudioFilePlayer.enablePublish

public void enablePublish(boolean enable)

Whether to use this currently played audio file as the live accompaniment.

Parameter
ParameterDescription
enabletrue: Enable
false: disable (default)

ThunderAudioFilePlayer.setTempo

public void setTempo(float tempo)

Set the audio playback speed.

Parameter
ParameterDescription
tempoPlayback speed: 0.5f, 0.75f, 1.0f, 1.25f, 1.5f, 2.0f

ThunderAudioFilePlayer.setPosition

public void setPosition(int azimuth)

Set the audio playback position

Parameter
ParameterDescription
azimuthPoistion, -90~90

ThunderAudioFilePlayer.setPlayerNotify

public synchronized void setPlayerNotify(IThunderAudioFilePlayerCallback callback)

Set callback API of audio file player.

Parameter
ParameterDescription
callbackThe callback API of audio file player, refer to ThunderAudioFilePlayer.IThunderAudioFilePlayerCallback for details

ThunderAudioFilePlayer.enableVolumeIndication

public synchronized void enableVolumeIndication(boolean enable, int interval)

Enable the volume callback on audio file playing.

Parameter
ParameterDescription
enabletrue: Enable
false: disable (default)
intervalCallback interval (in seconds). More than 200 ms is recommended; if <=0, reset it as 200ms.

ThunderAudioFilePlayer.setMixStandard

public synchronized void setMixStandard(boolean standard)

Set whether audio file is a mixed video standard stream.

Parameter
ParameterDescription
standardtrue: Standard stream
false: Non-standard stream (default)

ThunderAudioFilePlayer.isMixStandard

public synchronized boolean isMixStandard()

Query whether audio file is a mixed video standard stream.

Return
  • true: Mixed video standard stream
  • false: Not mixed video standard stream

Parameters

ThunderRtcConstant

ThunderRtcConstant.RoomConfig

public static final class RoomConfig

Room mode

Constant (Default Value)Description
THUNDER_ROOMCONFIG_LIVE(0)Live streaming mode, where quality is prioritized and delay is large. Applicable to viewer or audience scenario. When audience publishes audio/video and becomes anchors, the value changes to communication mode.
THUNDER_ROOMCONFIG_COMMUNICATION(1)Communication mode is applicable for 1v1 communication and group conversation due to its short time delay and fluent communication.
THUNDER_ROOMCONFIG_MULTIAUDIOROOM(4)Audio room mode is applicable for group audio room due to its low time delay and low bandwidth occupied

ThunderRtcConstant.AudioConfig

public static final class AudioConfig

Audio Profiles

Constant (Default Value)Description
THUNDER_AUDIO_CONFIG_DEFAULT(0)Default settings. which is 1 in communication mode, and 3 in live mode.
THUNDER_AUDIO_CONFIG_SPEECH_STANDARD(1)Specify the sampling rate of 16 KHz, and the audio encode, single track and encoding rate of 18 kbps SILK
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD_STEREO(2)Specify the sampling rate of 44.1 KHz, and the music encode, dual track and encoding rate of 24 kbps SILK. The encode is long in time delay, EAAC+
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD(3)Specify the sampling rate of 48 KHz, and the music encode, single track and encoding rate of 40 kbps SILK. The encode is low in time delay, ELD AAC
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO(4)Specify the sampling rate of 44.1 KHz, and the music encode, dual track and encoding rate of 128 kbps, AAC LC
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO_192(5)Specify the sampling rate of 44.1 KHz, and the music encode, dual track and encoding rate of 192 kbps, NET_AAC_192K

ThunderRtcConstant.CommutMode

public static final class CommutMode

Interactive mode

Constant (Default Value)Description
THUNDER_COMMUT_MODE_DEFAULT(0)Default mode, equals to THUNDER_COMMUT_MODE_HIGH(1)
THUNDER_COMMUT_MODE_HIGH(1)High interactive mode
THUNDER_COMMUT_MODE_LOW(2)Low interactive mode

ThunderRtcConstant.ScenarioMode

public static final class ScenarioMode

Scenario mode

Constant (Default Value)Description
THUNDER_SCENARIO_MODE_DEFAULT(0)Default mode, equals to THUNDER_SCENARIO_MODE_STABLE_FIRST(1)
THUNDER_SCENARIO_MODE_STABLE_FIRST(1)Fluent priority: applicable for stable education
THUNDER_SCENARIO_MODE_QUALITY_FIRST(2)Tone quality priority: applicable for show field with a few or without interaction

ThunderRtcConstant.AreaType

public static final class AreaType

Scenario mode

Constant (Default Value)Description
THUNDER_AREA_DEFAULT(0)Default value (China), which is equivalent to THUNDER_AREA_RESERVED(1)
THUNDER_AREA_FOREIGN(1)Overseas

ThunderRtcConstant.AuthResult

public static final class AuthResult

Authentication results

Constant (Default Value)Description
THUNDER_AUTHRES_SUCCUSS(0)Authentication succeeded
THUNDER_AUTHRES_ERR_SERVER_INTERNAL(10000)Server internal error, try again
THUNDER_AUTHRES_ERR_NO_TOKEN(10001)If there is no token, call ThunderEngine.updateToken
THUNDER_AUTHRES_ERR_TOKEN_ERR(10002)Token authentication failed (incorrect digital signature), which may be caused by incorrect appSecret
THUNDER_AUTHRES_ERR_APPID(10003)appid in token is inconsistent with appid when execute authentication
THUNDER_AUTHRES_ERR_UID(10004)uid in token is inconsistent with uid when execute authentication
THUNDER_AUTHRES_ERR_TOKEN_EXPIRE(10005)token has expired
THUNDER_AUTHRES_ERR_NO_APP(10006)App does not exist, which is not registered in the management background
THUNDER_AUTHRES_ERR_TOKEN_WILL_EXPIRE(10007)token is about to expire
THUNDER_AUTHRES_ERR_BAND(10008)The user is baned

ThunderRtcConstant.UserOfflineReason

public static final class UserOfflineReason

Offline reason for user

Constant (Default Value)Description
THUNDER_OFFLINE_QUIT(1)The user is offline actively
THUNDER_OFFLINE_DROPPED(2)因过长时间收不到对方数据包,超时掉线。注意:由于 SDK 使用的是不可靠通道,也有可能对方主动离开本方没收到对方离开消息而误判为超时掉线The packet could not be received for long time, lost connection due to timeout. Note: Because SDK uses unreliable channel, the counterpart may leave our side actively. So it is misjudged as timeout offline
THUNDER_OFFLINE_BECOME_AUDIENCE(3)User status is switched from anchor to audience (live mode)

ThunderRtcConstant.NetworkQuality

public static final class NetworkQuality

Network quality

Constant (Default Value)Description
THUNDER_QUALITY_UNKNOWN(0)Unknown quality
THUNDER_QUALITY_EXCELLENT(1)Excellent network quality
THUNDER_QUALITY_GOOD(2)Good network quality
THUNDER_QUALITY_POOR(3)The network quality is poor, but the communication is not affected even the user can feel its defects.
THUNDER_QUALITY_BAD(4)The network quality is bad, and the communication can be barely made but is not smooth
THUNDER_QUALITY_VBAD(5)The network quality is very bad, the communication cannot be made basically
THUNDER_QUALITY_DOWN(6)The network has been disconnected, and the communication cannot be made at all

ThunderRtcConstant.SourceType

public static final class SourceType

Audio publishing mode

Constant (Default Value)Description
THUNDER_PUBLISH_MODE_MIC(0)Microphone (only microphone capture is published to room)
THUNDER_PUBLISH_MODE_FILE(1)Accompaniment (only file play is published to room)
THUNDER_PUBLISH_MODE_MIX(2)Mix (the microphone capture and file play are published to room)
THUNDER_PUBLISH_MODE_NONE(10)Stop all upstream audio data

ThunderRtcConstant.SoundEffectMode

public static final class SoundEffectMode

Sound effect mode

Constant (Default Value)Description
THUNDER_SOUND_EFFECT_MODE_NONE()Disable mode
THUNDER_SOUND_EFFECT_MODE_VALLEY()VALLEY mode
THUNDER_SOUND_EFFECT_MODE_RANDB()R&B mode
THUNDER_SOUND_EFFECT_MODE_KTV()KTV mode
THUNDER_SOUND_EFFECT_MODE_CHARMING()CHARMING mode
THUNDER_SOUND_EFFECT_MODE_POP()Pop mode
THUNDER_SOUND_EFFECT_MODE_HIPHOP()Hip-hop mode
THUNDER_SOUND_EFFECT_MODE_ROCK()Rock mode
THUNDER_SOUND_EFFECT_MODE_CONCERT()Concert mode
THUNDER_SOUND_EFFECT_MODE_STUDIO()Studio mode

ThunderRtcConstant.VoiceChangerMode

public static final class VoiceChangerMode

Voice changing mode

Constant (Default Value)Description
THUNDER_VOICE_CHANGER_MODE_NONE(0)Disable mode
THUNDER_VOICE_CHANGER_MODE_ETHEREAL(1)Ethereal
THUNDER_VOICE_CHANGER_MODE_THRILLER(2)Thriller
THUNDER_VOICE_CHANGER_MODE_LUBAN(3)Luban
THUNDER_VOICE_CHANGER_MODE_LORIE(4)Lorie
THUNDER_VOICE_CHANGER_MODE_UNCLE(5)Uncle
THUNDER_VOICE_CHANGER_MODE_DIEFAT(6)Die-fat
THUNDER_VOICE_CHANGER_MODE_BADBOY(7)Bad boy
THUNDER_VOICE_CHANGER_MODE_WRACRAFT(8)Warcraft
THUNDER_VOICE_CHANGER_MODE_HEAVYMETAL(9)Heavy metal
THUNDER_VOICE_CHANGER_MODE_COLD(10)Cold
THUNDER_VOICE_CHANGER_MODE_HEAVYMECHINERY(11)Heavy mechinery
THUNDER_VOICE_CHANGER_MODE_TRAPPEDBEAST(12)Trapped breast
THUNDER_VOICE_CHANGER_MODE_POWERCURRENT(13)Power current

ThunderRtcConstant.AudioSaverMode

public static final class AudioSaverMode

Audio saving mode

Constant (Default Value)Description
THUNDER_AUDIO_SAVER_ONLY_CAPTURE(0)Only save upstream audio data in channel. The voices of microphone capture and accompaniment can be saved after being set as upstream
THUNDER_AUDIO_SAVER_ONLY_RENDER(1)Save downstream audio data in room
THUNDER_AUDIO_SAVER_BOTH(2)Save upstream and downstream audio data in room

ThunderRtcConstant.AudioSaverWfMode

public static final class AudioSaverWfMode

Writing file mode for saving audio

Constant (Default Value)Description
THUNDER_AUDIO_SAVER_FILE_APPEND(0)Open a file and put additional data at the end of file
THUNDER_AUDIO_SAVER_FILE_OVERRIDE(1)Open a file, and the written data will overlap its original content

ThunderRtcConstant.ThunderAudioRawFrameOperationMode

public static final class ThunderAudioRawFrameOperationMode

The use mode of onRecordAudioFrame

Constant (Default Value)Description
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_ONLY(0)Read-only mode. The user can only get original audio data from AudioFrame
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_WRITE_ONLY(1)Write-only mode. The user replaces the data in AudioFrame to Thunder SDK for encoding and transmission
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_WRITE(2)Read/write mode. The user obtains and modifies data from AudioFrame, and return it to Thunder SDK for encoding and transmission.

ThunderRtcConstant.ExternalVideoPixelFormat

public static final class ExternalVideoPixelFormat

External video pixel format

Constant (Default Value)Description
THUNDER_PIXEL_FORMAT_RGBA(0)RGBA format
THUNDER_PIXEL_FORMAT_I420(1)I420 format
THUNDER_PIXEL_FORMAT_NV21(2)NV21 format

ThunderRtcConstant.ThunderNetworkType

public static final class ThunderNetworkType

Network connection type

Constant (Default Value)Description
THUNDER_NETWORK_TYPE_UNKNOWN(0)Unknown network connection type
THUNDER_NETWORK_TYPE_DISCONNECTED(1)The network has been disconnected
THUNDER_NETWORK_TYPE_CABLE(2)Cable network
THUNDER_NETWORK_TYPE_WIFI(3)Wi-Fi (hotspot included)
THUNDER_NETWORK_TYPE_MOBILE(4)Mobile network. 2G, 3G and 4G network cannot be differentiated
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

ThunderRtcConstant.ThunderConnectionStatus

public static final class ThunderConnectionStatus

The network connection status with server

Constant (Default Value)Description
THUNDER_CONNECTION_STATUS_CONNECTING(0)Connecting
THUNDER_CONNECTION_STATUS_CONNECTED(1)Connected
THUNDER_CONNECTION_STATUS_DISCONNECTED(2)Disconnected

ThunderRtcConstant.ThunderVideoCaptureOrientation

public static final class ThunderVideoCaptureOrientation

Video capture orientation

Constant (Default Value)Description
THUNDER_VIDEO_CAPTURE_ORIENTATION_PORTRAIT(0)Portrait
THUNDER_VIDEO_CAPTURE_ORIENTATION_LANDSCAPE(1)Landscape

ThunderRtcConstant.ThunderVideoMirrorMode

public static final class ThunderVideoMirrorMode

Mirror mode

Constant (Default Value)Description
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_MIRROR_PUBLISH_NO_MIRROR(0)The preview other than stream publishing is mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_MIRROR(1)Both preview and stream publishing are not mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_NO_MIRROR(2)Neither preview and stream publishing is not mirrored
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_NO_MIRROR_PUBLISH_MIRROR(3)Preview is not mirrored, but publish is mirrored

ThunderRtcConstant.ThunderPublishCDNErrorCode

public static final class ThunderPublishCDNErrorCode

Stream publishing results

Constant (Default Value)Description
THUNDER_PUBLISH_CDN_ERR_SUCCESS(0)Stream publishing succeeded
THUNDER_PUBLISH_CDN_ERR_TOCDN_FAILED(1)Publishing stream to external server (CDN) is failed.
1. Check whether url is correct.
2. Check whether the token in the URL is valid (generally, token is required during cdn stream publishing and can be ignored if it doe not exist).
THUNDER_PUBLISH_CDN_ERR_THUNDERSERVER_FAILED(2)Publish the stream to thunder internal server is failed.
1. Check anchor’s upstream network
2. Contact us to troubleshoot internal transmission problems
THUNDER_PUBLISH_CDN_ERR_THUNDERSERVER_STOP(3)Stop stream publishing

ThunderRtcConstant.ThunderSendMediaExtraInfoFailedStatus

public static final class ThunderSendMediaExtraInfoFailedStatus

Failure status of sending extra information

Constant (Default Value)Description
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_DATA_EMPTY(1)Extra information is null.
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_DATA_TOO_LARGE(2)The data to be sent each time is too large. No more than 200 bytes when only publishing audio, and no more than 2048 bytes when publishing video
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_FREQUENCY_TOO_HIGHT(3)The sending frequency is too high, which cannot exceeds 100ms each 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)Channel not to be joined
THUNDER_SEND_MEDIA_EXTRA_INFO_FAILED_NO_PUBLISH_SUCCESS(6)Publishing failed

ThunderRtcConstant.ThunderAudioDeviceStatus

public static final class ThunderAudioDeviceStatus

Audio device status

Constant (Default Value)Description
THUNDER_AUDIO_DEVICE_STATUS_INIT_CAPTURE_SUCCESS(0)Callback on successful initialization of audio capture device
THUNDER_AUDIO_DEVICE_STATUS_INIT_CAPTURE_ERROR_OR_NO_PERMISSION(1)Callback on initialization failure of audio capture. It may be caused by no permission
THUNDER_AUDIO_DEVICE_STATUS_RELEASE_CAPTURE_SUCCESS(2)Callback on successful release of audio capture device

ThunderRtcConstant.ThunderVideoCaptureStatus

public static final class ThunderVideoCaptureStatus

Video capture status

Constant (Default Value)Description
THUNDER_VIDEO_CAPTURE_STATUS_SUCCESS(0)Succeeded
THUNDER_VIDEO_CAPTURE_STATUS_AUTHORIZED(1)Authorize
THUNDER_VIDEO_CAPTURE_STATUS_NOT_DETERMINED(2)No permission given
THUNDER_VIDEO_CAPTURE_STATUS_RESTRICTED(3)Occupied
THUNDER_VIDEO_CAPTURE_STATUS_DENIED(4)No permission
THUNDER_VIDEO_CAPTURE_STATUS_CLOSE(5)Close

ThunderRtcConstant.RemoteAudioState

public static final class RemoteAudioState

Remote audio stream status

Constant (Default Value)Description
THUNDER_REMOTE_AUDIO_STATE_STOPPED(0)Default initialization sataus, which may be reported under the conditions of THUNDER_REMOTE_AUDIO_REASON_LOCAL_STOPPED(4) or THUNDER_REMOTE_AUDIO_REASON_REMOTE_STOPPED(6)
THUNDER_REMOTE_AUDIO_STATE_STARTING(1)The local user has accepted the first package of remote audio stream
THUNDER_REMOTE_AUDIO_STATE_DECODING(2)Decoding, playback normal
THUNDER_REMOTE_AUDIO_STATE_FROZEN(3)The reomte audio is freezing, which will be reported under the condition of THUNDER_REMOTE_AUDIO_REASON_NETWORK_CONGESTION(2)

ThunderRtcConstant.RemoteAudioReason

public static final class RemoteAudioReason

Cause of remote audio stream status change

Constant (Default Value)Description
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 back to normal
THUNDER_REMOTE_AUDIO_REASON_LOCAL_STOPPED(4)The local user stops receiving reomte audios or disables the audio module
THUNDER_REMOTE_AUDIO_REASON_LOCAL_STARTED(5)The local user resumes receiving the remote audio stream or enables the audio module
THUNDER_REMOTE_AUDIO_REASON_REMOTE_STOPPED(6)The remote user stops sending the audio stream or disables the audio module
THUNDER_REMOTE_AUDIO_REASON_REMOTE_STARTED(7)The remote user resumes sending the remote audio stream or enables the audio module

ThunderRtcConstant.RemoteVideoState

public static final class RemoteVideoState

Remote video stream status

Constant (Default Value)Description
THUNDER_REMOTE_VIDEO_STATE_STOPPED(0)Default initialization status, which will be reported under the conditions of THUNDER_REMOTE_VIDEO_REASON_LOCAL_STOPPED(4) or THUNDER_REMOTE_VIDEO_REASON_REMOTE_STOPPED(6)
THUNDER_REMOTE_VIDEO_STATE_STARTING(1)The local user has accepted the first package of the reomte video
THUNDER_REMOTE_VIDEO_STATE_DECODING(2)The remote video is being decoded
THUNDER_REMOTE_VIDEO_STATE_RENDERING(3)The remote video is being renderred
THUNDER_REMOTE_VIDEO_STATE_FROZEN(4)Remote video is freezing, which will be reported under the conditions of THUNDER_REMOTE_VIDEO_REASON_NETWORK_CONGESTION(2)

ThunderRtcConstant.RemoteVideoReason

public static final class RemoteVideoReason

Cause of remote video stream status change

Constant (Default Value)Description
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 back to normal
THUNDER_REMOTE_VIDEO_REASON_LOCAL_STOPPED(4)The local user stops receiving reomte videos or disables the video module
THUNDER_REMOTE_VIDEO_REASON_LOCAL_STARTEDThe local user resumes receiving the remote video stream or enables the video module
THUNDER_REMOTE_VIDEO_REASON_REMOTE_STOPPEDThe remote user stops sending the video stream or disables the video module
THUNDER_REMOTE_VIDEO_REASON_REMOTE_STARTEDThe remote user resumes sending the remote video stream or enables the video module

ThunderRtcConstant.LocalAudioStreamStatus

public static final class LocalAudioStreamStatus

Local audios status

Constant (Default Value)Description
THUNDER_LOCAL_AUDIO_STREAM_STATUS_STOPPED(0)Default initialization status
THUNDER_LOCAL_AUDIO_STREAM_STATUS_CAPTURING(1)Enabling the recording device succeeded
THUNDER_LOCAL_AUDIO_STREAM_STATUS_ENCODING(2)Coding the first frame of local audios succeeded
THUNDER_LOCAL_AUDIO_STREAM_STATUS_SENDING(3)Sending the first frame of local audios succeeded
THUNDER_LOCAL_AUDIO_STREAM_STATUS_FAILED(4)Enabling local audios failed

ThunderRtcConstant.LocalAudioStreamErrorReason

public static final class LocalAudioStreamErrorReason

Cuase of local audios error

Constant (Default Value)Description
THUNDER_LOCAL_AUDIO_STREAM_ERROR_OK(0)Normal
THUNDER_LOCAL_AUDIO_STREAM_ERROR_UNKNOWN(1)Unknown reason
THUNDER_LOCAL_AUDIO_STREAM_ERROR_CAPTURE_FAILURE(2)Capturing local audios failed
THUNDER_LOCAL_AUDIO_STREAM_ERROR_ENCODE_FAILURE(3)Coding local audios failed

ThunderRtcConstant.LocalVideoStreamStatus

public static final class LocalVideoStreamStatus

Local video stream status

Constant (Default Value)Description
THUNDER_LOCAL_VIDEO_STREAM_STATUS_STOPPED(0)Default initialization status
THUNDER_LOCAL_VIDEO_STREAM_STATUS_CAPTURING(1)Enabling the recording device succeeded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_PREVIEWING(2)Previewing local video succeeded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_ENCODING(3)Coding the first frame of local videos succeeded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_SENDING(4)Sending the first frame of local videos succeeded
THUNDER_LOCAL_VIDEO_STREAM_STATUS_FAILED(5)Enabling local videos failed

ThunderRtcConstant.LocalVideoStreamErrorReason

public static final class LocalVideoStreamErrorReason

Cause of local video acquisition failure

Constant (Default Value)Description
THUNDER_LOCAL_VIDEO_STREAM_ERROR_OK(0)Normal
THUNDER_LOCAL_VIDEO_STREAM_ERROR_FAILURE(1)Unknown error
THUNDER_LOCAL_VIDEO_STREAM_ERROR_DEVICE_DENIED(2)No permission to enable the capture device
THUNDER_LOCAL_VIDEO_STREAM_ERROR_DEVICE_RESTRICTED(3)The capture device is in use
THUNDER_LOCAL_VIDEO_STREAM_ERROR_CAPTURE_FAILURE(4)Capturing local videos failed. Please whether the capture device is working properly
THUNDER_LOCAL_VIDEO_STREAM_ERROR_ENCODE_FAILURE(5)Coding failure of local video

ThunderRtcConstant.ThunderAudioFilePlayerEvent

public static final class ThunderAudioFilePlayerEvent

Playback status of local files

Constant (Default Value)Description
AUDIO_PLAY_EVENT_OPEN(1)Open file
AUDIO_PLAY_EVENT_PLAY(2)Start playback
AUDIO_PLAY_EVENT_STOP(3)Stop playback
AUDIO_PLAY_EVENT_PAUSE(4)Pause playback
AUDIO_PLAY_EVENT_RESUME(5)Resume playback
AUDIO_PLAY_EVENT_END(6)Playback finished
AUDIO_PLAY_EVENT_SEEK_COMPLETE(7)Speed playback

ThunderRtcConstant.ThunderAudioFilePLayerErrorCode

public static final class ThunderAudioFilePLayerErrorCode

Error code about playback events of local files

Constant (Default Value)Description
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

ThunderRtcConstant.LiveTranscodingMode

public static final class LiveTranscodingMode

Configuration bracket for video mixing and transcoding output

Each bracket includes configuration of audio and video.

The default configuration of audio's each bracket is:

Encoding protocolBit rateSampling rateNumber of channels
encodebitratesamplechannel
1128441002

The default configuration of video's each bracket is:

Constant (Default Value)Bracket valueResolutionBit rateFrame rate
TRANSCODING_MODE_320X180(1)1320*180150kbps15fps
TRANSCODING_MODE_320X240(2)2320*240200kbps15fps
TRANSCODING_MODE_640X360(3)3640*360500kbps15fps
TRANSCODING_MODE_640X480(4)4640*480500kbps15fps
TRANSCODING_MODE_960X544(5)5960*5441000kbps24fps
TRANSCODING_MODE_1280X720(6)61280*7201600kbps24fps
TRANSCODING_MODE_1920X1080(7)71920*10804500kbps24fps
101180*320150kbps15fps
102240*320200kbps15fps
103360*640500kbps15fps
104480*640500kbps15fps
105544*9601000kbps24fps
106720*12801600kbps24fps
1071080*19204500kbps24fps

ThunderRtcConstant.ThunderUserRole

public static final class ThunderUserRole

User role

Constant (Default Value)Description
THUNDERUSER_ROLE_AUDIENCE(0)Only audience
THUNDERUSER_ROLE_ANCHOR(1)Anchor. If the audience interacts with the anchor, it will become an anchor

ThunderRtcConstant.ThunderLogLevel

public static final class ThunderLogLevel

Log level

Constant (Default Value)Description
THUNDERLOG_LEVEL_TRACE(0)TRACE
THUNDERLOG_LEVEL_DEBUG(1)DEBUG
THUNDERLOG_LEVEL_INFO(2)INFO
THUNDERLOG_LEVEL_WARN(3)WARN
THUNDERLOG_LEVEL_ERROR(4)ERROR
THUNDERLOG_LEVEL_RELEASE(10)RELEASE

ThunderRtcConstant.ThunderCameraPosition

public static final class ThunderCameraPosition

Camera position

Constant (Default Value)Description
THUNDERCAMERA_POSITION_FRONT(0)Front camera
THUNDERCAMERA_POSITION_BACK(1)Rear camera.

ThunderRtcConstant.ThunderPublishOrientation

public static final class ThunderPublishOrientation

Orientation for publishing video

Constant (Default Value)Description
THUNDERPUBLISH_VIDEO_ORIENTATION_PORTRAIT(0)Portrait
THUNDERPUBLISH_VIDEO_ORIENTATION_LANDSCAPE(1)Landscape

ThunderRtcConstant.ThunderVideoEncodeType

public static final class ThunderVideoEncodeType

Protocol type for encoding video

Constant (Default Value)Description
THUNDERVIDEO_ENCODE_TYPE_H264(0)H264
THUNDERVIDEO_ENCODE_TYPE_H265(1)H265

ThunderRtcConstant.ThunderVideoViewScaleMode

public static final class ThunderVideoViewScaleMode

The video displays scale mode

Constant (Default Value)Description
THUNDERVIDEOVIEW_SCALE_MODE_FILL(0)Fill the window. If the proportion is not fit, it will be stretched to fill the window.
THUNDERVIDEOVIEW_SCALE_MODE_ASPECT_FIT(1)Adapt to the window. If the proportion is not fit, black edge will be left
THUNDERVIDEOVIEW_SCALE_MODE_CLIP_TO_BOUNDS(2)Fill the window. If the proportion is not fit, it will be cut out

ThunderRtcConstant.ThunderPublishPlayType

public static final class ThunderPublishPlayType

Publish play type

Constant (Default Value)Description
THUNDERPUBLISH_PLAY_SINGLE(0)Single publishing
THUNDERPUBLISH_PLAY_INTERACT(1)Video connection publishing
THUNDERPUBLISH_PLAY_SCREENCAP(2)Screen recording publishing
THUNDERPUBLISH_PLAY_MULTI_INTERACT(3)Multi-person video connection publishing

ThunderRtcConstant.ThunderRtcRemotePlayType

public static final class ThunderRtcRemotePlayType

Remote end display type

Constant (Default Value)Description
THUNDER_REMOTE_PLAY_NORMAL(0)common audience view
THUNDER_REMOTE_PLAY_MULTI(1)Multiple interaction view

ThunderRtcConstant.ThunderPublishVideoMode

public static final class ThunderPublishVideoMode

Video gear configuration

Constant (Default Value)DescriptionResolutionCodeRateFrameRate
THUNDERPUBLISH_VIDEO_MODE_NORMAL(1)SD320*240(landscape)200Kbps15fps
THUNDERPUBLISH_VIDEO_MODE_HIGHQULITY(2)HD368*640(portrait)500Kbps15fps
THUNDERPUBLISH_VIDEO_MODE_SUPERQULITY(3)UD544*960(portrait)1000Kbps24fps
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_2M(4)Blu-ray720*1280(portrait)1500Kbps24fps
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_4M(5)Blu-ray1080*1920(portrait)3000Kbps24fps

ThunderRtcConstant.ThunderVideoViewType

public static final class ThunderVideoViewType

View type

Constant (Default Value)Description
THUNDERVIDEO_VIEW_PREVIEW(1)Preview
THUNDERVIDEO_VIEW_PLAYVIEW(2)Play view

ThunderRtcConstant.ThunderRtcProfile

public static final class ThunderRtcProfile

Media mode

Constant (Default Value)Description
THUNDER_PROFILE_DEFAULT(0)Default mode, equals to THUNDER_PROFILE_NORMAL(1) audio/video mode
THUNDER_PROFILE_NORMAL(1)Audio/video mode (audio and video are both used)
THUNDER_PROFILE_ONLY_AUDIO(2)Pure audio mode (for scenario without video, so as to get more quality audio)

ThunderRtcConstant.ThunderVideoRenderMode

public static final class ThunderVideoRenderMode

Video rendering mode (the same as the scale mode)

Constant (Default Value)Description
THUNDERVIDEOVIEW_SCALE_MODE_FILL(0)Fill the window. If the proportion is not fit, it will be stretched to fill the window.
THUNDERVIDEOVIEW_SCALE_MODE_ASPECT_FIT(1)Adapt to the window. If the proportion is not fit, black edge will be left
THUNDERVIDEOVIEW_SCALE_MODE_CLIP_TO_BOUNDS(2)Fill the window. If the proportion is not fit, it will be cut out

ThunderRtcConstant.LiveEngineCaptureType

public static final class LiveEngineCaptureType

Live engine capture Class

Constant (Default Value)Description
THUNDER_CAPTURE_TYPE_DEFAULT_CAMERA(0)Camera
THUNDER_CAPTURE_TYPE_SCREEN_RECORD(1)Screen recording
THUNDER_CAPTURE_TYPE_EXTERNAL_SOURCE(2)External stream publishing yuv

ThunderRtcConstant.ThunderVideoCodecType

public static final class ThunderVideoCodecType

Protocol Class for encoding and decoding video

Constant (Default Value)Description
VIDEO_CODEC_UNKNOW(0)Unknown type
VIDEO_CODEC_VP8(1)VP8
VIDEO_CODEC_H264(2)H264
VIDEO_CODEC_H265(3)H265

ThunderRtcConstant.ThunderVideoQualityAdapt

public static final class ThunderVideoQualityAdapt

Quality adaptability of local videos since last statistics (based on target frame rate and target code rate)

Constant (Default Value)Description
ADAPT_NONE(0)The quality of local video is constant
ADAPT_UP_BANDWIDTH(1)The quality of local video has been improved because of higher network bandwidth
ADAPT_DOWN_BANDWIDTH(2)The quality of local video becomes worse because of lower network bandwidth

ThunderRtcConstant.ThunderAudioOutputRouting

public static final class ThunderAudioOutputRouting

The type of the current audio routing.

Constant (Default Value)Description
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

ThunderRtcConstant.ReverbExParameter

Reverberation parameter Class

public static final class ReverbExParameter {
        /**
         * Room size; range [0~100]
         */
        public float mRoomSize = 0;
        /**
         * Pre-delay; range [0~200]
         */
        public float mPreDelay = 0;
        /**
         * Reverberation; range: [0~100]
         */
        public float mReverberance = 0;
        /**
         * High frequency factor; range [0~100]
         */
        public float mHfDamping = 0;
        /**
         * Low frequency; range: [0~100]
         */
        public float mToneLow = 0;
        /**
         * High frequency; range: [0~100]
         */
        public float mToneHigh = 0;
        /**
         * Wet gain; range: [-20~10]
         */
        public float mWetGain = 0;
        /**
         * Dry gain; range: [-20~10]
         */
        public float mDryGain = 0;
        /**
         * Stereo width range: [0~100]
         */
        public float mStereoWidth = 0;
    }

ThunderRtcConstant.CompressorParam

Compressor parameter Class

public static final class CompressorParam {
        /**
         * Threshol; range: [-40~0]
         */
        public int mThreshold = 0;
        /**
         * Gain
         */
        public int mMakeupGain = 0;
        /**
         * Ratio
         */
        public int mRatio = 0;
        /**
         * Slope
         */
        public int mKnee = 0;
        /**
         * Release time; range: greater than0
         */
        public int mReleaseTime = 0;
        /**
         * Start time; range: greater than 0
         */
        public int mAttackTime = 0;
    }

ThunderRtcConstant.LimterParam

Limiter parameter Class

public static final class LimterParam {
        /*
         *  -30 ~ 0
         */
        public float fCeiling = 0;
        /*
         *  -10 ~ 0
         */
        public float fThreshold = 0;
        /*
         *   0 ~ 30
         */
        public float fPreGain = 0;
        /*
         *  0 ~ 1000
         */
        public float fRelease = 0;
        /*
         *  0 ~ 1000
         */
        public float fAttack = 0;
        /*
         *   0 ~ 8
         */
        public float fLookahead = 0;
        /*
         * 0.5 ~ 2
         */
        public float fLookaheadRatio = 0;
        /*
         * 0 ~ 100
         */
        public float fRMS = 0;
        /*
         * 0 ~ 1
         */
        public float fStLink = 0;
    }

ThunderVideoEncoderConfiguration

Parameter Class of video encoding configuration

public class ThunderVideoEncoderConfiguration {
    public int playType;//Playing method
    public int publishMode;//Publish bracket
}
Profile (value)Description
playTypePlay type. For the optional value, refer to ThunderRtcConstant.ThunderVideoCaptureOrientation for details
publishModePublish bracket. For the optional value, refer to ThunderRtcConstant.ThunderVideoCaptureOrientation for details

ThunderVideoEncodeParam

Video coding inforamtion

public class ThunderVideoEncodeParam {
    public int width; // Width
    public int height; // Height
    public int frameRate; // Frame rate
    public int codeRate; // Code rate
}

ThunderBoltImage

Parameter Class for video watermark configuration

public class ThunderBoltImage {

    /*
     * During the local video living streaming and mixed video publishing, URL is defined differently.
     * During the local live streaming, URL indicates the local absolute path of image on the local live streaming video;
     * During the mixed video publishing, URL indicates the address of watermark image outputted by mixed audio. (The watermark is not supported in the mixed video output stream for the time being).
     */
    public String url;
    public int x;      //The horizontal coordinate at upper left corner of the picture on the video frame.
    public int y;      //The vertical coordinate at upper left corner of the picture on the video frame.
    public int width;  //The width of the picture on the video frame.
    public int height; //The height of the picture on the video frame.

}

ThunderMultiVideoViewParam

The display layout parameter of multi-channel videos when there is multiple interaction

public class ThunderMultiVideoViewParam {
    public ArrayList<VideoPosition> mVideoPositions;    // Layout parameters of video/view
    public VideoPosition mBgPosition;                   // Layout parameters of video/view background picture
    public Bitmap mBgBitmap;                            // Video/view background picture
}
ParameterDescription
mVideoPositionsThe position information of all grids. Multiple video is combined based on array
mBgPositionThe position information of background pictures
bgImageNameBackground picture
/*
 * The following is VideoPosition diagram. The outline border indicates the overall video layout, and Video is a single vide area.
 *
 * |---------------------------------------------|
 * | (0,0)                                       |
 * |                                             |
 * |                             (mX,mY)         |
 * |                               |---width---| |
 * |                               |           | |
 * |                        height |           | |
 * |                               | Video     | |
 * |                               |           | |
 * |                               |-----------| |
 * |---------------------------------------------|
 */
public class VideoPosition {
    public int mIndex  = 0;  // Seat information for a single video/view layout
    public int mX      = 0;  // X coordinate of a single video/view layout
    public int mY      = 0;  // Y coordinate of a single video/view layout
    public int mWidth  = 0;  // Width of a single video/view
    public int mHeight = 0;  // Height of a single video/view
}

ThunderVideoCanvas

Video display canvas

public class ThunderVideoCanvas {
    public Object mView = null;//The view used to render video, often filled with FrameLayout
    public int mRenderMode;//Render vidio scale mode, refer to ThunderRtcConstant.ThunderVideoRenderMode for optional values
    public String mUid;//User’s uid
    public int mSeatIndex;// Display location of the user specified by mUid
}

LiveTranscoding

Configuration Class of video mixing and transcoding task

public class LiveTranscoding {

    //Video mixing transcoding bracket, developing output video coding parameters (such as resolution, bit rate, frame rate, etc.) by setting bracket, which is configured in the background of Jocloud, and may be changed according to the needs of developers. See ThunderRtcConstant.LiveTranscodingMode for the default configuration information of the bracket
    private int mTransCodingMode;

    // Other parameters of video mixing, such as audio and video accompany address, lyrics address, etc.
    private String mAudioUrl = "";  // URL of the standard audio file; support audio in Mp3 format
    private String mLyricUrl = "";   // URL of lyric in LRC format, and the lyric file should be encoded in UTF-8 format. If this field is not configured, the audio will be played without lyrics; Otherwise, the lyrics will be added to the mixed video in the default style.
    private String mMediaUrl = "";  // Video file url as standard
    private MediaStreamLayout mMediaStreamLayout; //Layout of video standard stream in video mixing, see LiveTranscoding.MediaStreamLayout below for details

    //All users in video mixing, see LiveTranscoding.TranscodingUser below for details
    private ArrayList<TranscodingUser> mUserList = new ArrayList<>();


    //Related operable functions
    /**
     * Add a user to the mixed video layout
     *
     * @param user
     * @return 0
     */
    public int addUser(TranscodingUser user);
    /**
     * Set user mixed video layout in batches
     * In this method, the user sets all users participating in the combined picture. This method replaces the original data with new User data.
     *
     * @param users All mixed video users in channel
     */
    public void setUsers(ArrayList<TranscodingUser> users);

    /**
     * Get current user location information
     *
     * @return Get information of all users in mixed video canvas in channel
     */
    public final ArrayList<TranscodingUser> getUsers()

    /**
     * Remove users joining video mixing
     *
     * @param uid ID User ID to be removed
     * @return 0
     */
    public int removeUser(String uid);

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

    /**
     * Get the number of users joining video mixing
     *
     * @return Number of users joining video mixing
     */
    public int getUserCount();
    /**
     *  Set the bracket of mixed video outputted
     *
     * @param transCodingMode
     */
    public void setTransCodingMode(int transCodingMode);

    /**
     * Get the bracket of mixed video outputted
     *
     * @return Bracket of mixed video outputted
     */
    public int getTransCodingMode();

    /**
     * Set the external pure audio url as the standard stream for this mixed video. As the progress of the standard stream playback is required internally for synchronization of mixed video,
     * 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 a 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, then read out the corresponding lyrics progress, and draw the lyrics according to the progress.
     * @param audioUrl Standard video file url
     * @param lyricUrl url of the lyrics file corresponding to the audio. The bank indicates no lyrics, otherwise the lyrics will be added to the mixed video in the default style.
     * @return 0 Succeeded, <0 Failed
     */
     public final int setAudioOnlyStandardSreamUrl(String audioUrl, String lyricUrl);

     /**
    * he external video media stream is set as the standard stream for mixed video, which cannot be used through API setAudioOnlyStandardSreamUrl simultaneously.
    * @param mediaUrl Standard video file url
    * @param layout  Layout information of video media stream in the mixed video.
    * @return 0 Succeeded, <0 Failed
    */
    public final int setMediaStandardSream(String mediaUrl,  MediaStreamLayout layout);
}

Used layout information configuration types include:

For the default configuration of video mixing and transcoding output bracket, refer to ThunderRtcConstant.LiveTranscodingMode for details


LiveTranscoding

LiveTranscoding.TranscodingUser

Layout configuration information participated in user’s mixed video stream

public static class TranscodingUser {

        public String uid;
        public String roomId;
        public boolean bStandard;//Standard stream user or not
        public int layoutX;        //User's location x in video mixing canvas
        public int layoutY;        //User's location y in video mixing canvas
        public int layoutW;        //User's location w in video mixing canvas
        public int layoutH;        //User's location h in video mixing canvas
        public int zOrder;      //Layer number of the user's 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
        public boolean bCrop;   //How to crop the source stream when the video mixing service places it in the canvas (0: mend black edge, 1: crop)
        public int cropX;      //X coordinate of crop region
        public int cropY;      //Y coordinate of crop region
        public int cropW;      //Width of crop region
        public int cropH;      //Height of crop region
        public 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
        public int audioRoom;//Not yet realized

    }

LiveTranscoding.MediaStreamLayout

Layout configuration information of video standard stream in video mixing.

public static class MediaStreamLayout {

        public int layoutX = 0;        //Media's location x in video mixing canvas
        public int layoutY = 0;        //Media's location y in video mixing canvas
        public int layoutW = 0;        //Media's location w in video mixing canvas
        public int layoutH = 0;        //Media's location h in video mixing canvas
        public int zOrder = 0;      //Layer number of the media's 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
        public boolean bCrop = true;   //How to crop the source stream when the video mixing service places it in the canvas (0: mend black edge, 1: crop)
        public int cropX = 0;      //X coordinate of crop region
        public int cropY = 0;      //Y coordinate of crop region
        public int cropW = 0;      //Width of crop region
        public int cropH = 0;      //Height of crop region
        public float alpha = 0;      //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

    }

Was this page helpful?

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