- (V2TXLiveCode) enableCustomAudioCapture: | (BOOL) | enable |
Turn on/off custom audio capture.
In the custom audio capture mode, the SDK no longer collects sound from the microphone, and only retains the encoding and sending capabilities.
Turn on/off custom audio capture.
enable | YES: Open custom capture; NO: Close custom capture.**Default value**: NO |
V2TXLIVE_OK
: successful - (V2TXLiveCode) enableCustomVideoCapture: | (BOOL) | enable |
Enables or disables custom video capture.
In the custom video capture mode, the SDK no longer captures images from cameras. Only the encoding and sending capabilities are retained.
enable | YES : enable custom video capture; NO (default): disable custom video capture |
- (V2TXLiveCode) enableCustomVideoProcess: | (BOOL) | enable | |
pixelFormat: | (V2TXLivePixelFormat) | pixelFormat | |
bufferType: | (V2TXLiveBufferType) | bufferType | |
Enables or disables custom video processing.
enable | YES : enable; NO : disable (default) |
pixelFormat | Pixel format of callbacks. Note: only V2TXLivePixelFormatTexture2D is supported by RTMP. |
bufferType | Data format of callbacks. Note: only V2TXLiveBufferTypeTexture is supported by RTMP. |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_NOT_SUPPORTED
: unsupported format - (V2TXLiveCode) enableVolumeEvaluation: | (NSUInteger) | intervalMs |
Enables volume update.
After this feature is enabled, you can obtain the volume evaluation through the onMicrophoneVolumeUpdate callback.
intervalMs | Interval for triggering the volume callback. The unit is ms. The minimum interval is 100 ms. If the value is equal to or smaller than 0, the callback is disabled. We recommend that you set this parameter to 300 ms. [Default]: 0. |
- (TXAudioEffectManager *) getAudioEffectManager |
Obtains the audio effect manager TXAudioEffectManager.
With the audio effect manager, you can use the following features:
- (TXBeautyManager *) getBeautyManager |
Obtains the beauty manager TXBeautyManager。
With the beauty manager, you can use the following features:
- (TXDeviceManager *) getDeviceManager |
Obtains the video device manager TXDeviceManager.
With the device manager, you can use the following features:
- (instancetype) initWithLiveMode: | (V2TXLiveMode) | liveMode |
init pusher
liveMode | push protocol type: RTMP/ROOM protocol, default: RTMP |
- (int) isPushing |
Indicates whether the pusher is currently pushing streams.
- (V2TXLiveCode) pauseAudio |
Mute local audio.
After muting the local audio, the SDK will not continue to collect the microphone sound, The difference from stopMicrophone is pauseAudio does not stop sending audio data, instead continue to send silent packets with a very low bit rate. Due to video file formats such as MP4, the continuity of the audio is very demanding. Using stopMicrophone will cause the recorded MP4 to be difficult to play. Therefore, in scenes that require high recording quality, it is recommended to choose pauseAudio to record MP4 files with better compatibility.
- (V2TXLiveCode) pauseVideo |
Pause the video stream of the pusher.
- (V2TXLiveCode) resumeAudio |
Resume the audio stream of the pusher.
- (V2TXLiveCode) resumeVideo |
Resume the video stream of the pusher.
- (V2TXLiveCode) sendCustomAudioFrame: | (V2TXLiveAudioFrame *) | audioFrame |
In the custom audio collection mode, the collected audio data is sent to the SDK. The SDK no longer collects microphone data, and only retains the encoding and sending functions.
In the custom audio collection mode, send the collected audio data to the SDK
audioFrame | Audio frame data sent to SDK V2TXLiveAudioFrame |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_REFUSED
: Sending failed, you must first call enableCustomAudioCapture to start custom audio capture - (V2TXLiveCode) sendCustomVideoFrame: | (V2TXLiveVideoFrame *) | videoFrame |
Sends the collected video data to the SDK in the custom video capture mode.
In the custom video capture mode, the SDK no longer captures images from cameras. Only the encoding and sending capabilities are retained. You can pack collected SampleBuffer packets into V2TXLiveVideoFrame and periodically send them through this API.
videoFrame | Video frames sent to the SDK V2TXLiveVideoFrame |
- (V2TXLiveCode) sendSeiMessage: | (int) | payloadType | |
data: | (NSData *) | data | |
Use SEI channel to send custom message
The player end V2TXLivePlayer can receive the message via onReceiveSeiMessage
callback in V2TXLivePlayerObserver.
payloadType | Payload type. Valid values: 5 , 242 , 242 recommended |
data | Data to be sent |
- (V2TXLiveCode) setAudioQuality: | (V2TXLiveAudioQuality) | quality |
Sets the audio quality for pushing.
quality | Audio quality V2TXLiveAudioQuality
|
- (V2TXLiveCode) setEncoderMirror: | (BOOL) | mirror |
Sets the video encoder mirror.
mirror | Specifies whether the mirrored images are viewed.
|
- (V2TXLiveCode) setMixTranscodingConfig: | (V2TXLiveTranscodingConfig *) | config |
Sets On-Cloud MixTranscoding parameters.
If you have enabled relayed push on the "Function Configuration" page of the TRTC console, then each stream in a room will have a default CDN address.
There may be multiple anchors in a room, each sending their own video and audio, but CDN audience needs only one live stream. Therefore, you need to mix multiple audio/video streams into one standard live stream, which requires mixing and transcoding.
When you call the setMixTranscodingConfig()
API, the SDK will send a command to the Tencent Cloud transcoding server to combine multiple audio/video streams in the room into one stream. You can use the mixUsers
parameter to set the position of each channel of image and specify whether to mix only audio. You can also set the encoding parameters of the mixed stream, including videoWidth
, videoHeight
, and videoBitrate
.
**Image 1** => decoding ====> \ \ **Image 2**=> decoding => image mixing => encoding => **mixed image** / **Image 3** => decoding ====> /
**Audio 1** => decoding ====> \ \ **Audio 2** => decoding => audio mixing => encoding => **mixed audio** / **Audio 3** => decoding ====> /
For more information, please see On-Cloud MixTranscoding.
streamId
specified in config
.nil
to cancel On-Cloud MixTranscoding. The On-Cloud MixTranscoding module starts working the moment you enable On-Cloud MixTranscoding. You may incur additional costs if you do not cancel it in a timely manner.config | Please see the description of V2TXLiveTranscodingConfig in V2TXLiveDef.h . Passing in nil will cancel On-Cloud MixTranscoding. |
V2TXLIVE_OK
: successfulV2TXLIVE_ERROR_REFUSED
: failed to set On-Cloud MixTranscoding parameters as stream pushing has not started - (void) setObserver: | (id< V2TXLivePusherObserver >) | observer |
Sets the pusher callback.
By setting the callback, you can listen to some callback events of V2TXLivePusher, including the pusher status, volume callback, statistics, warnings, and error messages.
observer | Callback target of the pusher. For more information, see V2TXLivePusherObserver |
- (V2TXLiveCode) setProperty: | (NSString *) | key | |
value: | (NSObject *) | value | |
Calls the advanced API of V2TXLivePusher.
key | Key of the advanced API. |
value | Parameter needed to call the advanced API corresponding to the key. |
- (V2TXLiveCode) setRenderMirror: | (V2TXLiveMirrorType) | mirrorType |
Sets the view mirror of the local camera.
Local cameras are divided into the front camera and the rear camera. By default, images from the front camera are mirrored, and images from the rear camera are not mirrored. Here, you can modify the default mirror type of the front or rear camera.
mirrorType | Mirror type of the camera V2TXLiveMirrorType
|
- (V2TXLiveCode) setRenderRotation: | (V2TXLiveRotation) | rotation |
Sets the rotation angle of the view.
rotation | Rotation angle of the view V2TXLiveRotation
|
- (V2TXLiveCode) setRenderView: | (TXView *) | view |
Sets the local camera preview.
Images collected by the local camera will be eventually displayed on the view that is passed in after it is overlaid by multiple effects, such as beauty filters, facial feature adjustments, and filters.
view | Local camera preview. |
- (V2TXLiveCode) setVideoQuality: | (V2TXLiveVideoEncoderParam *) | param |
Set the video encoding parameters for pushing.
param | video encoding parameters V2TXLiveVideoEncoderParam |
- (V2TXLiveCode) setWatermark: | (TXImage *) | image | |
x: | (float) | x | |
y: | (float) | y | |
scale: | (float) | scale | |
Sets the pusher watermark image. By default, the watermark is disabled.
image | Watermark image. If the value is nil, it is equivalent to disabling the watermark. |
x | Display position of the watermark. Valid range: 0 - 1. |
y | Display position of the watermark. Valid range: 0 - 1. |
scale | Scaling ratio of the watermark. Valid range: 0 - 1. |
- (void) showDebugView: | (BOOL) | isShow |
Indicates whether the debug view of the pusher video status information is displayed.
isShow | Specifies whether to display the debug view. [Default]: NO |
- (V2TXLiveCode) snapshot |
Captures the local view in the pushing process.
- (V2TXLiveCode) startCamera: | (BOOL) | frontCamera |
Enables the local camera.
frontCamera | Specifies whether to switch to the front camera.
|
- (V2TXLiveCode) startCamera: | (NSString *) | cameraId |
Enables the local camera.
cameraId | camera id |
- (V2TXLiveCode) startMicrophone |
Enables the local microphone.
- (V2TXLiveCode) startPush: | (NSString *) | url |
Starts pushing the audio and video data.
url | Push URL, which can be any push server. |
- (V2TXLiveCode) startScreenCapture: | (NSString *) | appGroup |
Enables video capturing.
appGroup | The Application Group Identifier shared by the main App and Broadcast can be specified as nil. It is worth noting that the function will be more reliable according to the document guidelines. |
- (V2TXLiveCode) startVirtualCamera: | (TXImage *) | image |
Enables the image streaming.
image | image |
- (V2TXLiveCode) stopCamera |
Disables the local camera.
- (V2TXLiveCode) stopMicrophone |
Disables the microphone.
- (V2TXLiveCode) stopPush |
Stops pushing the audio and video data.
- (V2TXLiveCode) stopScreenCapture |
Disables video capture.
- (V2TXLiveCode) stopVirtualCamera |
Disables the image streaming.