NERtc iOS SDK  V4.4.301
NERtcEngineBase.h
浏览该文件的文档.
1 /*
2  * Copyright (c) 2021 NetEase, Inc. All rights reserved.
3  */
4 
5 #import <Foundation/Foundation.h>
6 #import "NERtcEngineEnum.h"
7 
9 
10 NS_ASSUME_NONNULL_BEGIN
11 
16 // channel
17 extern NSString * const kNERtcKeyChannel1V1ModeEnabled; // BOOL -- Specifies whether to enable 1V1 mode. The default value is NO.
18 
19 // video
20 extern NSString * const kNERtcKeyVideoPreferHWEncode; // BOOL - Specifies whether to prefer using hardware to encode video data. The default value is YES. We recommend that you set this value before you call setupEngineWithContext to initialize the INERtcEngine instance. Otherwise, the setting is applied the next time.
21 extern NSString * const kNERtcKeyVideoPreferHWDecode; // BOOL - Specifies whether to prefer using hardware to decode video data. The default value is YES. We recommend that you set this value before you call setupEngineWithContext to initialize the INERtcEngine instance. Otherwise, the setting is applied the next time.
22 extern NSString * const kNERtcKeyVideoCaptureObserverEnabled; // BOOL - Specifies whether to enable the callback to return captured video data. This enables developers to get the raw video data. You can clear the video data by calling destroyEngine. The default value is NO.
23 extern NSString * const kNERtcKeyVideoStartWithBackCamera; // BOOL - Specifies whether to turn on the rear camera if the camera is enabled for the first time. The default value is NO.
24 extern NSString * const kNERtcKeyVideoPreferMetalRender; // BOOL - Specifies whether to use metal rendering first. Otherwise, OpenGL rendering is applied. The default value is NO.
25 extern NSString * const kNERtcKeyVideoSendOnPubType; // int, the setting is valid before you make a call. The default value is 3, which indicates that a bigstream is published at the beginning.
26 
27 // audio
28 extern NSString * const kNERtcKeyAutoSubscribeAudio; // BOOL - Specifies whether to automatically subscribe to audio streams when other users turn on audio. The setting is applied before you make a call. The setting is invalid If you specify the value during the call. The default value is YES. Note: The key of subscribeRemoteAudio must be set to NO if you use the method to control the audio in your business.
29 extern NSString * const KNERtcKeyDisableOverrideSpeakerOnReceiver; //BOOL -- Specifies whether to disable switching to the speakerphone when the system switches to the earpieces. The default value is NO. If the value is set to YES, the SDK is not allowed to switch to the speakerphone when the system switches to earpieces. Users need to handle the earpieces switching event.
30 extern NSString * const KNERtcKeyEnableReportVolumeWhenMute; //Whether to return original volume when the local user is muted. Boolean value, default: false. true:Return the original volume in `onLocalAudioVolumeIndication`. false:Return the recording volume(0) in `onLocalAudioVolumeIndication`.
31 extern NSString * const KNERtcKeyDisableSWAECOnHeadset; //BOOL - Specifies whether to use echo reduction when the system sets the headset. The default value is NO. If the value is set to YES, the SDK does not use the echo reduction in headset mode. The setting affects the audio quality of the headset in some mobile models.
32 extern NSString * const KNERtcKeyAudioAINSEnable;//BOOL - Specifies whether to enable AI-powered noise reduction. If you enable AI-powered noise reduction, the peer can hear your voice in a noisy environment.
33 
34 
35 // server record
36 extern NSString * const kNERtcKeyRecordHostEnabled; // BOOL - Specifies whether to record the audio of the host in the server. The default value is NO.
37 extern NSString * const kNERtcKeyRecordAudioEnabled; // BOOL - Specifies whether to enable the call server to record audio. The default value is NO
38 extern NSString * const kNERtcKeyRecordVideoEnabled; // BOOL - Specifies whether to enable the call server to record video. The default value is NO
39 extern NSString * const kNERtcKeyRecordType; // int - The server recording mode. For more information, see the definition of NERtcRecordType.
40 
41 // live stream
42 extern NSString * const kNERtcKeyPublishSelfStreamEnabled; // BOOL - Specifies whether to publish the media stream to the room. The default value is NO.
43 
44 // log level
45 extern NSString * const kNERtcKeyLogLevel; // int - The SDK log level. For more information, see the definition of NERtcLogLevel. The default value is kNERtcLogLevelInfo.
46 
47 extern NSString * const kNERtcKeyExtraInfo; //NSString - Identifies the app version that is used for reporting.
48 
52 @interface NERtcVideoCanvas : NSObject
53 
57 @property (nonatomic, assign) BOOL useExternalRender;
58 
62 @property (nonatomic, nullable, strong) VIEW_CLASS *container;
63 
67 @property (nonatomic, assign) NERtcVideoRenderScaleMode renderMode;
68 
74 @property (nonatomic, assign) NERtcVideoMirrorMode mirrorMode;
75 
79 @property (nonatomic, strong) id<NERtcEngineVideoRenderSink> externalVideoRender;
80 @end
81 
85 @interface NERtcBaseVideoEncodeConfiguration : NSObject
86 
90 @property (nonatomic, assign) NERtcVideoProfileType maxProfile;
91 
99 @property (nonatomic, assign) NERtcVideoFrameRate frameRate;
100 
104 @property (nonatomic, assign) NSInteger minFrameRate;
105 
112 @property (nonatomic, assign) NSInteger bitrate;
113 
117 @property (nonatomic, assign) NSInteger minBitrate;
118 
119 @end
120 
125 
135 @property (nonatomic, assign) int width;
145 @property (nonatomic, assign) int height;
146 
150 @property (nonatomic, assign) NERtcVideoCropMode cropMode;
151 
161 @property (nonatomic, assign) NERtcDegradationPreference degradationPreference;
162 
168 @property (nonatomic, assign) NERtcVideoMirrorMode mirrorMode;
169 
175 @property (nonatomic, assign) NERtcVideoOutputOrientationMode orientationMode;
176 
177 
178 @end
179 
184 
188 @property (nonatomic, assign) NERtcSubStreamContentPrefer contentPrefer;
189 
190 @end
191 
192 
193 FOUNDATION_EXPORT uint32_t const NERtcAudioMixingMaxVolume;
194 FOUNDATION_EXPORT uint32_t const NERtcAudioMixingDefaultVolume;
195 
196 
198 @interface NERtcCreateAudioMixingOption : NSObject
199 
205 @property (nonatomic, copy) NSString *path;
206 
213 @property (nonatomic, assign) int loopCount;
214 
218 @property (nonatomic, assign) BOOL sendEnabled;
219 
223 @property (nonatomic, assign) BOOL playbackEnabled;
224 
229 @property (nonatomic, assign) uint32_t sendVolume;
230 
235 @property (nonatomic, assign) uint32_t playbackVolume;
236 
242 - (BOOL)isInvalid;
243 
244 @end
245 
247 @interface NERtcCreateAudioEffectOption : NSObject
248 
254 @property (nonatomic, copy) NSString *path;
255 
262 @property (nonatomic, assign) int loopCount;
263 
267 @property (nonatomic, assign) BOOL sendEnabled;
268 
272 @property (nonatomic, assign) BOOL playbackEnabled;
273 
278 @property (nonatomic, assign) uint32_t sendVolume;
279 
284 @property (nonatomic, assign) uint32_t playbackVolume;
285 
286 @end
287 
288 
289 #pragma mark - live stream
293 @interface NERtcLiveConfig: NSObject
294 
302 @property (nonatomic, assign) BOOL singleVideoPassthrough;
310 @property (nonatomic, assign) NSInteger audioBitrate;
311 
319 @property (nonatomic, assign) NERtcLiveStreamAudioSampleRate sampleRate;
320 
326 @property (nonatomic, assign) NSInteger channels;
327 
333 @property (nonatomic, assign) NERtcLiveStreamAudioCodecProfile audioCodecProfile;
334 
335 @end
336 
340 @interface NERtcLiveStreamUserTranscoding: NSObject
341 
345 @property (nonatomic, assign) uint64_t uid;
346 
354 @property (nonatomic, assign) BOOL videoPush;
355 
363 @property (nonatomic, assign) NSInteger x;
364 
372 @property (nonatomic, assign) NSInteger y;
373 
381 @property (nonatomic, assign) NSInteger width;
382 
390 @property (nonatomic, assign) NSInteger height;
391 
397 @property (nonatomic, assign) BOOL audioPush;
398 
402 @property (nonatomic, assign) NSInteger zOrder;
403 
407 @property (nonatomic, assign) NERtcLiveStreamVideoScaleMode adaption;
408 
409 @end
410 
411 
415 @interface NERtcLiveStreamImageInfo: NSObject
416 
420 @property (nonatomic, copy) NSString *url;
421 
429 @property (nonatomic, assign) NSInteger x;
430 
438 @property (nonatomic, assign) NSInteger y;
439 
445 @property (nonatomic, assign) NSInteger width;
446 
452 @property (nonatomic, assign) NSInteger height;
453 
454 @end
455 
456 
460 @interface NERtcLiveStreamLayout: NSObject
461 
465 @property (nonatomic, assign) NSInteger width;
466 
470 @property (nonatomic, assign) NSInteger height;
471 
475 @property (nonatomic, assign) NSUInteger backgroundColor;
476 
480 @property (nonatomic, strong) NSArray<NERtcLiveStreamUserTranscoding *> * users;
481 
485 @property (nonatomic, nullable, strong) NERtcLiveStreamImageInfo* bgImage;
486 
487 @end
488 
492 @interface NERtcLiveStreamTaskInfo: NSObject
493 
497 @property (nonatomic, copy) NSString *taskID;
498 
503 @property (nonatomic, copy) NSString *streamURL;
504 
508 @property (nonatomic, assign) BOOL serverRecordEnabled;
509 
513 @property (nonatomic, assign) NERtcLiveStreamMode lsMode;
514 
518 @property (nonatomic, nullable, strong) NERtcLiveStreamLayout *layout;
519 
523 @property (nonatomic, nullable, strong) NERtcLiveConfig *config;
524 
528 @property (nonatomic, nullable, copy) NSString *extraInfo;
529 
533 - (BOOL)isInvalid;
534 
535 @end
536 
537 
538 #pragma mark -- Audio Frame Observer
542 @interface NERtcAudioFrameRequestFormat : NSObject
550 @property (nonatomic, assign) uint32_t channels;
554 @property (nonatomic, assign) uint32_t sampleRate;
558 @property (nonatomic, assign) NERtcAudioFrameOpMode mode;
559 
560 @end
561 
565 @interface NERtcAudioFormat : NSObject
569 @property (nonatomic, assign) NERtcAudioType type;
576 @property (nonatomic, assign) uint32_t channels;
580 @property (nonatomic, assign) uint32_t sampleRate;
584 @property (nonatomic, assign) uint32_t bytesPerSample;
588 @property (nonatomic, assign) uint32_t samplesPerChannel;
589 
590 @end
591 
595 @interface NERtcAudioFrame : NSObject
599 @property (nonatomic, strong) NERtcAudioFormat* format;
603 @property (nonatomic, assign) void* data;
604 
605 @end
606 
607 
608 #pragma mark - Volume info
609 
613 @interface NERtcAudioVolumeInfo : NSObject
614 
618 @property (nonatomic, assign) uint64_t uid;
619 
623 @property (nonatomic, assign) unsigned int volume;
624 
625 @end
626 
627 
628 #pragma mark - Video Frame
629 
633 @interface NERtcVideoFrame : NSObject
634 
638 @property(nonatomic, assign) NERtcVideoFormatType format;
639 
643 @property(nonatomic, assign) uint64_t timestamp;
644 
648 @property(nonatomic, assign) uint32_t width;
649 
653 @property(nonatomic, assign) uint32_t height;
654 
658 @property(nonatomic, assign) NERtcVideoRotationType rotation;
659 
663 @property(nonatomic) void * buffer;
664 
665 @end
666 
667 #pragma mark- MediaRelay
668 
672 @interface NERtcChannelMediaRelayInfo : NSObject
673 
677 @property (nonatomic, copy)NSString *channelName;
681 @property (nonatomic, copy)NSString *token;
685 @property (nonatomic, assign)uint64_t uid;
686 
687 @end
688 
690 
698 @property(nonatomic, strong, readonly)NSDictionary<NSString *, NERtcChannelMediaRelayInfo *> * _Nullable destinationInfos;
699 
707 @property(nonatomic, strong)NERtcChannelMediaRelayInfo *sourceInfo;
708 
718 - (BOOL)setDestinationInfo:(NERtcChannelMediaRelayInfo *_Nonnull)destinationInfo forChannelName:(NSString *_Nonnull)channelName;
719 
726 - (BOOL)removeDestinationInfoForChannelName:(NSString *_Nonnull)channelName;
727 
728 @end
729 
730 #pragma mark - watermark
731 
737 @interface NERtcTextWatermarkConfig : NSObject
745 @property (nonatomic, copy, nullable) NSString *content;
746 
750 @property (nonatomic, assign) CGFloat fontSize;
751 
755 @property (nonatomic, strong, nullable) UIColor *fontColor;
756 
760 @property (nonatomic, strong, nullable) UIColor *wmColor;
761 
765 @property (nonatomic, assign) CGRect frame;
766 
767 @end
768 
775 @interface NERtcTimestampWatermarkConfig : NSObject
776 
780 @property (nonatomic, assign) CGFloat fontSize;
781 
785 @property (nonatomic, strong) UIColor *fontColor;
786 
790 @property (nonatomic, assign) CGRect frame;
791 
795 @property (nonatomic, strong) UIColor *wmColor;
796 
797 @end
798 
804 @interface NERtcImageWatermarkConfig : NSObject
805 
809 @property (nonatomic, strong, nullable) NSArray<UIImage *> *images;
810 
814 @property (nonatomic, assign) NSUInteger fps;
815 
819 @property (nonatomic, assign) BOOL loop;
820 
824 @property (nonatomic, assign) CGRect frame;
825 
826 @end
827 
828 
834 @interface NERtcCanvasWatermarkConfig : NSObject
835 
839 @property (nonatomic, strong, nullable) NSArray<NERtcTextWatermarkConfig *> *textWatermarks;
840 
844 @property (nonatomic, strong, nullable) NERtcTimestampWatermarkConfig *timestampWatermark;
845 
849 @property (nonatomic, strong, nullable) NSArray<NERtcImageWatermarkConfig *> *imageWaterMarks;
850 
851 @end
852 
856 @interface NERtcEncryptionConfig : NSObject
857 
861 @property (nonatomic, assign) NERtcEncryptionMode mode;
862 
866 @property (nonatomic, copy, nullable) NSString *key;
867 
868 @end
869 #pragma mark - privatization
870 
875 @interface NERtcServerAddresses : NSObject
876 
880 @property (nonatomic, copy, nullable) NSString *channelServer;
881 
885 @property (nonatomic, copy, nullable) NSString *statisticsServer;
886 
890 @property (nonatomic, copy, nullable) NSString *roomServer;
891 
895 @property (nonatomic, copy, nullable) NSString *compatServer;
896 
900 @property (nonatomic, copy, nullable) NSString *nosLbsServer;
901 
905 @property (nonatomic, copy, nullable) NSString *nosUploadSever;
906 
910 @property (nonatomic, copy, nullable) NSString *nosTokenServer;
911 
915 @property (nonatomic, assign) BOOL useIPv6;
916 
920 @property (nonatomic, copy, nullable) NSString *cloudProxyServer;
921 
925 @property (nonatomic, copy, nullable) NSString *webSocketProxyServer;
926 
930 @property (nonatomic, copy, nullable) NSString *quicProxyServer;
931 
935 @property (nonatomic, copy, nullable) NSString *mediaProxyServer;
936 
937 @end
938 
939 #pragma mark -- Log setting
940 
944 @interface NERtcLogSetting : NSObject
945 
949 @property (nonatomic, copy) NSString *logDir;
950 
954 @property (nonatomic, assign) NERtcLogLevel logLevel;
955 
956 @end
957 NS_ASSUME_NONNULL_END
NSString *const kNERtcKeyAutoSubscribeAudio
NSString *const kNERtcKeyRecordType
NSString *const kNERtcKeyRecordVideoEnabled
FOUNDATION_EXPORT uint32_t const NERtcAudioMixingDefaultVolume
Definition: NERtcEngineBase.h:194
NSString *const kNERtcKeyVideoCaptureObserverEnabled
NSString *const KNERtcKeyAudioAINSEnable
FOUNDATION_EXPORT uint32_t const NERtcAudioMixingMaxVolume
Definition: NERtcEngineBase.h:193
NSString *const KNERtcKeyEnableReportVolumeWhenMute
NSString *const kNERtcKeyExtraInfo
NSString *const kNERtcKeyVideoStartWithBackCamera
NSString *const kNERtcKeyVideoPreferHWEncode
NSString *const kNERtcKeyVideoPreferMetalRender
NSString *const kNERtcKeyVideoSendOnPubType
NSString *const KNERtcKeyDisableOverrideSpeakerOnReceiver
NSString *const kNERtcKeyPublishSelfStreamEnabled
NSString *const KNERtcKeyDisableSWAECOnHeadset
NSString *const kNERtcKeyLogLevel
NSString *const kNERtcKeyRecordHostEnabled
NSString *const kNERtcKeyVideoPreferHWDecode
NSString *const kNERtcKeyRecordAudioEnabled
NS_ASSUME_NONNULL_BEGIN NSString *const kNERtcKeyChannel1V1ModeEnabled
The following keys are used in INERtcEngine::setParameters.
NERtcLiveStreamMode
Streaming mode in live streaming
Definition: NERtcEngineEnum.h:682
NERtcVideoCropMode
Video crop mode
Definition: NERtcEngineEnum.h:284
NERtcLogLevel
Log level
Definition: NERtcEngineEnum.h:891
NERtcVideoFormatType
Video format type
Definition: NERtcEngineEnum.h:324
NERtcLiveStreamVideoScaleMode
Scale mode in live streaming
Definition: NERtcEngineEnum.h:696
NERtcSubStreamContentPrefer
Encoding strategy preference for screen sharing
Definition: NERtcEngineEnum.h:180
NERtcLiveStreamAudioCodecProfile
Live streaming audio codec profile
Definition: NERtcEngineEnum.h:672
NERtcVideoOutputOrientationMode
Video orientation mode.
Definition: NERtcEngineEnum.h:261
NERtcVideoProfileType
Video profile type
Definition: NERtcEngineEnum.h:113
NERtcAudioType
Audio type
Definition: NERtcEngineEnum.h:721
NERtcVideoMirrorMode
Video mirror mode.
Definition: NERtcEngineEnum.h:249
NERtcAudioFrameOpMode
Audio data read and write mode
Definition: NERtcEngineEnum.h:729
NERtcEncryptionMode
Encryption mode
Definition: NERtcEngineEnum.h:851
NERtcDegradationPreference
Video encoding adaptation preference with limited bandwidth.
Definition: NERtcEngineEnum.h:162
NERtcLiveStreamAudioSampleRate
Live streaming audio sample rate
Definition: NERtcEngineEnum.h:660
NERtcVideoFrameRate
Video frame rate -kNERtcVideoFrameRateFpsDefault: By default, the bigstream video frame rate is selec...
Definition: NERtcEngineEnum.h:135
NERtcVideoRenderScaleMode
Video rendering zoom mode
Definition: NERtcEngineEnum.h:224
NERtcVideoRotationType
Rotation direction of video data
Definition: NERtcEngineEnum.h:310
The audio format
Definition: NERtcEngineBase.h:566
The audio frame
Definition: NERtcEngineBase.h:596
The request format of the audio raw data callback (unspecified by default).
Definition: NERtcEngineBase.h:543
Audio volume information
Definition: NERtcEngineBase.h:614
Local video basic publishing configuration
Definition: NERtcEngineBase.h:86
Canvas watermark settings.
Definition: NERtcEngineBase.h:835
Definition: NERtcEngineBase.h:690
Data structure related to media stream relay.
Definition: NERtcEngineBase.h:673
Options for creating audio effects
Definition: NERtcEngineBase.h:248
Options for creating mixing audios
Definition: NERtcEngineBase.h:199
Configure the media stream encryption mode and key.
Definition: NERtcEngineBase.h:857
Sets the parameters for image watermarks
Definition: NERtcEngineBase.h:805
Settings, such as encoding parameters of RTC streams
Definition: NERtcEngineBase.h:294
Picture layout
Definition: NERtcEngineBase.h:416
The live streaming layout.
Definition: NERtcEngineBase.h:461
Configuration of streaming tasks in a live event
Definition: NERtcEngineBase.h:493
The member layout in live streaming
Definition: NERtcEngineBase.h:341
Log-related settings
Definition: NERtcEngineBase.h:945
Configure private servers.
Definition: NERtcEngineBase.h:876
Sets the parameters for text watermarks
Definition: NERtcEngineBase.h:738
Timestamp watermark
Definition: NERtcEngineBase.h:776
Configures the video canvas.
Definition: NERtcEngineBase.h:53
id< NERtcEngineVideoRenderSink > externalVideoRender
External renderer
Definition: NERtcEngineBase.h:79
BOOL useExternalRender
Specifies whether to use an external renderer.
Definition: NERtcEngineBase.h:57
NERtcVideoRenderScaleMode renderMode
Video rendering mode
Definition: NERtcEngineBase.h:67
VIEW_CLASS * container
Video window container (SDK internal rendering)
Definition: NERtcEngineBase.h:62
NERtcVideoMirrorMode mirrorMode
Video mirror mode.
Definition: NERtcEngineBase.h:74
Local video publishing configuration
Definition: NERtcEngineBase.h:125
Video frame information
Definition: NERtcEngineBase.h:634
Local substream publishing configuration
Definition: NERtcEngineBase.h:184
External audio rendering.
Definition: NERtcEngineDelegate.h:253