Function | Function Name |
---|---|
void | consumePixelBuffer:withTimestamp:rotation: |
void | consumeRawData:withTimestamp:format:size:rotation: |
void | consumeCMSampleBuffer: |
Function | Function Name |
---|---|
void | setPlayerDelegate: |
void | open: |
void | close |
void | play |
void | Stop |
void | pause |
void | resume |
void | seek: |
uint32_t | getTotalPlayTimeMS |
uint32_t | getCurrentPlayTimeMS |
void | setPlayVolume: |
int | setPlayerLocalVolume |
int | setPlayerPublishVolume |
int | getPlayerLocalVolume |
int | getPlayerPublishVolume |
void | setSemitone: |
int | setLooping: |
int | selectAudioTrack: |
void | setTempo: |
void | setPosition: |
int | getAudioTrackCount |
void | enablePublish: |
void | enableSpectrum: |
void | enableVolumeIndication:interval: |
void | setMixStandard: |
BOOL | isMixStandard |
int | getCurrentSpectrum:len: |
Function | Function Name |
---|---|
bool | registerAudioFrameObserver |
+ (instancetype _Nonnull)createEngine:(NSString * _Nonnull)appId
sceneId:(NSInteger)sceneId
delegate:(id<ThunderEventDelegate> _Nullable)delegate;
Create a ThunderEngine instance and initialize it.
Notes:
- Currently, the SDK only supports one ThunderEngine instance, meaning that each application can only create one ThunderEngine object.
- Unless otherwise specified, all API functions of ThunderEngine are asynchronously called, and the API is called in the same thread.
- Users with the same AppId can communicate with one another.
- SceneId is used to differentiate between a service's scenarios, assisting scenario-specific data analysis.
Parameter | Description |
---|---|
appId | Application ID issued for application developers |
sceneId | Developer-customized scenario ID used for subdividing service scenarios; if unnecessary, fill 0 |
delegate | Callback. See details in ThunderEventDelegate. |
+ (void)destroyEngine;
Destroy a ThunderEngine instance
Notes:
- Releases all resources used by the SDK.
- Call this API for applications in which users occasionally make audio or video calls. When users do not make calls, you can free up resources for other operations.
- Once destroyEngine is called, the user cannot call or call back other APIs in the SDK.
- To re-enable real-time communication, call createEngine again to create a new ThunderEngine instance.
- The created file player object ThunderAudioFilePlayer will also be released.
+ (NSString * _Nonnull)getVersion;
Get SDK version number.
Notes:
- This API returns the SDK’s version number string.
- (void)setSceneId:(NSInteger)sceneId;
Set scenario ID.
Parameter | Description |
---|---|
sceneId | Developer-customized scenario ID used for subdividing service scenarios; if unnecessary, fill 0 |
- (void)setThunderEventDelegate:(id<ThunderEventDelegate> _Nullable)delegate;
Set a proxy API.
Parameter | Description |
---|---|
delegate | See proxy APIs in ThunderEventDelegate. |
- (int)setArea:(ThunderRtcAreaType)area
Set a user's country/region.
To accommodate differing laws and regulations, Jocloud has central systems each for domestic (default) and international users. Set area as follows:
Notes:
- This API should be called before joinRoom, and it is required for international users.
- The available parameters are listed in ThunderRtcAreaType.
- This API can only be reset by calling destroyEngine.
Parameter | Description |
---|---|
area | The default region setting is domestic. See details in ThunderRtcAreaType. |
-(int)joinRoom:(NSString * _Nullable)token
roomName:(NSString * _Nonnull)roomName
uid:(NSString * _Nonnull)uid;
Join a room.
Notes:
-Users with different AppIDs cannot call each other. -Successful function return only indicates that the request has executed successfully. Successful joining of a room is indicated by the callback onJoinRoomSuccess.
- When background is set to appid mode, token value is null.
Parameter | Description |
---|---|
token | Token for authentication, see detailed operations in User Authentication. |
roomName | Room name (unique to each application ID), which only supports a combination of characters such as [A,Z],[a,z],[0,9],-,_ , and cannot exceed 64 bytes. |
uid | User ID, which only supports a combination of characters such as [A,Z],[a,z],[0,9],-,_, and cannot exceed 64 bytes. |
- (int)leaveRoom;
Exit a room to end a call.
Notes:
- (int)updateToken:(NSString * _Nonnull)token;
This method is used to update Token and authenticate service.
Notes:
- Following are the recommended formats. See details in User Authentication.
uint16 | uint32 | uint64 | uint64 | uint32 | uint16 | nBytes | 20 Bytes |
---|---|---|---|---|---|---|---|
TokenLen | AppId | uid | TimeStamp(ms) | ValidTime(s) | BizExtInfoLen | BizExtInfoData | DigitalSignature |
Parameter | Description |
---|---|
token | Token for authentication, see details in User Authentication. |
- (int)setLogFilePath:(NSString * _Nonnull)filePath;
Set directory for SDK to output log files. A directory with write permissions must be specified.
Notes:
-One of two ways to output SDK logs. The application specifies the output directory and ensures its writability, and the SDK will output logs to this directory.
- Set log callback. Once log callback is set, setLogFilePath is invalid.
Parameter | Description |
---|---|
filePath | Complete list of log files |
- (int)setLogCallback:(nullable id<ThunderRtcLogDelegate>)delegate
Set log callback output.
Notes:
- One of two ways to output SDK logs. The SDK calls back log messages to the application for writing.
- After log callback is set, setLogFilePath will be invalid.
Parameter | Description |
---|---|
delegate | See details in ThunderRtcLogDelegate for log protocol. |
- (int)setLogLevel:(ThunderRtcLogLevel)level;
Set level for filtering log output.
Notes:
- Set log output filtering level, which is to be invoked before setLogFilePath or setLogCallback. Without calling this API, the default log level THUNDER_LOG_LEVEL_INFO will be used.
Parameter | Description |
---|---|
level | See details in ThunderRtcLogLevel for log level. |
- (int)addPublishOriginStreamUrl:(NSString* _Nonnull)url;
Add source stream pushing address.
Notes:
- After this API is called, the anchor's current audio/video stream will be pushed to the specified CDN address. To update URL, first call the removePublishOriginStreamUrl, and add after removing the original address.
- With this API, only one-channel stream pushing addresses can be added each time. If multi-channel streams need to be pushed, this API has to be called repeatedly. A maximum of five addresses are supported for stream pushing.
- The server will push the source stream to the corresponding URL after publishing. It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
Parameter | Description |
---|---|
url | CDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes. |
- (int)removePublishOriginStreamUrl:(NSString* _Nonnull)url;
Remove source stream pushing address.
Notes:
- After this API is called, the anchor's current audio/video stream will not be pushed to the specified CDN address.
Parameter | Description |
---|---|
url | CDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud supports merely 256 bytes. |
- (int)setLiveTranscodingTask:(NSString* _Nonnull)taskId transcoding:(LiveTranscoding* _Nonnull)transcoding;
Add/update stream mixing taskLiveTranscoding.
Notes:
- After this API is called, the Jocloud background will start the stream mixing and transcoding tasks, and start the video mixing and audio mixing with all source streams set. The application needs specific stream mixing IDs to differentiate different stream mixing tasks.
- This API can be called repeatedly to update stream mixing parameters during the process. Multiple stream mixing tasks can be set in the same room.
- It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
- The stream pushing address can be added to stream mixing and transcoding tasks with the addPublishTranscodingStreamUrl. The stream mixing and transcoding will be pushed to the specified address after stream mixing and transcoding operations are complete.
Parameter | Description |
---|---|
taskId | The stream mixing task ID is generated by the application. It must be globally unique |
transcoding | See details in LiveTranscoding for information about stream mixing configuration. |
- (int)addPublishTranscodingStreamUrl:(NSString* _Nonnull)taskId url:(NSString* _Nonnull)url;
Add mixed stream pushing address.
Notes:
- Call this API after adding transcoding task by calling setLiveTranscodingTask. -After this API is called, the specified mixed stream will be pushed to the specified CDN address. To update URL, first call the removePublishTranscodingStreamUrl and add after removing the original address.
- Add a stream pushing address for specified a transcoding task; only one address can be added at a time. If multiple-channel streams have to be pushed, call this API multiple times. At most five stream pushing addresses are supported for one transcoding task.
- It can be called after joining the room joinRoom, and the configuration will be cleared after exiting the room leaveRoom.
Parameter | Description |
---|---|
taskId | Stream mixing task ID |
url | CDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes |
- (int)removePublishTranscodingStreamUrl:(NSString* _Nonnull)taskId url:(NSString* _Nonnull)url;
Remove mixed stream pushing address.
Notes:
- After this API is called, the specified mixed stream will not be pushed to the specified CDN address.
- With this API, only single-channel stream pushing address can be deleted each time. If multi-channel streams need to be removed, this API has to be called repeatedly.
- Call it after joining a room joinRoom.
Parameter | Description |
---|---|
taskId | Stream mixing task ID |
url | CDN stream pushing addresses are in RTMP format. Character length cannot exceed 512 bytes. Note: some CDN manufacturers may not support 512 bytes; for example, Alibaba Cloud only supports 256 bytes |
- (int)removeLiveTranscodingTask:(NSString* _Nonnull)taskId;
Remove the stream mixing task.
Notes:
- After this API is called, the Jocloud background will remove and stop the stream mixing task, but the URL added by the addPublishTranscodingStreamUrl will not be removed.
Parameter | Description |
---|---|
taskId | The stream mixing task ID is generated by the application. It must be globally unique |
- (int)addSubscribe:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid;
Cross-room subscription.
Notes:
- Subscribe to the audio/video streams of other rooms after joining a room. In other words, this function can be called after joining a room joinRoom,and the configuration will be cleared after exiting the room.
Parameter | Description |
---|---|
roomId | Room No. |
uid | User ID |
- (int)removeSubscribe:(NSString* _Nonnull)roomId uid:(NSString* _Nonnull)uid;
Remove cross-room subscription.
Notes:
- Call this API to remove audio/video stream subscriptions to other rooms. This has the opposite effect of the addSubscribe. It can only be called after joining the room joinRoom.
Parameter | Description |
---|---|
roomId | Room No. |
uid | User ID |
- (int)setMediaMode:(ThunderRtcConfig)mode;
Set the SDK media mode.
Notes:
- Media modes for the SDK include both audio-only and A/V(audio/video) modes. This API shall be called before joining a room, and is invalid after joining the room. If not called, the default mode is audio/video.
Parameter | Description |
---|---|
mode | See details in ThunderRtcConfig for media mode. |
- (int)setRoomMode:(ThunderRtcRoomConfig)mode;
Set the room scenario mode.
Notes:
- This API is for setting the room scenario mode. Live streaming mode is by default upon non-callback. It can be used before and after joining the room.
- By knowing the application scenario (e.g. communication mode, live streaming mode), the SDK can apply different optimization APIs.
Parameter | Description |
---|---|
mode | See details in ThunderRtcRoomConfig for media mode. |
- (int)enableWebSdkCompatibility:(BOOL)enabled;
Enable/disable WebSDK compatibility.
Notes:
- Applicable only to live streaming scenarios.
- Enabling WebSDK compatibility internally prohibits B-frames, because WebSDK cannot normally decode B-frames. It should be called before publishing. -Co-hosting is compatible with Web SDK by default, without the need to call this API.
Parameter | Description |
---|---|
enabled | YES: compatible NO: incompatible (default) |
- (int)setVideoEncoderConfig:(ThunderVideoEncoderConfiguration* _Nonnull)config;
Set video encoding profile.
Notes:
- The SDK will obtain specific parameters for encoding video from the configuration server. If you have special parameter requirements for encoding video, you may contact customer support for personalized configuration.
- If video has been published, update the video encoding parameters. Local preview and remote subscription will be able to see the updated effect.
Parameter | Description |
---|---|
config | See details in ThunderVideoEncoderConfiguration for encoding configuration. |
- (int)setLocalVideoCanvas:(ThunderVideoCanvas *_Nullable)local;
Set local view.
Notes:
- If this window is not set, you can still preview and publish. You can view locally captured pictures by setting this window.
Parameter | Description |
---|---|
local | See details in ThunderVideoCanvas for specific rendering settings. |
- (int)setRemotePlayType:(ThunderRtcRemotePlayType)remotePlayType;
Set the remote view mode.
Notes:
- Set whether to enable remote view of multi-person co-hosting and enter many-to-many mode. Call before joining the channel after “initialization”.
Parameter | Description |
---|---|
remotePlayType | See details in ThunderRtcRemotePlayType for view display mode. |
- (int)setMultiVideoViewLayout:(ThunderMultiVideoViewParam* _Nonnull)params;
Set multi-person co-hosting layout.
Notes:
- For setting the multi-person co-hosting layout, call before joining the channel, after “initialization”.
Parameter | Description |
---|---|
params | See details in ThunderMultiVideoViewParam for specific co-hosting layout. |
- (int)setRemoteVideoCanvas:(ThunderVideoCanvas *_Nonnull)remote;
Set remote user view.
Notes:
- You can subscribe without setting this window. By setting this window, you can see the corresponding video of remote users who subscribed.
Parameter | Description |
---|---|
remote | See details in ThunderVideoCanvas for specific view setting. |
- (int)setLocalCanvasScaleMode:(ThunderVideoRenderMode)mode;
Set local view mode.
Parameter | Description |
---|---|
mode | See details in ThunderVideoRenderMode |
- (int)setRemoteCanvasScaleMode:(NSString* _Nonnull)uid mode:(ThunderVideoRenderMode)mode;
Set the remote view mode.
Parameter | Description |
---|---|
uid | User ID |
mode | See details in ThunderVideoRenderMode. |
- (int)startVideoPreview;
Enable video preview.
- (int)stopVideoPreview;
Disable video preview.
Notes:
- Disabling preview will stop video.
- (int)enableLocalVideoCapture:(BOOL)enabled;
Enable/disable local video capture.
Parameter | Description |
---|---|
enabled | YES: enable local video capture NO: disable local video capture |
- (int)stopLocalVideoStream:(BOOL)stopped;
Enable/disable local video stream transmission.
Notes:
- Call this API after joining the room via (joinRoom).
Parameter | Description |
---|---|
stopped | YES: disable local video transmission NO: enable local video transmission |
- (int)stopAllRemoteVideoStreams:(BOOL)stopped;
Stop/resume receiving all video streams.
Notes:
- After setting "stop" to "false", all video streams in the room will be subscribed to automatically. You can unsubscribe to a specific stream via stopRemoteVideoStream.
- After setting "stop" to "true“, no video streams in the room will be subscribed to. You can subscribe to a specific stream via stopRemoteVideoStream.
- This API has no precedence relationship with stopRemoteVideoStream, and the last called API is effective.
Parameter | Description |
---|---|
stopped | YES: receive none NO: receive all (default) |
- (int)stopRemoteVideoStream:(NSString* _Nonnull)uid stopped:(BOOL)stopped;
Stop/resume receiving specified video stream.
Notes:
- Upon stopping the reception, you can receive all audio streams via stopAllRemoteVideoStreams, and vice versa.
This API has no precedence relationship with stopAllRemoteVideoStreams,and the last called API is effective.
Parameter | Description |
---|---|
uid | User ID |
stopped | YES: stop receiving remote video streams of specified users NO: start receiving remote video streams of specified users |
- (void)setCustomVideoSource:(id<ThunderCustomVideoSourceProtocol> _Nullable)videoSource;
Set customized video source.
Notes:
<<<<<<< HEAD:en/product_category/rtc_service/rt_audio_interaction/api/iOS/v2.9.20/function.md
- In real-time communication, Jocloud SDK usually enables the default video input device, i.e. the built-in camera, for video pushing. To customize video device, the application can customize an object to realize ThunderCustomVideoSourceProtocol protocol, and call this method to add the customized video source to the SDK. =======
- In real-time communication, Jocloud SDK usually enables the default video input device, i.e. the built-in camera, for video pushing. To customize video device, the application can customize an object to realize ThunderCustomVideoSourceProtocol protocol, and call this method to add the customized video source to the SDK.
域名更换:en/product_category/rtc_service/rt_audio_interaction/api/iOS/v2.9.20/function.md
Parameter | Description |
---|---|
videoSource | See details in ThunderCustomVideoSourceProtocol. |
- (int)setVideoWatermark:(ThunderImage *_Nonnull)watermark;
Set local video watermark.
Notes:
- This API adds a PNG-format image as a watermark for publishing along with local video.
- If the PNG image size is incompatible with your method settings, the SDK will clip it to match.
- Only one watermark can be added to live video, and any watermark added later will replace the former one.
- The watermark will rotate along with any display rotation.
Parameter | Description |
---|---|
watermark | Watermark name |
-(int)registerVideoDecodeFrameObserver:(nullable id<ThunderDecodeFrameObserver>)delegate uid:(nonnull NSString*)uid;
Customize decoding picture rendering.
Parameter | Description |
---|---|
delegate | See details in ThunderVideoDecodeFrameObserver for API of capturing decoding image. |
uid | Indicate the video stream of the user ID to be obtained |
-(int)registerVideoCaptureFrameObserver:(nullable id<ThunderVideoCaptureObserver>)delegate;
Customize image pre-processing function.
Parameter | Description |
---|---|
delegate | See details in ThunderVideoCaptureFrameObserver for pre-processing API for local video frame. |
- (int)switchFrontCamera:(BOOL)bFront;
Switch to front/rear camera.
Notes:
- Call this API to switcht to front/rear camera. After the startVideoPreview is called, the callback is effective. The front camera is enabled by default when the API is not called.
Parameter | Description |
---|---|
bFront | YES: enable front camera NO: enable rear camera |
- (int)setVideoCaptureOrientation:(ThunderVideoCaptureOrientation)orientation;
Set portrait and landscape.
Notes:
- Call this API to set portrait and landscape. It can be called either before preview startVideoPreview, or during the publishing. If not called, the portrait orientation is applied by default.
Parameter | Description |
---|---|
orientation | See details in ThunderVideoCaptureOrientation for portrait and landscape. |
- (int)setLocalVideoMirrorMode:(ThunderVideoMirrorMode)mode;
Set camera mirror.
Notes:
- Call this API to set camera mirror before preview startVideoPreview, or during the publishing.
- Applicable to the front camera only.
- Preview and stream pushing are not mirrored for rear camera. Preview is mirrored but stream pushing is not mirrored for front camera by default.
Parameter | Description |
---|---|
mode | See details in ThunderVideoMirrorMode for mirror mode. |
- (int)enableLoudspeaker:(BOOL)enableSpeaker;
Enable/disable loudspeaker.
Notes:
- You can call this API to forcibly set the audio router as loudspeaker.
Parameter | Description |
---|---|
enabled | YES: play with loudspeaker NO: play with receiver |
- (BOOL)isLoudspeakerEnabled;
Query loudspeaker status.
- (int)setAudioConfig:(ThunderRtcAudioConfig)config
commutMode:(ThunderRtcCommutMode)commutMode
scenarioMode:(ThunderRtcScenarioMode)scenarioMode;
Set audio profiles.
Notes:
- This API is used to set audio parameters and application scenarios.
Parameter | Description |
---|---|
config | See details in ThunderRtcAudioConfig. |
commuMode | See details in ThunderRtcCommutMode for setting interaction mode. |
scenarioMode | See details in ThunderRtcScenarioMode for setting scenario mode. |
- (int)setAudioVolumeIndication:(NSInteger)interval
moreThanThd:(NSInteger)moreThanThd
lessThanThd:(NSInteger)lessThanThd
smooth:(NSInteger)smooth;
Enable the speaker volume prompt.
Notes:
- This API enables the SDK to report that who is talking and the speaker's volume.
- Return via onPlayVolumeIndication.
- The volume does not include the volume captured by local microphone or the volume of the audio file being played.
Parameter | Description |
---|---|
interval | Callback interval =0 by default <=0, the volume prompt is disabled, >0, callback interval (ms) |
moreThanThd | From <= 0 invalid, range: [0,100], default value: 0 |
lessThanThd | From >= lessThanThd to < lessThanThd, immediate callback once (not subject to interval) <= 0 invalid, range: [0,100], default value: 0 |
smooth | Invalid momentarily |
- (int)enableCaptureVolumeIndication:(NSInteger)interval
moreThanThd:(NSInteger)moreThanThd
lessThanThd:(NSInteger)lessThanThd
smooth:(NSInteger)smooth;
Enable/disable capture volume callback.
Notes:
- This API enables the SDK to periodically send the application feedback on current microphone capture volume.
- Return via onCaptureVolumeIndication.
Parameter | Description |
---|---|
interval | Callback interval; <=0, the volume prompt is disabled, >0, callback interval (unit: ms), =0 by default |
moreThanThd | From < moreThanThd to >=moreThanThd, immediate callback once (not subject to interval) <= 0 invalid, range: [0,100], default value: 0 |
lessThanThd | From >= lessThanThd to < lessThanThd, immediate callback once (not subject to interval) <= 0 invalid, range: [0,100], default value: 0 |
smooth | Invalid momentarily |
- (int)stopLocalAudioStream:(BOOL)stopped;
Enable/disable local audio sending.
Notes:
- This API is used to enable/disable sending local audio stream to the network.
- This API is called after joining a room joinRoom
Parameter | Description |
---|---|
stopped | YES: disable local audio sending NO: enable local audio sending |
- (int)stopAllRemoteAudioStreams:(BOOL)stopped;
Stop/resume receiving all audio streams.
Notes:
- After setting "stop" to "NO", all video streams in the room will be subscribed to automatically. You can unsubscribe to a specific stream via stopRemoteAudioStream.
- After setting "stop" to "YES“, no video streams in the room will be subscribed to. You can subscribe to a specific stream via stopRemoteAudioStream.
- This API has no precedence relationship with stopRemoteAudioStream, and the last called API is effective.
Parameter | Description |
---|---|
stopped | YES: receive none NO: receive all (default) |
- (int)stopRemoteAudioStream:(nonnull NSString*)uid stopped:(BOOL)stopped;
Stop/resume receiving specified video stream.
Notes:
- Upon stopping the reception, you can receive all audio streams via stopAllRemoteAudioStreams, and vice versa.
- This API has no precedence relationship with stopAllRemoteAudioStreams, and the last called API is effective.
Parameter | Description |
---|---|
uid | User ID |
stopped | YES: stop receiving the remote audio stream of specified users NO: start receiving remote audio stream of specified users |
- (int)setLoudSpeakerVolume:(NSInteger)volume;
Set the loudspeaker volume.
Parameter | Description |
---|---|
volume | Volume, range:[0-400] |
- (int)setMicVolume:(NSInteger)volume;
Set microphone volume.
Parameter | Description |
---|---|
volume | Volume, range:[0-400] |
- (int)setPlayVolume:(nonnull NSString*)uid volume:(NSInteger)volume;
Set volume for a specified user.
Parameter | Description |
---|---|
uid | Specified user ID |
volume | Volume, range:[0-400] |
- (nullable ThunderAudioFilePlayer*)createAudioFilePlayer;
Create an object of audio file player. See details in ThunderAudioFilePlayer.
- (void)destroyAudioFilePlayer:(nonnull ThunderAudioFilePlayer*)filePlayer;
Destroy the object of audio file player.
Parameter | Description |
---|---|
filePlayer | See details in ThunderAudioFilePlayer for file player object. |
- (int)setEnableInEarMonitor:(BOOL)enabled;
Enable/disable the in-ear monitoring.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setEnableEqualizer:(BOOL)enabled;
Enable/disable local voice equalizer.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setEqGains:(const _Nonnull ThunderEqGainsOc)gains;
Set equalizer parameters.
Parameter | Description |
---|---|
gains | See details in ThunderEqGainsOc for equalizer parameters. |
- (int)setEnableReverb:(BOOL)enabled;
Enable/disable local sound reverberation.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setReverbParam:(ThunderReverbExParamOc)reverbParam;
Set reverb parameters.
Parameter | Description |
---|---|
reverbParam | See details in ThunderReverbExParamOc for reverberation parameters. |
- (int)setEnableCompressor:(BOOL)enabled;
Enable/disable sound compressor.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setCompressorParam:(ThunderCprParamOc)parameter;
Set compressor parameters.
Parameter | Description |
---|---|
parameter | See details in ThunderCprParamOc for compressor parameters. |
- (int)setEnableLimiter:(BOOL)enabled;
Enable/disable pressure limiter.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setLimiterParam:(ThunderLimiterParamOc)parameter;
Set pressure limiter parameters.
Parameter | Description |
---|---|
parameter | See details in ThunderLimiterParamOc for pressure limiter parameters. |
- (void)setAudioSourceType:(ThunderSourceType)sourceType;
Set the audio publishing mode.
Parameter | Description |
---|---|
sourceType | See details in ThunderSourceType for audio publishing mode. |
- (void)enableAudioPlaySpectrum:(Boolean)enable;
Enable/disable the callback of audio play spectrum data.
Parameter | Description |
---|---|
enable | YES: enable NO: disable |
- (void)setAudioPlaySpectrumInfo:(UInt32)spectrumLen notifyIntervalMS:(UInt32)notifyIntervalMS;
Set playing spectrum parameters.
Parameter | Description |
---|---|
spectrumLen | The length of the spectrum data, range: [12-256], default: 256 |
notifyIntervalMS | Callback interval (ms), which should be a multiple of 10, and the default value is 30 ms |
- (int)sendUserAppMsgData:(NSData * _Nonnull)msgData
Send service-customized broadcast message.
Notes:
- Send service-customized broadcast message in the room. Call this API to send messages via the UDP channel, which may be unreliable and low-latency. Constraints are as follows:
- The sender must join the room.
- The API can only be called after successfully connecting the microphone (messages cannot be sent if there is only audience or if broadcast authentication fails).
- This API can be called no more than twice/second, and the msgData size cannot exceed 200 Byte.
- msg will be dropped if any of the above conditions are unmet.
- There is no guarantee that messages will be delivered to all online users in the room, and no guarantee that they will be delivered in order.
- Call back customized broadcast message sent by other users to the application via onRecvUserAppMsgData. -You can get the cause of msg sending failure via onSendAppMsgDataFailedStatus.
Parameter | Description |
---|---|
msgData | Message sent |
- (int)sendMediaExtraInfo:(NSData * _Nonnull)data;
Send SEI.
Use video channel when uploading video, otherwise use audio channel.
Notes:
- The sender must join the room, and call it after successfully publishing the audio.
- Audio-only broadcast (publishing in an audio-only mode or only publishing audio in an audio/video mode) calling frequency cannot exceed once every 100 ms. If video publishing in audio/video mode, calling frequency cannot exceed the frame rate. For example: stream pushing adopts a default frame rate of 15 fps, meaning that the frequency of calling cannot exceed 1000/15=66.7 ms per occurrence.
- If only publishing audio (publishing in audio-only mode or publishing only audio in audio/video mode), SEI cannot exceed 200 bytes; if video publishing in audio/video mode, SEI must not exceed 2048 bytes.
- Packet loss may occur.
- You can get the cause of SEI sending failure by calling onSendMediaExtraInfoFailedStatus under proxy of ThunderMediaExtraInfoDelegate.
- Call back SEI sent by other users to the application via onRecvMediaExtraInfo under proxy of ThunderMediaExtraInfoDelegate.
Parameter | Description |
---|---|
Date | SEI data to be transmitted |
- (int)setMediaExtraInfoDelegate:(nullable id<ThunderMediaExtraInfoDelegate>)delegate;
Set callback monitoring for SEI.
Parameter | Description |
---|---|
delegate | See details in ThunderMediaExtraInfoDelegate. |
- (int)enableMixVideoExtraInfo:(BOOL)enable;
Enable/disable video mixing with SEI. For example: video mixing with layout information.
When enabled, callback of onRecvMixVideoInfo can be received when the mixed video stream is played at the audience end.
Parameter | Description |
---|---|
enable | Whether to enable video mixing with SEI. YES: enable NO: disable |
- (BOOL)startAudioSaver:(NSString* _Nonnull)fileName saverMode:(ThunderSaverMode)saverMode fileMode:(ThunderFileMode)fileMode
Start saving audio data as files in AAC format.
Parameter | Description |
---|---|
fileName | File saving path, which must be a full path with the file name and postfix .aac. |
saverMode | Audio saving mode. See details in ThunderSaverMode. |
fileMode | Audio file writing mode. See details in ThunderFileMode. |
- (BOOL)stopAudioSaver
Stop saving audio files in acc format.
-(void)setSoundEffect:(NSInteger)mode
Set the audio effect mode.
Parameter | Description |
---|---|
mode | Audio saving mode THUNDER_SOUND_EFFECT_MODE_NONE(0):Disable mode THUNDER_SOUND_EFFECT_MODE_VALLEY(1): VALLEY mode THUNDER_SOUND_EFFECT_MODE_RANDB(2):R&B mode THUNDER_SOUND_EFFECT_MODE_KTV(3):KTV mode THUNDER_SOUND_EFFECT_MODE_CHARMING(4):CHARMING mode THUNDER_SOUND_EFFECT_MODE_POP(5): Pop mode THUNDER_SOUND_EFFECT_MODE_HIPHOP(6): Hiphop mode THUNDER_SOUND_EFFECT_MODE_ROCK(7): Rock mode THUNDER_SOUND_EFFECT_MODE_CONCERT(8): Concert mode THUNDER_SOUND_EFFECT_MODE_STUDIO(9): Studio mode |
- (void)setVoiceChanger:(int32_t)mode;
Set the voice change mode.
Parameter | Description |
---|---|
mode | Audio saving mode THUNDER_SOUND_EFFECT_MODE_NONE(0):Disable mode THUNDER_SOUND_EFFECT_MODE_VALLEY(1): VALLEY mode THUNDER_SOUND_EFFECT_MODE_RANDB(2):R&B mode THUNDER_SOUND_EFFECT_MODE_KTV(3):KTV mode THUNDER_SOUND_EFFECT_MODE_CHARMING(4):CHARMING mode THUNDER_SOUND_EFFECT_MODE_POP(5): Pop mode THUNDER_SOUND_EFFECT_MODE_HIPHOP(6): Hiphop mode THUNDER_SOUND_EFFECT_MODE_ROCK(7): Rock mode THUNDER_SOUND_EFFECT_MODE_CONCERT(8): Concert mode THUNDER_SOUND_EFFECT_MODE_STUDIO(9): Studio mode |
- (int)setRecordingAudioFrameParameters:(NSInteger)sampleRate
channel:(NSInteger)channel
mode:(ThunderAudioRawFrameOperationMode)mode
samplesPerCall:(NSInteger)samplesPerCall;
Set recorded audio format.
Parameter | Description |
---|---|
sampleRate | Sampling rate |
channel | Audio channel; 1: single channel; 2: dual channel |
mode | See details in ThunderAudioRawFrameOperationMode for use mode of onRecordAudioFrame. |
samplesPerCall | Specify sampling number of data returned in onRecordAudioFrame. For example, usually the sampling number in applications of transcoding stream pushing is 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01 (s). |
- (int)setPlaybackAudioFrameParameters:(NSInteger)sampleRate
channel:(NSInteger)channel
mode:(ThunderAudioRawFrameOperationMode)mode
samplesPerCall:(NSInteger)samplesPerCall;
Set played audio format.
Parameter | Description |
---|---|
sampleRate | Sampling rate |
channel | Audio channel; 1: single channel; 2: dual channel |
mode | See details in ThunderAudioRawFrameOperationMode, for use mode of onRecordAudioFrame. |
samplesPerCall | Specify sampling number of data returned in onRecordAudioFrame, For example, usually the sampling number in applications of transcoding stream pushing is 1024. samplesPerCall = (int)(sampleRate × sampleInterval), in which: sampleInterval ≥ 0.01 (s). |
- (int)enableCustomAudioSource:(NSUInteger)sampleRate channelsPerFrame:(NSUInteger)channelsPerFrame;
Set external audio capture parameters.
Notes:
- Call this API before audio publishing.
Parameter | Description |
---|---|
sampleRate | The external audio source sampling rate can be 8000, 16000, 32000, 44100 or 48000 |
channelsPerFrame | Number of external audio source channels (supports two at most) |
- (int)disableCustomAudioSource;
Disable external audio sampling parameters.
Notes:
- Call this API after disabling audio publishing.
- (BOOL)pushCustomAudioRawData:(void *_Nonnull)data samples:(NSUInteger)samples timestamp:(NSTimeInterval)timestamp;
Push external audio stream.
Parameter | Description |
---|---|
Date | External audio data |
samples | The number of samples of corresponding audio data |
timeStamp | Timestamps of external audio data are used to synchronize external video sources |
- (BOOL)pushCustomAudioSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;
Push external audio frames.
Parameter | Description |
---|---|
sampleBuffer | External audio frame |
- (int)enableVoicePosition:(BOOL)enabled;
Enable/disable remote user voice stereo.
Notes:
- Make sure to call this API before calling joinRoom.
Parameter | Description |
---|---|
enabled | YES: enable NO: disable |
- (int)setRemoteUidVoicePosition(nonnull NSString*)uid azimuth:(NSInteger)azimuth gain:(NSInteger)gain
Set the sound position and volume of a remote user.
Parameter | Description |
---|---|
uid | Remote user ID |
azimuth | Set vocal positions of a remote user, with a value range of [-90,90]. 0: (default) voice comes from directly ahead. -90: voice comes from the left. 90: voice comes from the right |
gain | Set vocal volume of a remote user, with a value range of [0,100]. The default value is 100.0, indicating a user's original volume. The smaller the value, the lower the volume |
- (ThunderVideoEncodeParam* _Nonnull) getVideoEncoderParam:(ThunderVideoEncoderConfiguration* _Nonnull)config
Get video encoding paraenmeters.
Parameter | Description |
---|---|
config | Encoding configuration, see details in ThunderVideoEncoderConfiguration. |
- (ThunderConnectionStatus)getConnectionStatus
Search for network connection status.
- (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 | Description |
---|---|
pitch | Voice pitch, range: [-12,12]; default value: 0 |
- (int)enableHowlingDetector:(BOOL)enabled;
Whether to enable howling detection.
Note:
This API should be calledafter initialization and reset by calling destroyEngine. The detection results will be reported via the callback onHowlingDetectResult.
Parameter | Description |
---|---|
enabled | Whether to enable howling detection: "true"-enable, "false"-disable (default) |
- (int)enableEchoDetector:(BOOL)enabled;
Enable/disable echo detection.
Note:
This API should be called after initialization and reset by calling destroyEngine. The detection results will be reported via the callback onEchoDetectResult.
Parameter | Description |
---|---|
enabled | Whether to enable echo detection: "true"-enable, "false"(default)-disable |
- (BOOL)isCameraManualFocusPositionSupported;
Whether the camera supports manual focus.
Note:
- Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
- (BOOL)isCameraManualExposurePositionSupported;
Whether the camera supports manual exposure.
Note:
- Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
- (CGFloat)setCameraZoomFactor:(CGFloat)zoomFactor;
Set camera zoom scale.
Note:
-Return the maximum zoom value if the zoomFactor exceeds the maximum value. -Return the minimum zoom value if the zoomFactor is smaller than the minimum value.
- Default to check whether the front camera supports this function, if you need to check the rear camera, first call switchFrontCamera to swith cameras.
- After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
Parameter | Description |
---|---|
zoomFactor | Zoom scale |
- (int)setCameraFocusPosition:(CGPoint)position;
Set camera focus position.
Note:
- After this API is called, onCameraExposureAreaChanged will be triggered.
- Default to set the front camera, if you need to set the rear camera, first call switchFrontCamera to swith cameras.
- After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
- When significant changes in the main area of the video are detected, the focus and exposure are automatically adjusted.
Parameter | Description |
---|---|
position | Focus position, range: (0,0) to (1,1), default:(0.5,0.5) |
- (int)setCameraExposurePosition:(CGPoint)position;
Set camera exposure position.
Note:
- After this API is called, onCameraExposureAreaChanged will be triggered.
- Default to set the front camera, if you need to set the rear camera, first call switchFrontCamera to swith cameras.
- After the camera is switched by calling switchFrontCamera, you should to set the exposure position again.
- When significant changes in the main area of the video are detected, the focus and exposure are automatically adjusted.
Parameter | Description |
---|---|
position | Exposure position, range: (0,0) to (1,1), default:(0.5,0.5) |
- (int)setMixedAudioFrameParameters:(NSInteger)sampleRate
channel:(NSInteger)channel
samplesPerCall:(NSInteger)samplesPerCall;
Set the audio data mixed with the captured data and the playback data.
Parameter | Description |
---|---|
sampleRate | Sample rate |
channel | Audio channels; 1-Mono, 2-Stereo |
samplesPerCall | Sample rate, SamplesPerCall = (int)(SampleRate × sampleInterval), sample ≥ 0.01, unit: seconds |
- (void)consumePixelBuffer:(CVPixelBufferRef _Nonnull)pixelBuffer
withTimestamp:(CMTime)timestamp
rotation:(ThunderVideoRotation)rotation;
API for pushing video frame.
Parameter | Description |
---|---|
pixelBuffer | Raw video data (a frame) |
timestamp | The current frame displays the system time (ms). The developer must set a timestamp for each video frame. |
rotation | See details in ThunderVideoRotation for clockwise rotation angle of the video. |
- (void)consumeRawData:(void *_Nonnull)rawData
withTimestamp:(CMTime)timestamp
format:(ThunderVideoPixelFormat)format
size:(CGSize)size
rotation:(ThunderVideoRotation)rotation;
API for pushing raw video data.
Parameter | Description |
---|---|
rawData | Raw video data (a frame) |
timestamp | The current frame displays the system time (ms). The developer must set a timestamp for each video frame. |
format | Image format |
size | See details in CGSize for raw video data size. |
rotation | See details in ThunderVideoRotation for clockwise rotation angle of the video. |
- (void)consumeCMSampleBuffer:(CMSampleBufferRef _Nonnull)sampleBuffer;
API for pushing raw video data.
Parameter | Description |
---|---|
sampleBuffer | Raw video data (a frame) |
- (void)setPlayerDelegate:(nullable id<ThunderAudioFilePlayerDelegate>)delegate;
Set event callback of audio output.
Parameter | Description |
---|---|
delegate | See details in ThunderAudioFilePlayerDelegate for event callback. |
- (void)open:(nonnull NSString*)path;
Open an audio file (supports mp3, aac, wav).
Parameter | Description |
---|---|
path | File path |
- (void)close;
Close an audio file.
- (void)play;
Start playing.
- (void)stop;
Stop playing.
- (void)pause;
Pause.
- (void)resume;
Resume.
- (void)seek:(uint32_t)timeMS;
Skip to play from specified time.
Parameter | Description |
---|---|
timeMS | Playing time |
- (uint32_t)getTotalPlayTimeMS;
Skip to play from specified time.
Notes:
- Return the total playing duration (ms).
- (uint32_t)getCurrentPlayTimeMS;
Get current elapsed play time. Return the duration played (ms).
- (void)setPlayVolume:(uint32_t)volume;
Set volume of the file being played.
Parameter | Description |
---|---|
volume | Playing volume [0-400] |
- (int)setPlayerLocalVolume:(uint32_t)volume;
Adjust local volume for mixed audio file's music.
Notes:
- Call this API while in channels.
Parameter | Description |
---|---|
volume | Playing volume [0-100] |
- (int)setPlayerPublishVolume:(uint32_t)volume;
Adjust remote volume for mixed audio file's music.
Notes:
- Call this API while in channels.
Parameter | Description |
---|---|
volume | Playing volume [0-100] |
- (int)getPlayerLocalVolume;
Get music files' local volume.
- (int)getPlayerPublishVolume;
Get music files' remote volume.
- (void)setSemitone:(int)val;
Set audio tone.
Parameter | Description |
---|---|
val | Volume -5, -4, -3, -2, -1, 0(normal), 1, 2, 3, 4, 5 |
- (int)setLooping:(int)cycle;
Set loop playback timing.
Parameter | Description |
---|---|
cycle | Positive integer: loop count 0: loop canceled -1: infinite loop |
- (int)selectAudioTrack:(int)trackIndex;
Select audio track.
Parameter | Description |
---|---|
trackIndex | Audio track index |
- (void) setTempo:(float)val
Set audio playback speed.
Parameters | Description |
---|---|
val | Playback speed: 0.5 f, 0.75 f, 1.0 f, 1.25 f, 1.5 f, 2.0 f |
- (void) setPosition:(int)azimuth
Set audio playback direction.
Parameters | Description |
---|---|
azimuth | Playback direction: -90~90 |
-(int)getAudioTrackCount;
Get the number of audio tracks. Return the number of file audio tracks.
Notes:
- Call this API after receiving the file open success callback AUDIO_PLAY_EVENT_OPEN of onAudioFileStateChange.
- (void)enablePublish:(BOOL)enable;
Whether to use a currently played file as a live accompaniment.
Parameter | Description |
---|---|
enable | Enable or disable, disable by default |
- (void)enableSpectrum:(BOOL)enable;
Whether to enable the spectrum.
Parameter | Description |
---|---|
enable | YES: enable NO: disable |
(default) |
- (void)enableVolumeIndication:(BOOL)enable interval:(int)interval;
Whether to enable the volume callback.
Parameter | Description |
---|---|
enable | YES: enable NO: disable |
interval | Callback interval |
-(void)setMixStandard:(BOOL)standard;
Whether to set the accompaniment as a standard stream for video mixing.
Parameter | Description |
---|---|
standard | YES: standard stream NO: non-standard stream (default) |
-(BOOL)isMixStandard;
Query whether the accompaniment is a mixed video standard stream.
-(int)getCurrentSpectrum:(float* _Nonnull)buffer len:(int)len;
Get spectrum information.
Notes:
- Return the effective data length, ranging from [0 to 1].
Parameter | Description |
---|---|
buffer | Spectrum buffer |
len | Length of spectrum buffer |
static bool registerAudioFrameObserver(IAudioFrameObserver* observer);
Register an audio frame observer.
Parameter | Type | Description |
---|---|---|
observer | IN | Audio observer object |
typedef NS_ENUM(NSInteger, ThunderVideoRenderMode);
Video rendering mode
Enumeration Value | Description |
---|---|
THUNDER_RENDER_MODE_FILL(0) | Fill the window. If the dimensions do not fit, they will be stretched to fill the window |
THUNDER_RENDER_MODE_ASPECT_FIT(1) | Adapt to the window. If the dimensions do not fit, a black edge will fill the gap |
THUNDER_RENDER_MODE_CLIP_TO_BOUNDS(2) | Fill the window. If the dimensions do not fit, they will be clipped |
typedef NS_ENUM(NSInteger, ThunderRtcRoomConfig);
Set room profiles
Enumeration Value | Description |
---|---|
THUNDER_ROOM_CONFIG_LIVE(0) | Live streaming (high audio quality, without interaction mode) (switched to medium audio quality in case of co-hosting with strong interaction mode) |
THUNDER_ROOM_CONFIG_COMMUNICATION(1) | Communication (medium audio quality with strong interaction mode) |
THUNDER_ROOM_CONFIG_GAME(3) | Game (low audio quality with strong interaction mode) |
THUNDER_ROOM_CONFIG_MULTIAUDIOROOM(4) | Multi-person voice chatroom (medium audio quality, conserving traffic with strong interaction mode) |
THUNDER_ROOM_CONFIG_CONFERENCE(5) | Conference (medium audio quality with strong interaction mode, applicable to enabling/disabling microphones frequently without freezing) |
typedef NS_ENUM(NSInteger, ThunderRtcLogLevel);
Set log level
Enumeration Value | Description |
---|---|
THUNDER_LOG_LEVEL_TRACE(0) | //TRACE |
THUNDER_LOG_LEVEL_DEBUG(1) | //DEBUG |
THUNDER_LOG_LEVEL_INFO(2) | //INFO |
THUNDER_LOG_LEVEL_WARN(3) | //WARN |
THUNDER_LOG_LEVEL_ERROR(4) | //ERROR |
@API LiveTranscoding : NSObject
@property(nonatomic, strong)NSString *mAudioUrl;
@property(nonatomic, strong)NSString *mLyricUrl;
@property(nonatomic, strong)NSString *mMediaUrl;
@property(nonatomic, strong)MediaStreamLayoutObj* mMediaStreamLayout;
/**
@brief Add a user to the mixed video layout
@param [IN] user TranscodingUser
@return 0 success
*/
- (int)addUser:(TranscodingUserObj*)user;
/**
@brief Set user mixed video layout in batches
In this method, the user sets all users participating in the combined picture. This method replaces the raw data with new user data.
@param [IN] users All mixed video users in channel
*/
- (void)setUsers:(NSMutableArray*)users;
/**
@brief Get current user location information
@return Get information of all users in mixed video canvas in channel
*/
- (NSMutableArray*)getUsers;
/**
@brief Remove users joining video mixing
@param [IN] uid User ID to be removed
@return 0 success
*/
- (int)removeUserWithUid:(NSString*)uid;
/**
@brief Remove the mixed video of this channel. That is, the user will not use the mixed video
@return 0 success
*/
- (int)removeAllUsers;
/**
@brief Get the number of users joining video mixing
@return Number of users
*/
- (int)getUserCount;
/**
@brief Set the bracket of mixed video outputted
@param [IN] transCodingMode mode
*/
- (void)setTransCodingMode:(ThunderTranscodingModeType)transCodingMode;
/**
@brief Get the bracket of mixed video outputted
@return mode
*/
- (ThunderTranscodingModeType)getTransCodingMode;
/**
@brief Whether to open the mixed video with SEI
@return true open, false close
*/
- (BOOL)isEnableMixVideoExtraInfo;
/**
@brief Set the external pure audio URL as the standard stream for this mixed video. Because the progress of the standard stream playback is required internally for synchronization of mixed video, it cannot be used simultaneously through the API setMediaStandardSream.
So, the client should use ThunderAudioFilePlayer to play this audio and call setMixStandard in ThunderAudioFilePlayer to set the standard stream.
If the user wants to use customized style lyrics in the mixed video, the anchor can use the sendMediaExtraInfo API to send the lyrics progress, and call setAudioOnlyStandardSreamUrl to set the lyricUrl parameter to null,
The audience will receive the onRecvMediaExtraInfo callback of IThunderMediaExtraInfoCallback when playing this mixed video stream, and read out the corresponding lyrics progress, and draw the lyrics according to the progress.
@param [IN] audioUrl Standard video file URL
@param [IN] lyricUrl URL of the lyrics file corresponding to the audio. The blank indicates no lyrics, otherwise the lyrics will be added to the mixed video in the default style.
@return 0 success, <0 failure
*/
- (int)setAudioOnlyStandardSreamUrl:(NSString*)audioUrl lyricUrl:(NSString*)lyricUrl;
/**
@brief The external video media stream is set as the standard stream for mixed video, which cannot be used through API setAudioOnlyStandardSreamUrl simultaneously.
@param [IN] mediaUrl Standard video file url
@param [IN] layout Layout information of video media stream in the mixed video.
@return 0 success, <0 failure
*/
- (int)setMediaStandardSream:(NSString*) mediaUrl layout:(MediaStreamLayoutObj*) layout;
- (NSString*)description;
@end
typedef NS_ENUM(NSInteger, ThunderVideoRotation);
Video rotation angle.
Enumeration Value | Description |
---|---|
THUNDER_VIDEO_ROTAION_NONE(0) | Rotate 0 degree clockwise |
THUNDER_VIDEO_ROTAION_90(1) | Rotate 90 degrees clockwise |
THUNDER_VIDEO_ROTAION_180(2) | Rotate 180 degrees clockwise |
THUNDER_VIDEO_ROTAION_270(3) | Rotate 270 degrees clockwise |
typedef NS_ENUM(NSInteger, ThunderRtcRemotePlayType);
Mode of remote video displayed locally with a singular view for one person or multiple
Enumeration Value | Description |
---|---|
THUNDER_REMOTE_PLAY_NORMAL(0) | Common audience view |
THUNDER_REMOTE_PLAY_MULTI(1) | Multi-person co-hosting view |
__attribute__((visibility("default"))) @API ThunderMultiVideoViewParam: NSObject
@property(strong, nonatomic)NSArray<ThunderMultiVideoViewCoordinate*>* _Nonnull videoPositions;
@property(strong, nonatomic)ThunderMultiVideoViewCoordinate* _Nullable bgCoordinate;
@property(copy, nonatomic)NSString* _Nullable bgImageName;
@end
Parameter | Description |
---|---|
videoPositions | See details in ThunderMultiVideoViewCoordinate for video view layout parameters. |
bgCoordinate | See details in ThunderMultiVideoViewCoordinate for video view background layout parameters. |
bgImageName | Video view background picture |
__attribute__((visibility("default"))) @API ThunderMultiVideoViewCoordinate: NSObject
@property(assign, nonatomic)int x;
@property(assign, nonatomic)int y;
@property(assign, nonatomic)int width;
@property(assign, nonatomic)int height;
@property(assign, nonatomic)int index;
@end
Layout of multi-person co-hosting setting
Parameter | Description |
---|---|
x | X-coordinate at the upper left corner in the layout for a single video view |
y | Y-coordinate at the upper left corner in the layout for a single video view |
width | Width of the layout for a single video view |
height | Height of the layout for a single video view |
index | Seat numbers in the layout for a single video view, start from 0 |
__attribute__((visibility("default"))) @API ThunderVideoCanvas : NSObject
@property(strong, nonatomic) UIView* _Nullable view;
@property(assign, nonatomic) ThunderVideoRenderMode renderMode;
@property(copy, nonatomic) NSString* _Nullable uid;
@property(assign, nonatomic)int seatIndex;
@end
Parameter | Description |
---|---|
view | UIView |
renderMode | See details in ThunderVideoRenderMode. |
uid | User ID |
seatIndex | Set the window position of a user during multi-person co-hosting |
typedef NS_ENUM(NSInteger, ThunderAudioRawFrameOperationMode );
Raw audio data mode
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_ONLY(1) | Read-only mode. The user only gets data from AudioFrame |
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_WRITE_ONLY(2) | Write-only mode. The user replaces data in AudioFrame for encoding transmission of SDK |
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_WRITE(3) | Read/write mode. The user obtains and modifies data from AudioFrame, then returns it to SDK for encoding and transmission. |
typedef NS_ENUM(NSInteger, ThunderVideoMirrorMode);
Mirroring
Enumeration Value | Description |
---|---|
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_MIRROR_PUBLISH_NO_MIRROR(0) | Preview is mirrored, but stream pushing is not mirrored |
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_MIRROR(1) | Both preview and stream pushing are mirrored |
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_PUBLISH_BOTH_NO_MIRROR(2) | Neither preview nor stream pushing is mirrored |
THUNDER_VIDEO_MIRROR_MODE_PREVIEW_NO_MIRROR_PUBLISH_MIRROR(3) | Preview is not mirrored, but publishing is mirrored |
typedef NS_ENUM(NSInteger, ThunderRtcAudioConfig);
Audio Profiles
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_CONFIG_DEFAULT(0) | Default settings. 1 in communication mode, and 2 in live streaming mode |
THUNDER_AUDIO_CONFIG_SPEECH_STANDARD(1) | Specify a 16 KHz sampling rate, audio encoding, single channel, and an encoding bit rate of about 18 kbps |
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD_STEREO(2) | Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 24 kbps. High encoding delay |
THUNDER_AUDIO_CONFIG_MUSIC_STANDARD(3) | Specify a 44.1 kHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 40 kbps. Low encoding delay |
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO(4) | Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 128 kbps |
THUNDER_AUDIO_CONFIG_MUSIC_HIGH_QUALITY_STEREO_192(5) | Specify a 44.1 KHz sampling rate, music encoding, dual channel, and an encoding bit rate of about 192 kbps |
typedef NS_ENUM(NSInteger, ThunderRtcCommutMode);
Interaction Mode
Enumeration Value | Description |
---|---|
THUNDER_COMMUT_MODE_DEFAULT(0) | =1 by default |
THUNDER_COMMUT_MODE_HIGH(1) | Strong interaction mode |
THUNDER_COMMUT_MODE_LOW(1) | Weak interaction mode |
typedef NS_ENUM(NSInteger, ThunderRtcScenarioMode);
Scenario mode
Enumeration Value | Description |
---|---|
THUNDER_SCENARIO_MODE_DEFAULT(0) | =1 by default |
THUNDER_SCENARIO_MODE_STABLE_FIRST(1) | Smoothness priority: stable, recommended for education |
THUNDER_SCENARIO_MODE_QUALITY_FIRST(2) | Smoothness priority: stable, recommended for education |
typedef float ThunderEqGainsOc[11];
Equalizer parameter, -12 <= gains[i] <= 12, in which the range of i is 0<= i <=10
struct ThunderReverbExParamOc;
Reverberation parameters
Parameter | Type | Value |
---|---|---|
mRoomSize | double | 0~100 |
mPreDelay | double | 0~200 |
mReverberance | double | 0~100 |
mHfDamping | double | 0~100 |
mToneLow | double | 0~100 |
mToneHigh | double | 0~100 |
mWetGain | double | -20~10 |
mDryGain | double | -20~10 |
mStereoWidth | double | 0~100 |
typedef struct CG_BOXABLE ThunderCprParamOc ThunderCprParamOc;
Compressor parameters
Parameter | Type | Value |
---|---|---|
threshold | int | Threshold; range: [-40~0] |
makeupGain | int | Gain |
ratio | int | Scale |
knee | int | Slope |
releaseTime | int | Release time; range: Over 0 |
attackTime | int | Launch time; range: Over 0 |
struct ThunderLimiterParamOc;
typedef struct CG_BOXABLE ThunderLimiterParamOc ThunderLimiterParamOc;
Parameter | Type | Value |
---|---|---|
fCeiling | float | (-30 ~ 0) |
fThreshold | float | (-10 ~ 0) |
fPreGain | float | (0~30) |
fRelease | float | (0~1000) |
fAttack | float | (0~1000) |
fLookahead | float | (0~8) |
fLookaheadRatio | float | (0.5~2) |
fRMS | float | (0~100) |
fStLink | float | (0~1) |
typedef NS_ENUM(NSInteger, ThunderSourceType);
Audio publishing mode
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_MIC(0) | Microphone-only |
THUNDER_AUDIO_FILE(1) | File-only |
THUNDER_AUDIO_MIX(2) | Microphone and file |
THUNDER_SOURCE_TYPE_NONE(10) | Stop all uplink audio data |
typedef NS_ENUM(NSInteger, ThunderSaverMode);
Save mode.
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_SAVER_ONLY_CAPTURE(0) | Only save uplink audio data in the room.Uplink audio data: only audio data set as uplink of both the anchor and accompaniment can be saved |
THUNDER_AUDIO_SAVER_ONLY_RENDER(1) | Save audio data excluding that of the anchor in the room, e.g. audio data of the accompaniment and audience |
THUNDER_AUDIO_SAVER_BOTH(2) | Save all audio data in the room |
typedef NS_ENUM(NSInteger, ThunderFileMode);
Writing data mode
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_SAVER_FILE_APPEND(0) | Open a text file, and written data will overlap its original content |
THUNDER_AUDIO_SAVER_FILE_OVERRIDE(1) | Open another text file and write data at the end of the file |
typedef NS_ENUM(NSInteger, ThunderAudioRawFrameOperationMode );
Writing data mode
Enumeration Value | Description |
---|---|
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_ONLY(1) | Read-only mode. The user only gets data from AudioFrame |
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_WRITE_ONLY(2) | Open another text file and write data at the end of the file |
THUNDER_AUDIO_RAW_FRAME_OPERATION_MODE_READ_WRITE(3) | Read/write mode, write-only mode. Users replace data in AudioFrame for encoding and transmission of SDK |
struct CGSize {
CGFloat width;
CGFloat height;
};
Field | Description |
---|---|
width | Width |
height | Height |
struct IAudioFrameObserver::AudioFrame;
Details of audio data
Parameter | Description |
---|---|
type | Audio frame type. See details in AUDIO_FRAME_TYPE. |
samples | Number of samples in this frame |
bytesPerSample | Bytes per sample: PCM (16 digits), including two bytes |
channels | The number of channels (data are interleaved if stereo); 1: single channel, 2: dual channel |
samplesPerSec | Sampling rate |
buffer | data buffer |
renderTimeMs | Not used |
avsync_type | Not used |
@API TranscodingUserObj : NSObject
@property(copy, nonatomic) NSString* uid; // Anchor ID
@property(copy, nonatomic) NSString* roomId; // Anchor's current publish room
@property(assign, nonatomic) BOOL bStandard; // Standard stream user or not, default to false, competition stream is generally regarded as standard stream in a competition scenario
@property(assign, nonatomic) int layoutX; // User's x coordinate of the begin point in video mixing canvas
@property(assign, nonatomic) int layoutY; // User's y coordinate of the begin point in video mixing canvas
@property(assign, nonatomic) int layoutW; // User's width in video mixing canvas
@property(assign, nonatomic) int layoutH; // User's height in video mixing canvas
@property(assign, nonatomic) int zOrder; // Layer number of user frame on the live video.
// The value range is the integer in [0, 100], and the minimum value is 0 (default value), indicating that the image in this region is at the lowest level
@property(assign, nonatomic) BOOL bCrop; // The way in which the source stream adapts to the video mixing window
// true: clipping extra parts after zooming; false: mend black edge after zooming; this is applied to the clipping region if such a region is set.
@property(assign, nonatomic) int cropX; // X-coordinate of the begin point in the clipping region of current anchor's source video
@property(assign, nonatomic) int cropY; // Y-coordinate of the begin point in the clipping region of current anchor's source video
@property(assign, nonatomic) int cropW; // Width of the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropH; // Height of the clipping region of current anchor’s source video
@property(assign, nonatomic) float alpha; // Transparency of user video on the live video. The value range is [0.0, 1.0].
// 0.0 indicates that the image in this region is completely transparent, while 1.0 indicates completely opaque. The default is 1.0
@property(assign, nonatomic) int audioChannel; // Not yet realized
- (NSString*)description;
- (BOOL)isEqual:(id)obj;
@end
typedef NS_ENUM(NSInteger, ThunderTranscodingModeType);
Video mixing bracket
Enumeration Value | Description |
---|---|
TRANSCODING_MODE_NON(0) | //Retain bracket |
TRANSCODING_MODE_320X180(1) | "encode":100,"bitrate": 150, "fps": 15, "gop": 30, "width": 320, "height": 180 |
TRANSCODING_MODE_320X240(2) | "encode": 100,"bitrate": 200, "fps": 15, "gop": 30, "width": 320, "height": 240 |
TRANSCODING_MODE_640X360(3) | "encode": 100,"bitrate": 500, "fps": 15, "gop": 30, "width": 640, "height": 360 |
TRANSCODING_MODE_640X480(4) | "encode": 100,"bitrate": 500, "fps": 15, "gop": 30, "width": 640, "height": 480 |
TRANSCODING_MODE_960X544(5) | "encode": 100,"bitrate": 1000, "fps": 24, "gop": 48, "width": 960, "height": 544 |
TRANSCODING_MODE_1280X720(6) | "encode": 100,"bitrate": 1600, "fps": 24, "gop": 48, "width": 1280, "height": 720 |
TRANSCODING_MODE_1920X1080(7) | "encode": 100,"bitrate": 4500, "fps": 24, "gop": 48, "width": 1920, "height": 1080 |
@API MediaStreamLayoutObj : NSObject
@property(assign, nonatomic) int layoutX; // X-coordinate of begin point of the media in video mixing canvas
@property(assign, nonatomic) int layoutY; // Y-coordinate of begin point of the media in video mixing canvas
@property(assign, nonatomic) int layoutW; // Width of the media in video mixing canvas
@property(assign, nonatomic) int layoutH; // Height of the media in video mixing canvas
@property(assign, nonatomic) int zOrder; // Layer number of the media video frame on the live video. The value range is the integer in [0, 100],
// and the minimum value is 0 (default value), indicating that the image in this region is at the lowest level
@property(assign, nonatomic) BOOL bCrop; // The way in which the source stream adapts to the video mixing window, true: crop extra parts after zooming;
// false: mend black edge after zooming; this is applied to the clipping region if such a region is set.
@property(assign, nonatomic) int cropX; // X-coordinate of the begin point in the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropY; // Y-coordinate of the begin point in the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropW; // Width of the clipping region of current anchor’s source video
@property(assign, nonatomic) int cropH; // Height of the clipping region of current anchor’s source video
@property(assign, nonatomic) float alpha; // Transparency of media video on the live video. The value range is [0.0, 1.0].
// 0.0 indicates that the image in this region is completely transparent, while 1.0 indicates completely opaque. The default is 1.0
@property(assign, nonatomic) int audioChannel; // Unrealized
- (NSString*)description;
- (BOOL)isEqual:(id)obj;
@end
__attribute__((visibility("default"))) @API ThunderVideoEncoderConfiguration : NSObject
@property(assign, nonatomic) ThunderPublishPlayType playType;
@property(assign, nonatomic) int publishMode;
@end
Video publishing profile
Parameter | Description |
---|---|
playType | See details in ThunderPublishPlayType for publishing methods. |
publishMode | See details in ThunderPublishVideoMode for video encoding types. |
__attribute__((visibility("default"))) @API ThunderVideoEncodeParam : NSObject
@property(assign, nonatomic) NSUInteger width; // width
@property(assign, nonatomic) NSUInteger height; // height
@property(assign, nonatomic) NSUInteger frameRate; // frame rate
@property(assign, nonatomic) NSUInteger codeRate; // bit rate
@end
typedef enum ThunderPublishPlayType;
Publish play type
Enumeration Value | Description |
---|---|
THUNDERPUBLISH_PLAY_SINGLE(0) | Single publishing |
THUNDERPUBLISH_PLAY_INTERACT(1) | Co-hosting video publishing |
THUNDERPUBLISH_PLAY_SCREENCAP(2) | Screen recording publishing |
THUNDERPUBLISH_PLAY_MULTI_INTERACT(3) | Multi-person co-hosting publishing |
typedef enum ThunderPublishVideoMode;
Video encoding types
Enumeration Value | Description | Resolution(Width*Height) | Encoding Rate | Frame Rate |
---|---|---|---|---|
THUNDERPUBLISH_VIDEO_MODE_NORMAL(1) | Ordinary | 320 x 240 (landscape) | 200 kbps | 15 fps |
THUNDERPUBLISH_VIDEO_MODE_HIGHQULITY(2) | High definition | 368 x 640 (portrait) | 500 kbps | 15 fps |
THUNDERPUBLISH_VIDEO_MODE_SUPERQULITY(3) | Ultra high-definition | 544 x 960 (portrait) | 1000 kbps | 24 fps |
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_2M(4) | Blue ray 2M | 720 x 1280 (portrait) | 1500 kbps | 24 fps |
THUNDERPUBLISH_VIDEO_MODE_BLUERAY_4M(5) | Blue ray 4M | 1080 x 1920 (portrait) | 3000 kbps | 24 fps |
typedef NS_ENUM(NSInteger, ThunderRtcAreaType);
Geographic area
Enumeration Value | Description |
---|---|
THUNDER_AREA_DEFAULT(0) | Default (domestic) |
THUNDER_AREA_FOREIGN(1) | Overseas |
typedef NS_ENUM(NSInteger, ThunderVideoCaptureOrientation);
Portrait and landscape
Enumeration Value | Description |
---|---|
THUNDER_VIDEO_CAPTURE_ORIENTATION_PORTRAIT(0) | Portrait |
THUNDER_VIDEO_CAPTURE_ORIENTATION_LANDSCAPE(1) | Landscape |
enum AUDIO_FRAME_TYPE;
Audio/video data frame type.
Enumeration Value | Description |
---|---|
FRAME_TYPE_PCM16(0) | PCM 16 bit little endian |