如果你希望从此前版本的 macOS 客户端 SDK 升级到最新的客户端 SDK,请在工程文件中,替换最新的客户端 SDK 文件,并参考本文完成 API,回调,参数类型等的替换。
升级过程中,你可能需要参考历史版本文档归档。
变更详情 | 功能模块 | 改动的数据类型 | 说明 |
---|---|---|---|
新增枚举值 | 音效 | ByteRTCPlayerState |
自 3.57 版本起,macOS SDK 支持的最低版本为 macOS 10.13。
该版本对所有不规范的 API 命名进行了统一修复,提升代码规范度和易用性。以下仅为变更示例,请至类型详情页查看所用类型的具体改动。
变更对象 | 变更详情 | 旧版示例 | 新版示例 |
---|---|---|---|
枚举值 | 统一以 “ByteRTC” 为前缀,改为“类名+值名” | 以 ByteRTCSEICountPerFrame 为例:
| 以 ByteRTCSEICountPerFrame 为例:
|
结构体成员 | 改为首字母小写,驼峰标识 | 以 ByteRTCLocalStreamStats 为例:
| 以 ByteRTCLocalStreamStats 为例:
|
变更详情 | 功能模块 | 废弃的类/接口 | 替代的类/接口 | 说明 |
---|---|---|---|---|
删除 | 主调类 | ByteRTCEngineKit | ByteRTCVideo | |
删除 | 引擎管理 | ByteRTCVideo.setEnv | RTCVideo.createRTCVideo:delegate:parameters: | 咨询技术支持获取详细信息。 |
废弃 | 自定义流处理 | setLocalVideoSink | setLocalVideoRender:withSink:withLocalRenderConfig: | 原接口废弃,新接口支持回调采集后的视频帧。新接口使用默认值时行为与原接口一致。 |
废弃 | 自定义流处理 | setRemoteVideoSink | setRemoteVideoRender:withSink:withRemoteRenderConfig: | 原接口废弃,新接口支持将远端流镜像渲染、将旋转角旋转为 0 度。新接口使用默认值时行为与原接口一致。 |
使用范围拓展 | 视频处理 | setVideoDecoderConfig | setVideoDecoderConfig | 旧版接口仅支持在手动订阅时使用,新增支持在自动订阅时使用。 |
删除 | 音频处理 | ByteRTCAudioProcessor | ByteRTCAudioFrameProcessor | ByteRTCAudioProcessor 已在 3.42 中废弃。此次进行了删除。 |
参数数据结构新增成员变量 | 音频管理 | enableAudioPropertiesReport | enableAudioPropertiesReport | 新增参数 enableVoicePitch 控制是否回调本地用户的人声基频。 |
废弃 | 视频处理 | ByteRTCVideo.getAuthMessage | ByteRTCVideoEffect.getAuthMessage | 使用类 ByteRTCVideoEffect 中的同名方法,替换 ByteRTCVideo 中的方法。 |
变更详情 | 功能模块 | 废弃的类/接口 | 替代的类/接口 | 说明 |
---|---|---|---|---|
删除 | 主回调类 | ByteRTCEngineDelegate | ByteRTCVideoDelegate | |
参数变更 | 消息 | (void)rtcEngineOnLogout:(ByteRTCVideo * _Nonnull)engine NS_SWIFT_NAME(rtcEngineOnLogout(_:)) | (void)rtcEngine:(ByteRTCVideo * _Nonnull)engine onLogout:(ByteRTCLogoutReason)reason | 在 onLogout 回调上新增 reason 参数,区分用户主动/被动登出。 |
参数数据结构新增成员变量 | 音频管理 | onLocalAudioPropertiesReport | onLocalAudioPropertiesReport | 新增参数voicePitch 返回本地用户的人声基频。 |
变更详情 | 功能模块 | 改动的数据类型 | 说明 |
---|---|---|---|
成员变量新增 | 字幕翻译服务 | ByteRTCSubtitleMessage | 在字幕内容回调 rtcRoom:onSubtitleMessageReceived: 的参数 ByteRTCSubtitleMessage 中新增成员变量 language 和 mode ,可用于同时收到字幕原文和字幕译文。 |
成员变量变更 | CDN 推流 | ByteRTCMixedStreamLayoutRegionConfig | 转推直播单个用户画面由设置相对于整体画面的归一化比例变更为可设置像素绝对值。 |
枚举值重命名 | 视频管理 | ByteRTCVideoSourceType | ByteRTCVideoSourceTypeEncodedManualSimulcast = 2 变更为 ByteRTCVideoSourceTypeEncodedAutoSimulcast = 2 ByteRTCVideoSourceTypeEncodedAutoSimulcast = 3 变更为 ByteRTCVideoSourceTypeEncodedManualSimulcast = 3 |
变更详情 | 错误码 | 说明 |
---|---|---|
枚举值增删 | ByteRTCUserMessageSendResult | 新增客户端向业务服务器发送消息失败错误码:ByteRTCUserMessageSendResultE2BSSendFailed = 17 ByteRTCUserMessageSendResultE2BSReturnFailed = 18 |
变更详情 | 功能模块 | 变动前方法 | 变动后方法 | 说明 |
---|---|---|---|---|
将混音相关的类和接口按音效和音乐进行拆分,具体变动情况请参看混音相关的新旧接口对应表 | 混音 | 一般来说,对于短时间的音效(比如小于 20s),可以使用音效类;对于较长的音频或 PCM 数据,可以使用音乐类。 | ||
行为变更 | 音频管理 | 等待超时后返回空列表,超时时间默认为 10 s | ||
行为变更 | 视频管理 | enumerateVideoCaptureDevices | 等待超时后返回空列表,超时时间默认为 10 s |
变更详情 | 类型 | 变更前 | 变更后 | 说明 |
---|---|---|---|---|
参数变更 | ByteRTCRoomStats |
|
|
附:混音相关的新旧接口对应表
接口分类 | 接口用途 | 废弃类/接口 | 新类/接口(音效) | 新类/接口(音乐) | 备注 |
---|---|---|---|---|---|
获取实例 | 获取播放器实例 | getAudioMixingManager | getAudioEffectPlayer | getMediaPlayer | |
混音类 | ByteRTCAudioMixingManager | ByteRTCAudioEffectPlayer | ByteRTCMediaPlayer | ||
混音主调接口 | 将音效文件加载至内存 |
|
|
| |
播放/停止/暂停/恢复 |
|
|
| ||
获取/指定位置/时长 |
|
|
| ||
获取/指定音量 |
|
|
| ||
调整音调 | setAudioMixingPitch | NA | setAudioPitch | ||
设置声道模式 | setAudioMixingDualMonoMode | NA | setAudioDualMonoMode | ||
获取/设置音轨数 |
| NA |
|
| |
设置播放速度 | setAudioMixingPlaybackSpeed | NA | setPlaybackSpeed | ||
设置播放进度回调间隔 | setAudioMixingProgressInterval | NA | setProgressInterval | ||
设置响度 | setAudioMixingLoudness | NA | setLoudness | ||
播放外部音频源 |
| NA |
| ||
混音回调接口 | 播放状态回调 |
|
|
| |
音频数据回调 |
| NA |
|
变更详情 | 功能模块 | 变动前方法 | 变动后方法 | 说明 |
---|---|---|---|---|
参数变更 | 引擎管理 | feedback:info: | 参数数据类型变更 | |
废弃 | CDN 推流 | - (int)startLiveTranscoding:(NSString * _Nonnull)taskID transcoding:(ByteRTCLiveTranscoding *_Nullable)transcoding observer:(id<LiveTranscodingDelegate> _Nullable)observer; | - (int)startPushMixedStreamToCDN:(NSString * _Nonnull)taskID mixedConfig:(ByteRTCMixedStreamConfig *_Nullable)config observer:(id<ByteRTCMixedStreamObserver> _Nullable)observer; | 合流转推直播接口/参数类型重命名,行为逻辑无变化,新旧版本类名对应关系参看该版本中“类型变更” |
- (int)stopLiveTranscoding:(NSString *_Nonnull)taskID; | - (int)stopPushStreamToCDN:(NSString *_Nonnull)taskID NS_SWIFT_NAME(stopPushStreamToCDN(_:)); | |||
- (int)updateLiveTranscoding:(NSString *_Nonnull)taskID transcoding:(ByteRTCLiveTranscoding *_Nonnull)transcoding; | - (int)updatePushMixedStreamToCDN:(NSString *_Nonnull)taskID mixedConfig:(ByteRTCMixedStreamConfig *_Nonnull)config; | |||
合并 | 高级功能 |
|
| 新接口支持本地用户同时设置本地用户的发声位置和发声朝向。 |
| 新接口支持本地用户设置远端用户的发声位置和发声朝向。 |
变更详情 | 方法 | 说明 |
---|---|---|
参数变更 |
| 参数 变更为 拆分为:
|
变更详情 | 类型 | 变更前 | 变更后 | 说明 |
---|---|---|---|---|
重命名 | 转推直播一级结构体 | ByteRTCLiveTranscoding | ByteRTCMixedStreamConfig | 结构体中变量名称/方法名称均有变更,请至对应的类型详情中查看 |
转推直播 Observer | LiveTranscodingDelegate | ByteRTCMixedStreamObserver | ||
转推直播二级结构体 | ByteRTCTranscodingVideoConfig | ByteRTCMixedStreamVideoConfig | 结构体中变量名称/方法名称均有变更,请至对应的类型详情中查看 | |
ByteRTCTranscodingAudioConfig | ByteRTCMixedStreamAudioConfig | |||
ByteRTCTranscodingSpatialConfig | ByteRTCMixedStreamSpatialAudioConfig | |||
ByteRTCTranscodingClientMixParam | ByteRTCMixedStreamClientMixConfig | |||
ByteRTCVideoCompositingRegion | ByteRTCMixedStreamLayoutRegionConfig | |||
ByteRTCVideoCompositingLayout | ByteRTCMixedStreamLayoutConfig | |||
转推直播相关枚举类型 | ByteRTCClientMixVideoFormat | ByteRTCMixedStreamClientMixVideoFormat | 各枚举类中的枚举值名称均有变更,请至对应的类型详情中查看 | |
ByteRTCTranscoderContentControlType | ByteRTCMixedStreamMediaType | |||
ByteRTCRenderMode | ByteRTCMixedStreamRenderMode | |||
ByteRTCTranscoderLayoutRegionType | ByteRTCMixedStreamLayoutRegionType | |||
ByteRTCAACProfile | ByteRTCMixedStreamAudioProfile | |||
ByteRTCTranscodingVideoCodec | ByteRTCMixedStreamVideoCodecType | |||
ByteRTCTranscodingAudioCodec | ByteRTCMixedStreamAudioCodecType | |||
ByteRTCStreamMixingType | ByteRTCMixedStreamType |
变更详情 | 错误码 | 说明 |
---|---|---|
枚举值变更 | 新增枚举值:
名称变更:
| |
新增枚举值 | ||
废弃枚举值 ByteRTCErrorCodeOverScreenPublishLimit=-1081 , 用 ByteRTCErrorCodeOverStreamPublishLimit=-1080 代替。 |
该版本 SDK 产物新增 libAGFX.dylib
和 libbytenn.dylib
依赖库,需手动导入项目,具体添加方式参看添加依赖。
原 ByteRTCCommonDefines.h 文件拆分为 ByteRTCMediaDefines.h 及 ByteRTCRtsDefines.h
变更详情 | 功能模块 | 变动前方法 | 变动后方法 | 备注 |
---|---|---|---|---|
拆分 | 视频管理 |
| 解除人脸识别与视频特效之间的耦合,提升接口易用性。 | |
参数变更 | 消息 |
| 返回参数类型由 | |
(int64_t)sendUserBinaryMessage:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message config:(ByteRTCMessageConfig)config; | (NSInteger)sendUserBinaryMessage:(NSString * _Nonnull)uid message:(NSData * _Nonnull)message config:(ByteRTCMessageConfig)config; | |||
(int64_t)sendRoomMessage:(NSString *_Nonnull)message NS_SWIFT_NAME(sendRoomMessage(_:)); | (NSInteger)sendRoomMessage:(NSString *_Nonnull)message NS_SWIFT_NAME(sendRoomMessage(_:)); | |||
(int64_t)sendRoomBinaryMessage:(NSData * _Nonnull)message NS_SWIFT_NAME(sendRoomBinaryMessage(_:)); | (NSInteger)sendRoomBinaryMessage:(NSData * _Nonnull)message NS_SWIFT_NAME(sendRoomBinaryMessage(_:)); | |||
(int64_t)sendUserMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSString * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; | (NSInteger)sendUserMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSString * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; | |||
(int64_t)sendUserBinaryMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSData * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; | (NSInteger)sendUserBinaryMessageOutsideRoom:(NSString * _Nonnull)userId message:(NSData * _Nonnull)messageStr config:(ByteRTCMessageConfig)config; | |||
(int64_t)sendServerMessage:(NSString * _Nonnull)messageStr; | (NSInteger)sendServerMessage:(NSString * _Nonnull)messageStr; | |||
(int64_t)sendServerBinaryMessage:(NSData * _Nonnull)messageStr; | (NSInteger)sendServerBinaryMessage:(NSData * _Nonnull)messageStr; | |||
参数类型变更 | 屏幕共享 |
|
| 参数类型变更为新增的 |
行为变更、名称变更 | 屏幕共享 |
|
| 优化屏幕共享接口的行为 |
所属类型变更、名称变更、参数变更 | 音视频处理 |
|
| |
| ||||
(int) setVideoEffectNodes:(NSArray <NSString *> *_Nonnull)effectNodePaths; | (int) setEffectNodes:(NSArray<NSString*>*_Nonnull)effect_nodes; | |||
(int) updateVideoEffectNode:(NSString * _Nonnull)nodePath nodeKey:(NSString * _Nonnull)nodeKey nodeValue:(float) nodeValue; | (int) updateEffectNode:(NSString* _Nonnull)node key:(NSString* _Nonnull)key value:(float) value; | |||
| ||||
(int) setVideoEffectColorFilter:(NSString * _Nonnull)resPath; | (int) setColorFilter:(NSString* _Nonnull)filter_res; | |||
(int) setVideoEffectColorFilterIntensity:(float) intensity; | (int) setColorFilterIntensity:(float) intensity; | |||
参数变更 | 消息 | (int)sendSEIMessage:(ByteRTCStreamIndex)streamIndex andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount; | (int)sendSEIMessage:(ByteRTCStreamIndex)streamIndex andMessage:(NSData* _Nonnull)message andRepeatCount:(int)repeatCount andCountPerFrame:(ByteRTCSEICountPerFrame) mode; | 支持 SEI 多发模式,即在 1 帧间隔内多次发送 SEI 数据时,多个 SEI 随下个视频帧同时发送。 |
多个模块 | 返回值类型变化,例如:
以下接口返回值类型由 void 变为 int,具体 int 值含义参考新增数据结构 | |||
视频管理 |
|
| ||
|
| |||
名称和参数变更 | 音视频传输 |
|
| |
|
| |||
屏幕分享 |
|
|
| |
自定义流处理 |
|
|
| |
|
|
| ||
名称变更 | 高级功能 |
| 大驼峰变为小驼峰。 | |
SetVideoWatermark | setVideoWatermark | |||
音视频处理 | ClearVideoWatermark | clearVideoWatermark | ||
ClearVideoWatermark | clearVideoWatermark | |||
视频管理 | SetVideoEncoderConfig | setVideoEncoderConfig | ||
SetMaxVideoEncoderConfig | setMaxVideoEncoderConfig | |||
屏幕分享 | getScreenCaptureSourceThumbnail | getThumbnail | ||
房间管理 | joinRoomByToken | joinRoom | ||
renewToken | updateToken | |||
setRtcRoomDelegate | setRTCRoomDelegate | 修正大小写。 | ||
引擎管理 | getSdkVersion | getSDKVersion | 修正大小写。 | |
安全与加密 | setEncryptType | setEncryptInfo | ||
屏幕分享 | SetScreenVideoEncoderConfig | setScreenVideoEncoderConfig | ||
音频管理 | startPlaybackDeviceTest | startAudioPlaybackDeviceTest | ||
stopPlaybackDeviceTest | stopAudioPlaybackDeviceTest | |||
删除 | 自定义流处理 | 删除:
| 由以下接口替代: |
变更详情 | 功能模块 | 变动前回调 | 变动后回调 | 备注 |
---|---|---|---|---|
参数变更 | 消息 |
|
| |
(void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(int64_t)msgid error:(ByteRTCRoomMessageSendResult)error; | (void)rtcRoom:( ByteRTCRoom *_Nonnull)rtcRoom onRoomMessageSendResult:(NSInteger)msgid error:(ByteRTCRoomMessageSendResult)error; | |||
(void)rtcEngine:(ByteRTCVideo * _Nonnull)engine onUserMessageSendResultOutsideRoom:(int64_t)msgid error:(ByteRTCUserMessageSendResult)error; | (void)rtcEngine:(ByteRTCVideo * _Nonnull)engine onUserMessageSendResultOutsideRoom:(NSInteger)msgid error:(ByteRTCUserMessageSendResult)error; | |||
CDN 推流 |
| 新增参数 | ||
消息 |
| |||
名称变更 | 房间管理 | onLeaveRoomWithStats | onLeaveRoom | |
音视频传输 |
| |||
networkTypeChangedToType | onNetworkTypeChanged | |||
reportSysStats | onSysStats | |||
网络管理 |
| |||
OnSimulcastSubscribeFallback | onSimulcastSubscribeFallback | 大驼峰变为小驼峰。 | ||
安全与加密 | ByteRTCEncryptRawData | onEncryptData | ||
ByteRTCDecryptRawData | onDecryptData | |||
视频管理 | onFaceDetectionResult | onFaceDetectResult | ||
删除 | 音视频传输 | 删除: | / | |
删除回调类 | 范围语音 |
| 此前,在手动订阅的场景下,如果你希望使用范围语音功能,你必须根据此回调获取的衰减系数,设定音量。 |
变更详情 | 数据类型 | 备注 |
---|---|---|
取值范围拓展 | ByteRTCVideoCompositingRegion 中,width 和 height | 取值范围由 (0.0, 1.0] 拓展为 [0.0, 1.0] 。 |
枚举值增删 | ByteRTCAudioFrameMethod | 新增枚举值:ByteRTCAudioFrameProcessorEarMonitor = 3 |
成员变量变更 | ByteRTCFaceDetectionResult | 新增成员变量:frameTimestamp |
ByteRTCVideoCanvas | 删除变量:roomId 和 uid | |
| ||
ByteRTCLiveTranscoding | 新增成员变量:ByteRTCTranscodingClientMixParam | |
变量类型变更 | 空间音频功能中表示空间坐标的 position 的 变量 x , y , z 类型由 int 更改为 float 。 | 提升球面立体声渲染效果。 |
配置变更 | ByteRTCRoomProfile | 房间属性的默认值 ByteRTCRoomProfileCommunication = 0 ,对应的由 ByteRTCRoomProfileChatRoom = 6 变更为 ByteRTCRoomProfileMeeting = 16 。 |
变更详情 | 错误码 | 备注 |
---|---|---|
枚举值增删 | ByteRTCErrorCode | 新增枚举值:ByteRTCUserIDDifferent = -1014 |
ByteRTCUserMessageSendResult | 新增枚举值:ByteRTCUserMessageSendResultExceedQPS = 5 | |
ByteRTCRoomMessageSendResult | 新增枚举值:ByteRTCRoomMessageSendResultExceedQPS = 5 | |
新增 | ByteRTCPublicStreamErrorCode | onPlayPublicStreamResult: 和 onPushPublicStreamResult: 中的 errorCode 参数类型由 ByteRTCTranscodingError 改为 ByteRTCPublicStreamErrorCode |
以下表格中的类型发生了变化,你需要在工程文件中找到该类型,并根据变化调整相关处理逻辑:
变更详情 | 数据类型 | 备注 |
---|---|---|
枚举值增删 | ByteRTCAudioFrameMethod | 新增屏幕共享音频的枚举值: ByteRTCAudioFrameProcessorScreen = 4 |
以下表格中的方法发生了变化。你需要在工程文件中找到该方法,并进行相关修改:
变更详情 | 功能模块 | 方法 | 备注 |
---|---|---|---|
参数数据结构改动 | 音频管理 | (void)enableAudioPropertiesReport:(ByteRTCAudioPropertiesConfig* _Nonnull)config; | 数据结构中,新增参数:ByteRTCAudioPropertiesMode ByteRTCAudioReportMode |
以下表格中的方法发生了变化。你需要在工程文件中找到该方法,并进行相关修改:
变更详情 | 功能模块 | 变动前方法 | 变动后方法 | 备注 |
---|---|---|---|---|
废弃原方法 | 音频处理 | (void)muteAudioPlayback:(ByteRTCMuteState)muteState; | (void)setPlaybackVolume:(NSInteger)volume; | 设置远端用户音量为 0 即可停止播放本地收到的音频流 |